parent
ab047aafbb
commit
87492b3e37
@ -0,0 +1,65 @@ |
|||||||
|
<p align="center"> |
||||||
|
<img width="100" src="https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png"> |
||||||
|
</p> |
||||||
|
|
||||||
|
## 简介 |
||||||
|
|
||||||
|
一个前后端分离的简易进销存后台管理系统,基于 [SpringBoot](https://spring.io/projects/spring-boot/) 和 [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)实现,具备常见的后台管理功能,登录态使用session,使用基于资源url的简单权限控制。 |
||||||
|
|
||||||
|
- [在线预览](https://toesbieya.cn) |
||||||
|
|
||||||
|
## 开发 |
||||||
|
|
||||||
|
**前端没有写mock,必须搭配后端启动。** |
||||||
|
|
||||||
|
**后端依赖jdk8,mysql8.0,redis3.2,请确保本地具备以上环境。初次安装时请运行后端项目的初始化sql脚本** |
||||||
|
|
||||||
|
**大部分情况下,你只需要修改后端的application.yml里的mysql、redis、七牛配置项,前端需要修改config/index.js里的七牛云相关配置项即可** |
||||||
|
|
||||||
|
##前端说明 |
||||||
|
|
||||||
|
- 基于[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin) 4.2.1,功能做了大量调整,具体如下: |
||||||
|
``` |
||||||
|
- 样式修改 |
||||||
|
- 标签页tagsView右键菜单样式风格改为和侧边栏一样 |
||||||
|
- 对ele的样式做了修改,具体可以查看assets/style/element-ui.scss,或者在预览页面里查看`演示用例->样式` |
||||||
|
- 移除响应式功能(复杂的后台管理想做成像VuePress那样的响应式不现实) |
||||||
|
- 布局修改 |
||||||
|
- 经典后台布局改用flex实现 |
||||||
|
- 主页面使用el-scrollbar包裹 |
||||||
|
- 增加了ele的backToTop组件 |
||||||
|
- 路由修改 |
||||||
|
- 修改部分路由配置项,详细请看代码备注 |
||||||
|
- addRoutes时不判断权限,添加全部路由,然后在全局路由守卫内判断是否有权限进入页面 |
||||||
|
- 组件修改 |
||||||
|
- 侧边栏、导航栏增加了一些显示效果,具体可以在个性化设置内查看 |
||||||
|
- 标签页tagsView改造,加入了快捷键切换、拖拽排序、双击关闭功能,平滑滚动,修复关闭所有后路由未跳转的bug |
||||||
|
- 面包屑改成样子货,纯粹展示当前路由路径 |
||||||
|
``` |
||||||
|
|
||||||
|
- 目录结构 |
||||||
|
``` |
||||||
|
├── mock # 项目mock,有需要的可以自己写,然后在vue.config.js里配置devServer |
||||||
|
├── public |
||||||
|
├── src |
||||||
|
│ ├── api |
||||||
|
│ ├── assets |
||||||
|
│ │ │── icons # 项目所有 svg icons |
||||||
|
│ │ └── styles # 全局样式 |
||||||
|
│ ├── bizComponents # 全局公用业务组件 |
||||||
|
│ ├── components # 全局公用组件 |
||||||
|
│ ├── config |
||||||
|
│ │ │── index.js # 基础配置项 |
||||||
|
│ │ └── request.js # axios封装 |
||||||
|
│ ├── directive |
||||||
|
│ ├── filters |
||||||
|
│ ├── layout |
||||||
|
│ ├── mixins # 公用混入 |
||||||
|
│ ├── plugin # 一些插件 |
||||||
|
│ ├── router |
||||||
|
│ ├── store |
||||||
|
│ ├── utils |
||||||
|
│ ├── views |
||||||
|
│ ├── App.vue |
||||||
|
│ └── main.js |
||||||
|
``` |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
/target/ |
||||||
|
/.idea/ |
||||||
|
*.iml |
||||||
|
.mvn |
||||||
|
mvnw |
||||||
|
*.cmd |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,170 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||||
|
<version>2.2.1.RELEASE</version> |
||||||
|
<relativePath/> <!-- lookup parent from repository --> |
||||||
|
</parent> |
||||||
|
<groupId>com.toesbieya</groupId> |
||||||
|
<artifactId>my</artifactId> |
||||||
|
<version>0.0.1</version> |
||||||
|
<name>my</name> |
||||||
|
<description>简易进销存</description> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<java.version>1.8</java.version> |
||||||
|
<mybatis.version>2.1.0</mybatis.version> |
||||||
|
<pagehelper.version>1.2.12</pagehelper.version> |
||||||
|
<socketio.version>1.7.11</socketio.version> |
||||||
|
<guava.version>28.1-jre</guava.version> |
||||||
|
<fastjson.version>1.2.60</fastjson.version> |
||||||
|
|
||||||
|
<!--系统监控--> |
||||||
|
<jna.version>5.5.0</jna.version> |
||||||
|
<oshi.version>4.3.0</oshi.version> |
||||||
|
|
||||||
|
<!--七牛云--> |
||||||
|
<qiniu.version>[7.2.0, 7.2.99]</qiniu.version> |
||||||
|
|
||||||
|
<!--三方工具--> |
||||||
|
<easyexcel.version>2.1.6</easyexcel.version> |
||||||
|
<poi.version>4.1.1</poi.version> |
||||||
|
<ehcache.version>3.8.1</ehcache.version> |
||||||
|
<cglib.version>3.3.0</cglib.version> |
||||||
|
</properties> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-aop</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.session</groupId> |
||||||
|
<artifactId>spring-session-data-redis</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--mysql数据库相关--> |
||||||
|
<dependency> |
||||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||||
|
<version>${mybatis.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>mysql</groupId> |
||||||
|
<artifactId>mysql-connector-java</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.github.pagehelper</groupId> |
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId> |
||||||
|
<version>${pagehelper.version}</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.corundumstudio.socketio</groupId> |
||||||
|
<artifactId>netty-socketio</artifactId> |
||||||
|
<version>${socketio.version}</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.projectlombok</groupId> |
||||||
|
<artifactId>lombok</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.google.guava</groupId> |
||||||
|
<artifactId>guava</artifactId> |
||||||
|
<version>${guava.version}</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>fastjson</artifactId> |
||||||
|
<version>${fastjson.version}</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--七牛云--> |
||||||
|
<dependency> |
||||||
|
<groupId>com.qiniu</groupId> |
||||||
|
<artifactId>qiniu-java-sdk</artifactId> |
||||||
|
<version>${qiniu.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.squareup.okhttp3</groupId> |
||||||
|
<artifactId>okhttp</artifactId> |
||||||
|
<scope>compile</scope> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.google.code.gson</groupId> |
||||||
|
<artifactId>gson</artifactId> |
||||||
|
<scope>compile</scope> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--系统监控--> |
||||||
|
<dependency> |
||||||
|
<groupId>com.github.oshi</groupId> |
||||||
|
<artifactId>oshi-core</artifactId> |
||||||
|
<version>${oshi.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>net.java.dev.jna</groupId> |
||||||
|
<artifactId>jna</artifactId> |
||||||
|
<version>${jna.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>net.java.dev.jna</groupId> |
||||||
|
<artifactId>jna-platform</artifactId> |
||||||
|
<version>${jna.version}</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- 三方工具类 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>easyexcel</artifactId> |
||||||
|
<version>${easyexcel.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>cglib</groupId> |
||||||
|
<artifactId>cglib</artifactId> |
||||||
|
<version>${cglib.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.ehcache</groupId> |
||||||
|
<artifactId>ehcache</artifactId> |
||||||
|
<version>${ehcache.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.poi</groupId> |
||||||
|
<artifactId>poi</artifactId> |
||||||
|
<version>${poi.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.poi</groupId> |
||||||
|
<artifactId>poi-ooxml</artifactId> |
||||||
|
<version>${poi.version}</version> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<finalName>${project.name}</finalName> |
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
</project> |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.toesbieya.my; |
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan; |
||||||
|
import org.springframework.boot.SpringApplication; |
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||||
|
import org.springframework.cache.annotation.EnableCaching; |
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling; |
||||||
|
|
||||||
|
@SpringBootApplication |
||||||
|
@MapperScan("com.toesbieya.my.mapper") |
||||||
|
@EnableScheduling |
||||||
|
@EnableCaching |
||||||
|
public class MyApplication { |
||||||
|
public static void main(String[] args) { |
||||||
|
SpringApplication.run(MyApplication.class, args); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.toesbieya.my.annoation; |
||||||
|
|
||||||
|
import java.lang.annotation.*; |
||||||
|
|
||||||
|
@Target(ElementType.METHOD) |
||||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||||
|
@Documented |
||||||
|
public @interface Lock { |
||||||
|
String[] value() default {}; |
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.toesbieya.my.annoation; |
||||||
|
|
||||||
|
import java.lang.annotation.*; |
||||||
|
|
||||||
|
@Target(ElementType.METHOD) |
||||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||||
|
@Documented |
||||||
|
public @interface TimeCost { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.annoation; |
||||||
|
|
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import java.lang.annotation.*; |
||||||
|
|
||||||
|
@Target(ElementType.METHOD) |
||||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||||
|
@Documented |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public @interface Tx { |
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.toesbieya.my.annoation; |
||||||
|
|
||||||
|
import java.lang.annotation.*; |
||||||
|
|
||||||
|
@Target(ElementType.METHOD) |
||||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||||
|
@Documented |
||||||
|
public @interface UserAction { |
||||||
|
String value() default ""; |
||||||
|
} |
||||||
@ -0,0 +1,74 @@ |
|||||||
|
package com.toesbieya.my.aspect; |
||||||
|
|
||||||
|
import com.toesbieya.my.annoation.Lock; |
||||||
|
import com.toesbieya.my.module.redis.LockHelper; |
||||||
|
import com.toesbieya.my.module.redis.RedisLockHelper; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.SpringUtil; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||||
|
import org.aspectj.lang.annotation.*; |
||||||
|
import org.aspectj.lang.reflect.MethodSignature; |
||||||
|
import org.springframework.core.annotation.Order; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
|
||||||
|
import java.lang.reflect.Method; |
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
@Component |
||||||
|
@Aspect |
||||||
|
@Slf4j |
||||||
|
@Order(Integer.MAX_VALUE - 1) |
||||||
|
public class LockAspect { |
||||||
|
private ThreadLocal<ArrayList<LockHelper>> lockHelperThreadLocal = new ThreadLocal<>(); |
||||||
|
|
||||||
|
@Pointcut("@annotation(com.toesbieya.my.annoation.Lock)&&execution(com.toesbieya.my.utils.Result com.toesbieya.my..*.*(..))") |
||||||
|
public void pointCut() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Around("pointCut()") |
||||||
|
public Object around(ProceedingJoinPoint point) throws Throwable { |
||||||
|
MethodSignature signature = (MethodSignature) point.getSignature(); |
||||||
|
Method method = signature.getMethod(); |
||||||
|
String[] values = method.getAnnotation(Lock.class).value(); |
||||||
|
if (values.length <= 0) { |
||||||
|
return point.proceed(); |
||||||
|
} |
||||||
|
ArrayList<LockHelper> locks = new ArrayList<>(); |
||||||
|
String[] parameterNames = signature.getParameterNames(); |
||||||
|
Object[] args = point.getArgs(); |
||||||
|
for (String v : values) { |
||||||
|
String lockKey = (String) SpringUtil.spell(v, parameterNames, args); |
||||||
|
LockHelper lockHelper = new RedisLockHelper(lockKey); |
||||||
|
if (!lockHelper.lock()) { |
||||||
|
if (locks.size() > 0) { |
||||||
|
locks.forEach(LockHelper::close); |
||||||
|
} |
||||||
|
return Result.fail("操作失败,请刷新后重试"); |
||||||
|
} |
||||||
|
locks.add(lockHelper); |
||||||
|
} |
||||||
|
lockHelperThreadLocal.set(locks); |
||||||
|
return point.proceed(); |
||||||
|
} |
||||||
|
|
||||||
|
@AfterReturning("pointCut()") |
||||||
|
public void afterReturning() { |
||||||
|
unlock(); |
||||||
|
} |
||||||
|
|
||||||
|
@AfterThrowing("pointCut()") |
||||||
|
public void afterThrowing() { |
||||||
|
unlock(); |
||||||
|
} |
||||||
|
|
||||||
|
private void unlock() { |
||||||
|
ArrayList<LockHelper> locks = lockHelperThreadLocal.get(); |
||||||
|
if (!CollectionUtils.isEmpty(locks)) { |
||||||
|
locks.forEach(LockHelper::close); |
||||||
|
lockHelperThreadLocal.remove(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
package com.toesbieya.my.aspect; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.aspectj.lang.JoinPoint; |
||||||
|
import org.aspectj.lang.annotation.AfterReturning; |
||||||
|
import org.aspectj.lang.annotation.Aspect; |
||||||
|
import org.aspectj.lang.annotation.Before; |
||||||
|
import org.aspectj.lang.annotation.Pointcut; |
||||||
|
import org.aspectj.lang.reflect.MethodSignature; |
||||||
|
import org.springframework.core.annotation.Order; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.lang.reflect.Method; |
||||||
|
import java.time.Instant; |
||||||
|
import java.time.temporal.ChronoUnit; |
||||||
|
|
||||||
|
@Component |
||||||
|
@Aspect |
||||||
|
@Slf4j |
||||||
|
@Order(1) |
||||||
|
public class TimeCostAspect { |
||||||
|
private ThreadLocal<Instant> instantThreadLocal = new ThreadLocal<>(); |
||||||
|
|
||||||
|
@Pointcut("@annotation(com.toesbieya.my.annoation.TimeCost)") |
||||||
|
public void pointCut() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Before("pointCut()") |
||||||
|
public void before() { |
||||||
|
instantThreadLocal.set(Instant.now()); |
||||||
|
} |
||||||
|
|
||||||
|
@AfterReturning("pointCut()") |
||||||
|
public void afterReturning(JoinPoint point) { |
||||||
|
if (null != instantThreadLocal.get()) { |
||||||
|
MethodSignature signature = (MethodSignature) point.getSignature(); |
||||||
|
Method method = signature.getMethod(); |
||||||
|
log.info("类:{},方法:{},耗时:{}毫秒", |
||||||
|
method.getDeclaringClass().getName(), |
||||||
|
method.getName(), |
||||||
|
ChronoUnit.MILLIS.between(instantThreadLocal.get(), Instant.now())); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,69 @@ |
|||||||
|
package com.toesbieya.my.aspect; |
||||||
|
|
||||||
|
import com.toesbieya.my.annoation.UserAction; |
||||||
|
import com.toesbieya.my.enumeration.UserActionEnum; |
||||||
|
import com.toesbieya.my.model.entity.RecUserAction; |
||||||
|
import com.toesbieya.my.service.RecService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.SpringUtil; |
||||||
|
import com.toesbieya.my.utils.ThreadUtil; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||||
|
import org.aspectj.lang.annotation.Around; |
||||||
|
import org.aspectj.lang.annotation.Aspect; |
||||||
|
import org.aspectj.lang.annotation.Pointcut; |
||||||
|
import org.aspectj.lang.reflect.MethodSignature; |
||||||
|
import org.springframework.core.annotation.Order; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.lang.reflect.Method; |
||||||
|
|
||||||
|
@Component |
||||||
|
@Aspect |
||||||
|
@Slf4j |
||||||
|
@Order(Integer.MAX_VALUE - 2) |
||||||
|
public class UserActionAspect { |
||||||
|
@Resource |
||||||
|
private RecService recService; |
||||||
|
|
||||||
|
@Pointcut("@annotation(com.toesbieya.my.annoation.UserAction)&&execution(com.toesbieya.my.utils.Result com.toesbieya.my..*.*(..))") |
||||||
|
public void pointCut() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Around("pointCut()") |
||||||
|
public Object around(ProceedingJoinPoint pjp) throws Throwable { |
||||||
|
RecUserAction action = ThreadUtil.getAction(); |
||||||
|
if (action == null) { |
||||||
|
return pjp.proceed(); |
||||||
|
} |
||||||
|
|
||||||
|
MethodSignature signature = (MethodSignature) pjp.getSignature(); |
||||||
|
Method method = signature.getMethod(); |
||||||
|
Object[] args = pjp.getArgs(); |
||||||
|
String[] argNames = signature.getParameterNames(); |
||||||
|
UserAction annotation = method.getAnnotation(UserAction.class); |
||||||
|
|
||||||
|
//优先使用注解表达式
|
||||||
|
if (!StringUtils.isEmpty(annotation.value())) { |
||||||
|
String str = (String) SpringUtil.spell(annotation.value(), argNames, args); |
||||||
|
if (!StringUtils.isEmpty(str)) { |
||||||
|
action.setAction(str); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Result result = (Result) pjp.proceed(); |
||||||
|
|
||||||
|
if (result.isSuccess()) { |
||||||
|
recService.insertUserAction(action, UserActionEnum.SUCCESS); |
||||||
|
} |
||||||
|
else { |
||||||
|
action.setError(result.getMsg()); |
||||||
|
recService.insertUserAction(action, UserActionEnum.FAIL); |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
package com.toesbieya.my.config; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.scheduling.annotation.AsyncConfigurer; |
||||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
||||||
|
|
||||||
|
import java.util.concurrent.Executor; |
||||||
|
import java.util.concurrent.ThreadPoolExecutor; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
@EnableAsync |
||||||
|
@Slf4j |
||||||
|
public class ExecutorConfig implements AsyncConfigurer { |
||||||
|
|
||||||
|
@Override |
||||||
|
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { |
||||||
|
return (ex, method, params) -> { |
||||||
|
log.error("异步线程执行失败。方法:[{}],异常信息[{}] : ", method, ex.getMessage(), ex); |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
//定时任务线程池
|
||||||
|
@Bean |
||||||
|
public Executor scheduledExecutor() { |
||||||
|
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); |
||||||
|
//核心线程数
|
||||||
|
threadPoolTaskExecutor.setCorePoolSize(2); |
||||||
|
//是否回收空闲线程
|
||||||
|
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(true); |
||||||
|
//最大线程数
|
||||||
|
threadPoolTaskExecutor.setMaxPoolSize(5); |
||||||
|
//配置等待队列大小
|
||||||
|
threadPoolTaskExecutor.setQueueCapacity(2); |
||||||
|
//配置线程池前缀
|
||||||
|
threadPoolTaskExecutor.setThreadNamePrefix("scheduled-"); |
||||||
|
//拒绝策略
|
||||||
|
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); |
||||||
|
threadPoolTaskExecutor.initialize(); |
||||||
|
return threadPoolTaskExecutor; |
||||||
|
} |
||||||
|
|
||||||
|
//数据库插入线程池
|
||||||
|
@Bean |
||||||
|
public Executor dbInsertExecutor() { |
||||||
|
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); |
||||||
|
//核心线程数
|
||||||
|
threadPoolTaskExecutor.setCorePoolSize(5); |
||||||
|
//是否回收空闲线程
|
||||||
|
threadPoolTaskExecutor.setAllowCoreThreadTimeOut(true); |
||||||
|
//最大线程数
|
||||||
|
threadPoolTaskExecutor.setMaxPoolSize(10); |
||||||
|
//配置等待队列大小
|
||||||
|
threadPoolTaskExecutor.setQueueCapacity(50); |
||||||
|
//配置线程池前缀
|
||||||
|
threadPoolTaskExecutor.setThreadNamePrefix("dbInsert-"); |
||||||
|
//拒绝策略
|
||||||
|
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); |
||||||
|
threadPoolTaskExecutor.initialize(); |
||||||
|
return threadPoolTaskExecutor; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
package com.toesbieya.my.config; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.toesbieya.my.listener.RedisSessionListener; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.data.redis.serializer.RedisSerializer; |
||||||
|
import org.springframework.data.redis.serializer.SerializationException; |
||||||
|
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; |
||||||
|
|
||||||
|
import java.nio.charset.Charset; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
@EnableRedisHttpSession() |
||||||
|
public class HttpSessionConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public RedisSessionListener httpSessionEventPublisher() { |
||||||
|
return new RedisSessionListener(); |
||||||
|
} |
||||||
|
|
||||||
|
@Bean("springSessionDefaultRedisSerializer") |
||||||
|
public RedisSerializer<Object> defaultRedisSerializer() { |
||||||
|
return new JsonRedisSerializer<>(Object.class); |
||||||
|
} |
||||||
|
|
||||||
|
private class JsonRedisSerializer<T> implements RedisSerializer<T> { |
||||||
|
|
||||||
|
private final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; |
||||||
|
|
||||||
|
private Class<T> clazz; |
||||||
|
|
||||||
|
public JsonRedisSerializer(Class<T> clazz) { |
||||||
|
this.clazz = clazz; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public byte[] serialize(T t) throws SerializationException { |
||||||
|
if (t == null) { |
||||||
|
return new byte[0]; |
||||||
|
} |
||||||
|
return JSON.toJSONString(t).getBytes(DEFAULT_CHARSET); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public T deserialize(byte[] bytes) throws SerializationException { |
||||||
|
if (bytes == null || bytes.length <= 0) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
String str = new String(bytes, DEFAULT_CHARSET); |
||||||
|
return JSON.parseObject(str, clazz); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
package com.toesbieya.my.config; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.support.spring.FastJsonRedisSerializer; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.data.redis.cache.RedisCacheConfiguration; |
||||||
|
import org.springframework.data.redis.cache.RedisCacheManager; |
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||||
|
import org.springframework.data.redis.core.RedisTemplate; |
||||||
|
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; |
||||||
|
import org.springframework.data.redis.serializer.RedisSerializationContext; |
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer; |
||||||
|
|
||||||
|
import java.time.Duration; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class RedisConfig { |
||||||
|
@Bean |
||||||
|
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory factory) { |
||||||
|
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); |
||||||
|
redisTemplate.setConnectionFactory(factory); |
||||||
|
|
||||||
|
FastJsonRedisSerializer<Object> fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class); |
||||||
|
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); |
||||||
|
|
||||||
|
// 设置值(value)的序列化采用FastJsonRedisSerializer。
|
||||||
|
redisTemplate.setValueSerializer(fastJsonRedisSerializer); |
||||||
|
redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); |
||||||
|
|
||||||
|
// 设置键(key)的序列化采用StringRedisSerializer。
|
||||||
|
redisTemplate.setKeySerializer(stringRedisSerializer); |
||||||
|
redisTemplate.setHashKeySerializer(stringRedisSerializer); |
||||||
|
|
||||||
|
redisTemplate.setDefaultSerializer(fastJsonRedisSerializer); |
||||||
|
redisTemplate.afterPropertiesSet(); |
||||||
|
return redisTemplate; |
||||||
|
} |
||||||
|
|
||||||
|
@Bean |
||||||
|
public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) { |
||||||
|
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig() |
||||||
|
.entryTtl(Duration.ofSeconds(60)) |
||||||
|
// 设置key的序列化方式
|
||||||
|
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer())) |
||||||
|
// 设置value的序列化方式
|
||||||
|
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer())) |
||||||
|
// 不缓存null值
|
||||||
|
.disableCachingNullValues(); |
||||||
|
|
||||||
|
return RedisCacheManager.builder(connectionFactory) |
||||||
|
.cacheDefaults(config) |
||||||
|
.transactionAware() |
||||||
|
.build(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.toesbieya.my.config; |
||||||
|
|
||||||
|
import com.corundumstudio.socketio.SocketIOServer; |
||||||
|
import com.corundumstudio.socketio.annotation.SpringAnnotationScanner; |
||||||
|
import com.toesbieya.my.constant.SocketConstant; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class SocketConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public SocketIOServer socketIOServer() { |
||||||
|
com.corundumstudio.socketio.Configuration config = new com.corundumstudio.socketio.Configuration(); |
||||||
|
config.setHostname(SocketConstant.HOSTNAME); |
||||||
|
config.setPort(SocketConstant.PORT); |
||||||
|
config.setMaxFramePayloadLength(SocketConstant.MAX_FRAME_PAYLOAD); |
||||||
|
config.setMaxHttpContentLength(SocketConstant.MAX_HTTP_CONTENT); |
||||||
|
return new SocketIOServer(config); |
||||||
|
} |
||||||
|
|
||||||
|
@Bean |
||||||
|
public SpringAnnotationScanner springAnnotationScanner(SocketIOServer socketServer) { |
||||||
|
return new SpringAnnotationScanner(socketServer); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,67 @@ |
|||||||
|
package com.toesbieya.my.config; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
||||||
|
import com.alibaba.fastjson.support.config.FastJsonConfig; |
||||||
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; |
||||||
|
import com.toesbieya.my.interceptor.RateControlInterceptor; |
||||||
|
import com.toesbieya.my.interceptor.SecurityInterceptor; |
||||||
|
import com.toesbieya.my.interceptor.UserActionInterceptor; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.http.MediaType; |
||||||
|
import org.springframework.http.converter.HttpMessageConverter; |
||||||
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
||||||
|
import org.springframework.web.servlet.HandlerInterceptor; |
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistration; |
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class WebConfig implements WebMvcConfigurer { |
||||||
|
@Override |
||||||
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
||||||
|
/* |
||||||
|
先把JackSon的消息转换器删除. |
||||||
|
备注:(1)源码分析可知,返回json的过程为: |
||||||
|
Controller调用结束后返回一个数据对象,for循环遍历conventers,找到支持application/json的HttpMessageConverter,然后将返回的数据序列化成json。 |
||||||
|
具体参考org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor的writeWithMessageConverters方法 |
||||||
|
(2)由于是list结构,我们添加的fastjson在最后。因此必须要将jackson的转换器删除,不然会先匹配上jackson,导致没使用fastjson |
||||||
|
*/ |
||||||
|
for (int i = converters.size() - 1; i >= 0; i--) { |
||||||
|
if (converters.get(i) instanceof MappingJackson2HttpMessageConverter) { |
||||||
|
converters.remove(i); |
||||||
|
} |
||||||
|
} |
||||||
|
FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter(); |
||||||
|
FastJsonConfig config = new FastJsonConfig(); |
||||||
|
config.setSerializerFeatures( |
||||||
|
SerializerFeature.WriteMapNullValue, // 是否输出值为null的字段,默认为false,我们将它打开
|
||||||
|
SerializerFeature.WriteDateUseDateFormat, |
||||||
|
SerializerFeature.WriteNullListAsEmpty, |
||||||
|
SerializerFeature.DisableCircularReferenceDetect // 禁用循环引用
|
||||||
|
); |
||||||
|
fastJsonHttpMessageConverter.setFastJsonConfig(config); |
||||||
|
// 添加支持的MediaTypes;不添加时默认为*/*,也就是默认支持全部
|
||||||
|
// 但是MappingJackson2HttpMessageConverter里面支持的MediaTypes为application/json
|
||||||
|
// 参考它的做法, fastjson也只添加application/json的MediaType
|
||||||
|
List<MediaType> fastMediaTypes = new ArrayList<>(); |
||||||
|
fastMediaTypes.add(MediaType.APPLICATION_JSON); |
||||||
|
fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes); |
||||||
|
converters.add(fastJsonHttpMessageConverter); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void addInterceptors(InterceptorRegistry registry) { |
||||||
|
String[] exclude = {"/test/**", "/login", "/logout", "/register", "/error"}; |
||||||
|
addInterceptor(registry, new SecurityInterceptor(), exclude); |
||||||
|
addInterceptor(registry, new RateControlInterceptor(), exclude); |
||||||
|
addInterceptor(registry, new UserActionInterceptor(), exclude); |
||||||
|
} |
||||||
|
|
||||||
|
private void addInterceptor(InterceptorRegistry registry, HandlerInterceptor interceptor, String[] exclude) { |
||||||
|
InterceptorRegistration registration = registry.addInterceptor(interceptor).addPathPatterns("/**"); |
||||||
|
registration.excludePathPatterns(exclude); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.toesbieya.my.constant; |
||||||
|
|
||||||
|
public class SessionConstant { |
||||||
|
public static String REDIS_NAMESPACE = "spring:session:sessions:"; |
||||||
|
public static String USER_KEY = "user"; |
||||||
|
public static String TOKEN_KEY = "X-Token"; |
||||||
|
public static Integer PREDICT_MAX_USER = 128; |
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.toesbieya.my.constant; |
||||||
|
|
||||||
|
import com.toesbieya.my.utils.YmlUtil; |
||||||
|
|
||||||
|
public class SocketConstant { |
||||||
|
public static final String HOSTNAME = (String) YmlUtil.get("socket.hostname"); |
||||||
|
public static final int PORT = (int) YmlUtil.get("socket.port"); |
||||||
|
public static final int MAX_FRAME_PAYLOAD = (int) YmlUtil.get("socket.max-frame-payload"); |
||||||
|
public static final int MAX_HTTP_CONTENT = (int) YmlUtil.get("socket.max-http-content"); |
||||||
|
public static final String EVENT_LOGOUT = (String) YmlUtil.get("socket.event.logout"); |
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.vo.search.DocumentHistorySearch; |
||||||
|
import com.toesbieya.my.service.BizDocumentHistoryService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("document/history") |
||||||
|
public class BizDocumentHistoryController { |
||||||
|
@Resource |
||||||
|
private BizDocumentHistoryService documentHistoryService; |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get(@RequestParam("pid") String pid) { |
||||||
|
return Result.success(documentHistoryService.getByPid(pid)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody DocumentHistorySearch vo) { |
||||||
|
return Result.success(documentHistoryService.search(vo)); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,138 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.enumeration.BizDocumentStatusEnum; |
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseInbound; |
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseInboundSub; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.PurchaseInboundSearch; |
||||||
|
import com.toesbieya.my.model.vo.update.DocumentStatusUpdate; |
||||||
|
import com.toesbieya.my.service.BizPurchaseInboundService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("purchase/inbound") |
||||||
|
public class BizPurchaseInboundController { |
||||||
|
@Resource |
||||||
|
private BizPurchaseInboundService purchaseInboundService; |
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@GetMapping("getById") |
||||||
|
public Result getById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
BizPurchaseInbound inbound = purchaseInboundService.getById(id); |
||||||
|
return inbound == null ? Result.fail("获取单据信息失败") : Result.success(inbound); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getSubById") |
||||||
|
public Result getSubById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return Result.success(purchaseInboundService.getSubById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody PurchaseInboundSearch vo) { |
||||||
|
return Result.success(purchaseInboundService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("export") |
||||||
|
public void export(@RequestBody PurchaseInboundSearch vo, HttpServletResponse response) throws Exception { |
||||||
|
purchaseInboundService.export(vo, response); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody BizPurchaseInbound inbound) { |
||||||
|
String errMsg = validateSub(inbound.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
inbound.setCid(sysUser.getId()); |
||||||
|
inbound.setCname(sysUser.getName()); |
||||||
|
inbound.setCtime(System.currentTimeMillis()); |
||||||
|
inbound.setStatus(BizDocumentStatusEnum.DRAFT.getCode()); |
||||||
|
|
||||||
|
return purchaseInboundService.add(inbound); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody BizPurchaseInbound inbound) { |
||||||
|
String errMsg = validateUpdate(inbound); |
||||||
|
if (errMsg == null) errMsg = validateSub(inbound.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
return purchaseInboundService.update(inbound); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("commit") |
||||||
|
public Result commit(@RequestBody BizPurchaseInbound inbound) { |
||||||
|
boolean isFirst = StringUtils.isEmpty(inbound.getId()); |
||||||
|
|
||||||
|
String errMsg = validateSub(inbound.getData()); |
||||||
|
if (!isFirst && errMsg == null) errMsg = validateUpdate(inbound); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
inbound.setStatus(BizDocumentStatusEnum.WAIT_VERIFY.getCode()); |
||||||
|
if (isFirst) { |
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
inbound.setCid(sysUser.getId()); |
||||||
|
inbound.setCname(sysUser.getName()); |
||||||
|
inbound.setCtime(System.currentTimeMillis()); |
||||||
|
} |
||||||
|
return purchaseInboundService.commit(inbound); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("withdraw") |
||||||
|
public Result withdraw(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return purchaseInboundService.withdraw(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("pass") |
||||||
|
public Result pass(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
if (StringUtils.isEmpty(vo.getPid())) return Result.fail("参数错误"); |
||||||
|
return purchaseInboundService.pass(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("reject") |
||||||
|
public Result reject(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return purchaseInboundService.reject(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("del") |
||||||
|
public Result del(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return purchaseInboundService.del(id); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdate(BizPurchaseInbound main) { |
||||||
|
if (StringUtils.isEmpty(main.getId()) |
||||||
|
|| StringUtils.isEmpty(main.getPid()) |
||||||
|
|| StringUtils.isEmpty(main.getCid()) |
||||||
|
|| StringUtils.isEmpty(main.getCname()) |
||||||
|
|| StringUtils.isEmpty(main.getCtime()) |
||||||
|
|| StringUtils.isEmpty(main.getStatus()) |
||||||
|
) return "参数错误"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateSub(List<BizPurchaseInboundSub> list) { |
||||||
|
if (CollectionUtils.isEmpty(list)) return "采购入库单必须要有入库列表"; |
||||||
|
int i = 1; |
||||||
|
for (BizPurchaseInboundSub sub : list) { |
||||||
|
if (sub.getNum() == null || sub.getNum() <= 0) return "第" + i + "个入库商品数量有误"; |
||||||
|
if (sub.getCid() == null || StringUtils.isEmpty(sub.getCname())) return "第" + i + "个入库商品数量有误"; |
||||||
|
i++; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,147 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.enumeration.BizDocumentStatusEnum; |
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseOrder; |
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseOrderSub; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.PurchaseOrderSearch; |
||||||
|
import com.toesbieya.my.model.vo.update.DocumentStatusUpdate; |
||||||
|
import com.toesbieya.my.service.BizPurchaseOrderService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("purchase/order") |
||||||
|
public class BizPurchaseOrderController { |
||||||
|
@Resource |
||||||
|
private BizPurchaseOrderService purchaseOrderService; |
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@GetMapping("getById") |
||||||
|
public Result getById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
BizPurchaseOrder order = purchaseOrderService.getById(id); |
||||||
|
return order == null ? Result.fail("获取单据信息失败") : Result.success(order); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getSubById") |
||||||
|
public Result getSubById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return Result.success(purchaseOrderService.getSubById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody PurchaseOrderSearch vo) { |
||||||
|
return Result.success(purchaseOrderService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("export") |
||||||
|
public void export(@RequestBody PurchaseOrderSearch vo, HttpServletResponse response) throws Exception { |
||||||
|
purchaseOrderService.export(vo, response); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody BizPurchaseOrder order) { |
||||||
|
if (order.getSid() == null |
||||||
|
|| StringUtils.isEmpty(order.getSname()) |
||||||
|
|| order.getTotal() == null) { |
||||||
|
return Result.fail("参数错误"); |
||||||
|
} |
||||||
|
String errMsg = validateSub(order.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
|
||||||
|
order.setCid(sysUser.getId()); |
||||||
|
order.setCname(sysUser.getName()); |
||||||
|
order.setCtime(System.currentTimeMillis()); |
||||||
|
order.setStatus(BizDocumentStatusEnum.DRAFT.getCode()); |
||||||
|
|
||||||
|
return purchaseOrderService.add(order); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody BizPurchaseOrder order) { |
||||||
|
String errMsg = validateUpdate(order); |
||||||
|
if (errMsg == null) errMsg = validateSub(order.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
return purchaseOrderService.update(order); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("commit") |
||||||
|
public Result commit(@RequestBody BizPurchaseOrder order) { |
||||||
|
boolean isFirst = StringUtils.isEmpty(order.getId()); |
||||||
|
|
||||||
|
String errMsg = validateSub(order.getData()); |
||||||
|
if (!isFirst && errMsg == null) errMsg = validateUpdate(order); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
order.setStatus(BizDocumentStatusEnum.WAIT_VERIFY.getCode()); |
||||||
|
|
||||||
|
if (isFirst) { |
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
order.setCid(sysUser.getId()); |
||||||
|
order.setCname(sysUser.getName()); |
||||||
|
order.setCtime(System.currentTimeMillis()); |
||||||
|
} |
||||||
|
|
||||||
|
return purchaseOrderService.commit(order); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("withdraw") |
||||||
|
public Result withdraw(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return purchaseOrderService.withdraw(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("pass") |
||||||
|
public Result pass(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return purchaseOrderService.pass(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("reject") |
||||||
|
public Result reject(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return purchaseOrderService.reject(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("del") |
||||||
|
public Result del(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return purchaseOrderService.del(id); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdate(BizPurchaseOrder main) { |
||||||
|
if (StringUtils.isEmpty(main.getId()) |
||||||
|
|| StringUtils.isEmpty(main.getSid()) |
||||||
|
|| StringUtils.isEmpty(main.getSname()) |
||||||
|
|| StringUtils.isEmpty(main.getCid()) |
||||||
|
|| StringUtils.isEmpty(main.getCname()) |
||||||
|
|| StringUtils.isEmpty(main.getCtime()) |
||||||
|
|| StringUtils.isEmpty(main.getStatus()) |
||||||
|
|| main.getTotal() == null |
||||||
|
) return "参数错误"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateSub(List<BizPurchaseOrderSub> list) { |
||||||
|
if (CollectionUtils.isEmpty(list)) return "采购订单必须要有采购列表"; |
||||||
|
int i = 1; |
||||||
|
for (BizPurchaseOrderSub sub : list) { |
||||||
|
if (sub.getPrice() == null || sub.getPrice() <= 0) return "第" + i + "个采购商品价格有误"; |
||||||
|
if (sub.getNum() == null || sub.getNum() <= 0) return "第" + i + "个采购商品数量有误"; |
||||||
|
i++; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,147 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.enumeration.BizDocumentStatusEnum; |
||||||
|
import com.toesbieya.my.model.entity.BizSellOrder; |
||||||
|
import com.toesbieya.my.model.entity.BizSellOrderSub; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.SellOrderSearch; |
||||||
|
import com.toesbieya.my.model.vo.update.DocumentStatusUpdate; |
||||||
|
import com.toesbieya.my.service.BizSellOrderService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("sell/order") |
||||||
|
public class BizSellOrderController { |
||||||
|
@Resource |
||||||
|
private BizSellOrderService sellOrderService; |
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@GetMapping("getById") |
||||||
|
public Result getById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
BizSellOrder order = sellOrderService.getById(id); |
||||||
|
return order == null ? Result.fail("获取单据信息失败") : Result.success(order); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getSubById") |
||||||
|
public Result getSubById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return Result.success(sellOrderService.getSubById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody SellOrderSearch vo) { |
||||||
|
return Result.success(sellOrderService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("export") |
||||||
|
public void export(@RequestBody SellOrderSearch vo, HttpServletResponse response) throws Exception { |
||||||
|
sellOrderService.export(vo, response); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody BizSellOrder order) { |
||||||
|
if (order.getCustomer_id() == null |
||||||
|
|| StringUtils.isEmpty(order.getCustomer_name()) |
||||||
|
|| order.getTotal() == null) { |
||||||
|
return Result.fail("参数错误"); |
||||||
|
} |
||||||
|
String errMsg = validateSub(order.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
|
||||||
|
order.setCid(sysUser.getId()); |
||||||
|
order.setCname(sysUser.getName()); |
||||||
|
order.setCtime(System.currentTimeMillis()); |
||||||
|
order.setStatus(BizDocumentStatusEnum.DRAFT.getCode()); |
||||||
|
|
||||||
|
return sellOrderService.add(order); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody BizSellOrder order) { |
||||||
|
String errMsg = validateUpdate(order); |
||||||
|
if (errMsg == null) errMsg = validateSub(order.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
return sellOrderService.update(order); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("commit") |
||||||
|
public Result commit(@RequestBody BizSellOrder order) { |
||||||
|
boolean isFirst = StringUtils.isEmpty(order.getId()); |
||||||
|
|
||||||
|
String errMsg = validateSub(order.getData()); |
||||||
|
if (!isFirst && errMsg == null) errMsg = validateUpdate(order); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
order.setStatus(BizDocumentStatusEnum.WAIT_VERIFY.getCode()); |
||||||
|
|
||||||
|
if (isFirst) { |
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
order.setCid(sysUser.getId()); |
||||||
|
order.setCname(sysUser.getName()); |
||||||
|
order.setCtime(System.currentTimeMillis()); |
||||||
|
} |
||||||
|
|
||||||
|
return sellOrderService.commit(order); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("withdraw") |
||||||
|
public Result withdraw(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return sellOrderService.withdraw(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("pass") |
||||||
|
public Result pass(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return sellOrderService.pass(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("reject") |
||||||
|
public Result reject(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return sellOrderService.reject(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("del") |
||||||
|
public Result del(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return sellOrderService.del(id); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdate(BizSellOrder main) { |
||||||
|
if (StringUtils.isEmpty(main.getId()) |
||||||
|
|| StringUtils.isEmpty(main.getCustomer_id()) |
||||||
|
|| StringUtils.isEmpty(main.getCustomer_name()) |
||||||
|
|| StringUtils.isEmpty(main.getCid()) |
||||||
|
|| StringUtils.isEmpty(main.getCname()) |
||||||
|
|| StringUtils.isEmpty(main.getCtime()) |
||||||
|
|| StringUtils.isEmpty(main.getStatus()) |
||||||
|
|| main.getTotal() == null |
||||||
|
) return "参数错误"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateSub(List<BizSellOrderSub> list) { |
||||||
|
if (CollectionUtils.isEmpty(list)) return "销售订单必须要有销售列表"; |
||||||
|
int i = 1; |
||||||
|
for (BizSellOrderSub sub : list) { |
||||||
|
if (sub.getPrice() == null || sub.getPrice() <= 0) return "第" + i + "个销售商品价格有误"; |
||||||
|
if (sub.getNum() == null || sub.getNum() <= 0) return "第" + i + "个销售商品数量有误"; |
||||||
|
i++; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,139 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.enumeration.BizDocumentStatusEnum; |
||||||
|
import com.toesbieya.my.model.entity.BizSellOutbound; |
||||||
|
import com.toesbieya.my.model.entity.BizSellOutboundSub; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.SellOutboundSearch; |
||||||
|
import com.toesbieya.my.model.vo.update.DocumentStatusUpdate; |
||||||
|
import com.toesbieya.my.service.BizSellOutboundService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("sell/outbound") |
||||||
|
public class BizSellOutboundController { |
||||||
|
@Resource |
||||||
|
private BizSellOutboundService sellOutboundService; |
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@GetMapping("getById") |
||||||
|
public Result getById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
BizSellOutbound outbound = sellOutboundService.getById(id); |
||||||
|
return outbound == null ? Result.fail("获取单据信息失败") : Result.success(outbound); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getSubById") |
||||||
|
public Result getSubById(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return Result.success(sellOutboundService.getSubById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody SellOutboundSearch vo) { |
||||||
|
return Result.success(sellOutboundService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("export") |
||||||
|
public void export(@RequestBody SellOutboundSearch vo, HttpServletResponse response) throws Exception { |
||||||
|
sellOutboundService.export(vo, response); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody BizSellOutbound outbound) { |
||||||
|
String errMsg = validateSub(outbound.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
outbound.setCid(sysUser.getId()); |
||||||
|
outbound.setCname(sysUser.getName()); |
||||||
|
outbound.setCtime(System.currentTimeMillis()); |
||||||
|
outbound.setStatus(BizDocumentStatusEnum.DRAFT.getCode()); |
||||||
|
|
||||||
|
return sellOutboundService.add(outbound); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody BizSellOutbound outbound) { |
||||||
|
String errMsg = validateUpdate(outbound); |
||||||
|
if (errMsg == null) errMsg = validateSub(outbound.getData()); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
return sellOutboundService.update(outbound); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("commit") |
||||||
|
public Result commit(@RequestBody BizSellOutbound outbound) { |
||||||
|
boolean isFirst = StringUtils.isEmpty(outbound.getId()); |
||||||
|
|
||||||
|
String errMsg = validateSub(outbound.getData()); |
||||||
|
if (!isFirst && errMsg == null) errMsg = validateUpdate(outbound); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
outbound.setStatus(BizDocumentStatusEnum.WAIT_VERIFY.getCode()); |
||||||
|
if (isFirst) { |
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
assert sysUser != null; |
||||||
|
outbound.setCid(sysUser.getId()); |
||||||
|
outbound.setCname(sysUser.getName()); |
||||||
|
outbound.setCtime(System.currentTimeMillis()); |
||||||
|
} |
||||||
|
return sellOutboundService.commit(outbound); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("withdraw") |
||||||
|
public Result withdraw(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return sellOutboundService.withdraw(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("pass") |
||||||
|
public Result pass(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
if (StringUtils.isEmpty(vo.getPid())) return Result.fail("参数错误"); |
||||||
|
return sellOutboundService.pass(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("reject") |
||||||
|
public Result reject(@RequestBody DocumentStatusUpdate vo) { |
||||||
|
return sellOutboundService.reject(vo, Util.getUser(session)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("del") |
||||||
|
public Result del(@RequestParam String id) { |
||||||
|
if (StringUtils.isEmpty(id)) return Result.fail("参数错误"); |
||||||
|
return sellOutboundService.del(id); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdate(BizSellOutbound main) { |
||||||
|
if (StringUtils.isEmpty(main.getId()) |
||||||
|
|| StringUtils.isEmpty(main.getPid()) |
||||||
|
|| StringUtils.isEmpty(main.getCid()) |
||||||
|
|| StringUtils.isEmpty(main.getCname()) |
||||||
|
|| StringUtils.isEmpty(main.getCtime()) |
||||||
|
|| StringUtils.isEmpty(main.getStatus()) |
||||||
|
) return "参数错误"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateSub(List<BizSellOutboundSub> list) { |
||||||
|
if (CollectionUtils.isEmpty(list)) return "销售出库单必须要有出库列表"; |
||||||
|
int i = 1; |
||||||
|
for (BizSellOutboundSub sub : list) { |
||||||
|
if (sub.getSid() == null) return "第" + i + "个出库商品没有选择库存"; |
||||||
|
if (sub.getNum() == null || sub.getNum() <= 0) return "第" + i + "个出库商品数量有误"; |
||||||
|
if (sub.getCid() == null || StringUtils.isEmpty(sub.getCname())) return "第" + i + "个出库商品数量有误"; |
||||||
|
i++; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.vo.search.StockSearch; |
||||||
|
import com.toesbieya.my.service.BizStockService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("stock/current") |
||||||
|
public class BizStockController { |
||||||
|
@Resource |
||||||
|
private BizStockService stockService; |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody StockSearch vo) { |
||||||
|
return Result.success(stockService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getDetail") |
||||||
|
public Result getDetail(@RequestParam String cid) { |
||||||
|
if (StringUtils.isEmpty(cid)) return Result.fail("参数错误"); |
||||||
|
return Result.success(stockService.getDetail(cid)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getDetailById") |
||||||
|
public Result getDetailById(@RequestParam String ids) { |
||||||
|
if (StringUtils.isEmpty(ids)) return Result.fail("参数错误"); |
||||||
|
return Result.success(stockService.getDetailById(ids)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("export") |
||||||
|
public void export(@RequestBody StockSearch vo, HttpServletResponse response) throws Exception { |
||||||
|
stockService.export(vo, response); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.utils.QiniuUtil; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.net.URLDecoder; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("file") |
||||||
|
@Slf4j |
||||||
|
public class FileController { |
||||||
|
|
||||||
|
@GetMapping("delete") |
||||||
|
public Result delete(@RequestParam String url) throws UnsupportedEncodingException { |
||||||
|
QiniuUtil.delete(URLDecoder.decode(url, "utf-8")); |
||||||
|
return Result.success("删除成功"); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getToken") |
||||||
|
public Result getToken() { |
||||||
|
return Result.success(null, QiniuUtil.getToken()); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,71 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.enumeration.RecLoginHistoryEnum; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.service.RecService; |
||||||
|
import com.toesbieya.my.service.SysUserService; |
||||||
|
import com.toesbieya.my.utils.IpUtil; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@RestController |
||||||
|
public class LoginController { |
||||||
|
@Resource |
||||||
|
private SysUserService userService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private RecService recService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@PostMapping("login") |
||||||
|
public Result login(HttpServletRequest request, @RequestBody Map<String, String> map) { |
||||||
|
String username = map.get("username"); |
||||||
|
String password = map.get("password"); |
||||||
|
String err = validate(username, password); |
||||||
|
if (err != null) return Result.fail(err); |
||||||
|
|
||||||
|
return userService.login(username, password, IpUtil.getIp(request)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("register") |
||||||
|
public Result register(@RequestBody Map<String, String> map) { |
||||||
|
String username = map.get("username"); |
||||||
|
String password = map.get("password"); |
||||||
|
String err = validate(username, password); |
||||||
|
if (err != null) return Result.fail(err); |
||||||
|
|
||||||
|
return userService.register(username, password); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("logout") |
||||||
|
public Result logout(HttpServletRequest request) { |
||||||
|
SysUser user = Util.getUser(session); |
||||||
|
if (user != null) { |
||||||
|
recService.insertLoginHistory(user, IpUtil.getIp(request), RecLoginHistoryEnum.LOGOUT); |
||||||
|
} |
||||||
|
session.invalidate(); |
||||||
|
return Result.success("登出成功"); |
||||||
|
} |
||||||
|
|
||||||
|
private String validate(String username, String password) { |
||||||
|
if ((StringUtils.isEmpty(username) |
||||||
|
|| StringUtils.isEmpty(password) |
||||||
|
|| username.length() > 20 |
||||||
|
|| password.length() != 32)) { |
||||||
|
return "用户名或密码输入有误"; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.utils.MonitorUtil; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/monitor") |
||||||
|
public class MonitorController { |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get() { |
||||||
|
return Result.success(MonitorUtil.getMonitorInfo()); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.service.StatisticService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("statistic") |
||||||
|
public class StatisticController { |
||||||
|
@Resource |
||||||
|
private StatisticService statisticService; |
||||||
|
|
||||||
|
@GetMapping("getFourBlock") |
||||||
|
public Result getFourBlock() { |
||||||
|
return Result.success(statisticService.getFourBlock()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getDailyProfitStat") |
||||||
|
public Result getDailyProfitStat() { |
||||||
|
return Result.success(statisticService.getDailyProfitStat()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getDailyFinishOrder") |
||||||
|
public Result getDailyFinishOrder() { |
||||||
|
return Result.success(statisticService.getDailyFinishOrder()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getTotalProfitGoods") |
||||||
|
public Result getTotalProfitGoods() { |
||||||
|
return Result.success(statisticService.getTotalProfitGoods()); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysCategory; |
||||||
|
import com.toesbieya.my.model.vo.search.CategorySearch; |
||||||
|
import com.toesbieya.my.service.SysCategoryService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/category") |
||||||
|
public class SysCategoryController { |
||||||
|
@Resource |
||||||
|
private SysCategoryService categoryService; |
||||||
|
|
||||||
|
@GetMapping("getAll") |
||||||
|
public Result getAll() { |
||||||
|
return Result.success(categoryService.getAll()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody CategorySearch vo) { |
||||||
|
return Result.success(categoryService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody SysCategory category) { |
||||||
|
String errMsg = validateCategoryCreateParam(category); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
category.setCtime(System.currentTimeMillis()); |
||||||
|
return categoryService.add(category); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysCategory category) { |
||||||
|
String errMsg = validateCategoryUpdateParam(category); |
||||||
|
if (errMsg != null) return Result.fail(errMsg); |
||||||
|
|
||||||
|
return categoryService.update(category); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public Result del(@RequestBody SysCategory category) { |
||||||
|
if (category.getId() == null) return Result.fail("删除失败,参数错误"); |
||||||
|
return categoryService.del(category); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateCategoryCreateParam(SysCategory category) { |
||||||
|
if (category.getPid() == null) return "创建失败,参数错误"; |
||||||
|
if (StringUtils.isEmpty(category.getName())) return "创建失败,分类名称不能为空"; |
||||||
|
if (category.getType() == null) return "创建失败,分类类型不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateCategoryUpdateParam(SysCategory category) { |
||||||
|
if (category.getId() == null) return "修改失败,参数错误"; |
||||||
|
if (category.getPid() == null) return "创建失败,参数错误"; |
||||||
|
if (StringUtils.isEmpty(category.getName())) return "创建失败,分类名称不能为空"; |
||||||
|
if (category.getType() == null) return "创建失败,分类类型不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,70 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysCustomer; |
||||||
|
import com.toesbieya.my.model.vo.search.CustomerSearch; |
||||||
|
import com.toesbieya.my.service.SysCustomerService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/customer") |
||||||
|
public class SysCustomerController { |
||||||
|
@Resource |
||||||
|
private SysCustomerService customerService; |
||||||
|
|
||||||
|
@GetMapping("getLimitRegion") |
||||||
|
public Result getLimitRegion() { |
||||||
|
return Result.success(customerService.getLimitRegion()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get() { |
||||||
|
return Result.success(customerService.get()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody CustomerSearch vo) { |
||||||
|
return Result.success(customerService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody SysCustomer customer) { |
||||||
|
String errMsg = validateCreateParam(customer); |
||||||
|
if (errMsg != null) return Result.fail("创建失败," + errMsg); |
||||||
|
|
||||||
|
customer.setCtime(System.currentTimeMillis()); |
||||||
|
return customerService.add(customer); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysCustomer customer) { |
||||||
|
String errMsg = validateUpdateParam(customer); |
||||||
|
if (errMsg != null) return Result.fail("修改失败," + errMsg); |
||||||
|
|
||||||
|
return customerService.update(customer); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public Result del(@RequestBody SysCustomer customer) { |
||||||
|
if (customer.getId() == null) return Result.fail("删除失败,参数错误"); |
||||||
|
return customerService.del(customer); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateCreateParam(SysCustomer customer) { |
||||||
|
if (StringUtils.isEmpty(customer.getName())) return "客户名称不能为空"; |
||||||
|
if (StringUtils.isEmpty(customer.getRegion())) return "客户行政区域不能为空"; |
||||||
|
if (StringUtils.isEmpty(customer.getAddress())) return "客户地址不能为空"; |
||||||
|
if (StringUtils.isEmpty(customer.getLinkman())) return "客户联系人不能为空"; |
||||||
|
if (StringUtils.isEmpty(customer.getLinkphone())) return "客户联系电话不能为空"; |
||||||
|
if (customer.getStatus() == null) return "客户状态不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdateParam(SysCustomer customer) { |
||||||
|
if (customer.getId() == null) return "参数错误"; |
||||||
|
return validateCreateParam(customer); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysDepartment; |
||||||
|
import com.toesbieya.my.service.SysDepartmentService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/department") |
||||||
|
public class SysDepartmentController { |
||||||
|
@Resource |
||||||
|
private SysDepartmentService departmentService; |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get() { |
||||||
|
return Result.success(departmentService.get()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getAll") |
||||||
|
public Result getAll() { |
||||||
|
return Result.success(departmentService.getAll()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody SysDepartment department) { |
||||||
|
if (null == department.getPid() |
||||||
|
|| StringUtils.isEmpty(department.getName()) |
||||||
|
|| null == department.getStatus() |
||||||
|
) { |
||||||
|
return Result.fail("添加失败,参数错误"); |
||||||
|
} |
||||||
|
return departmentService.add(department); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysDepartment department) { |
||||||
|
if (null == department.getId() |
||||||
|
|| null == department.getPid() |
||||||
|
|| StringUtils.isEmpty(department.getName()) |
||||||
|
|| null == department.getStatus() |
||||||
|
) { |
||||||
|
return Result.fail("修改失败,参数错误"); |
||||||
|
} |
||||||
|
return departmentService.update(department); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public Result del(@RequestBody SysDepartment department) { |
||||||
|
if (null == department.getId() || StringUtils.isEmpty(department.getName())) { |
||||||
|
return Result.fail("删除失败,参数错误"); |
||||||
|
} |
||||||
|
return departmentService.del(department); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysResource; |
||||||
|
import com.toesbieya.my.service.SysResourceService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/resource") |
||||||
|
public class SysResourceController { |
||||||
|
@Resource |
||||||
|
private SysResourceService resourceService; |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get() { |
||||||
|
return Result.success(resourceService.get()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getAll") |
||||||
|
public Result getAll() { |
||||||
|
return Result.success(resourceService.getAll()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysResource resource) { |
||||||
|
if (resource.getId() == null |
||||||
|
|| resource.getTotal_rate() == null |
||||||
|
|| resource.getIp_rate() == null) { |
||||||
|
return Result.fail("参数错误"); |
||||||
|
} |
||||||
|
return resourceService.update(resource); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysRole; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.RoleSearch; |
||||||
|
import com.toesbieya.my.service.SysRoleService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
|
||||||
|
@RequestMapping("system/role") |
||||||
|
@RestController |
||||||
|
public class SysRoleController { |
||||||
|
@Resource |
||||||
|
private SysRoleService roleService; |
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get() { |
||||||
|
return Result.success(roleService.get()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody RoleSearch vo) { |
||||||
|
return Result.success(roleService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody SysRole role) { |
||||||
|
if (StringUtils.isEmpty(role.getName()) |
||||||
|
|| role.getStatus() == null) { |
||||||
|
return Result.fail("添加失败,参数错误"); |
||||||
|
} |
||||||
|
SysUser user = Util.getUser(session); |
||||||
|
assert user != null; |
||||||
|
role.setCid(user.getId()); |
||||||
|
role.setCname(user.getName()); |
||||||
|
role.setCtime(System.currentTimeMillis()); |
||||||
|
return roleService.add(role); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysRole role) { |
||||||
|
if (StringUtils.isEmpty(role.getName()) |
||||||
|
|| role.getId() == null |
||||||
|
|| role.getStatus() == null) { |
||||||
|
return Result.fail("修改失败,参数错误"); |
||||||
|
} |
||||||
|
return roleService.update(role); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public Result del(@RequestBody SysRole role) { |
||||||
|
if (role.getId() == null) return Result.fail("删除失败,参数错误"); |
||||||
|
return roleService.del(role); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,70 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysSupplier; |
||||||
|
import com.toesbieya.my.model.vo.search.SupplierSearch; |
||||||
|
import com.toesbieya.my.service.SysSupplierService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/supplier") |
||||||
|
public class SysSupplierController { |
||||||
|
@Resource |
||||||
|
private SysSupplierService supplierService; |
||||||
|
|
||||||
|
@GetMapping("getLimitRegion") |
||||||
|
public Result getLimitRegion() { |
||||||
|
return Result.success(supplierService.getLimitRegion()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("get") |
||||||
|
public Result get() { |
||||||
|
return Result.success(supplierService.get()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody SupplierSearch vo) { |
||||||
|
return Result.success(supplierService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody SysSupplier supplier) { |
||||||
|
String errMsg = validateCreateParam(supplier); |
||||||
|
if (errMsg != null) return Result.fail("添加失败," + errMsg); |
||||||
|
|
||||||
|
supplier.setCtime(System.currentTimeMillis()); |
||||||
|
return supplierService.add(supplier); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysSupplier supplier) { |
||||||
|
String errMsg = validateUpdateParam(supplier); |
||||||
|
if (errMsg != null) return Result.fail("修改失败," + errMsg); |
||||||
|
|
||||||
|
return supplierService.update(supplier); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public Result del(@RequestBody SysSupplier supplier) { |
||||||
|
if (supplier.getId() == null) return Result.fail("删除失败,参数错误"); |
||||||
|
return supplierService.del(supplier); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateCreateParam(SysSupplier supplier) { |
||||||
|
if (StringUtils.isEmpty(supplier.getName())) return "供应商名称不能为空"; |
||||||
|
if (StringUtils.isEmpty(supplier.getRegion())) return "供应商行政区域不能为空"; |
||||||
|
if (StringUtils.isEmpty(supplier.getAddress())) return "供应商地址不能为空"; |
||||||
|
if (StringUtils.isEmpty(supplier.getLinkman())) return "供应商联系人不能为空"; |
||||||
|
if (StringUtils.isEmpty(supplier.getLinkphone())) return "供应商联系电话不能为空"; |
||||||
|
if (supplier.getStatus() == null) return "供应商状态不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdateParam(SysSupplier supplier) { |
||||||
|
if (supplier.getId() == null) return "参数错误"; |
||||||
|
return validateCreateParam(supplier); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,162 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.RecUserAction; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.LoginHistorySearch; |
||||||
|
import com.toesbieya.my.model.vo.search.UserActionSearch; |
||||||
|
import com.toesbieya.my.model.vo.search.UserSearch; |
||||||
|
import com.toesbieya.my.model.vo.update.UserUpdatePwd; |
||||||
|
import com.toesbieya.my.service.RecService; |
||||||
|
import com.toesbieya.my.service.SysUserService; |
||||||
|
import com.toesbieya.my.utils.DateUtil; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.ThreadUtil; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import org.springframework.util.DigestUtils; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.net.URLDecoder; |
||||||
|
import java.util.List; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping("system/user") |
||||||
|
public class SysUserController { |
||||||
|
@Resource |
||||||
|
private SysUserService userService; |
||||||
|
@Resource |
||||||
|
private RecService recService; |
||||||
|
@Resource |
||||||
|
private HttpSession session; |
||||||
|
|
||||||
|
@PostMapping("search") |
||||||
|
public Result search(@RequestBody UserSearch vo) { |
||||||
|
return Result.success(userService.search(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("getLoginHistory") |
||||||
|
public Result getLoginHistory(@RequestBody LoginHistorySearch vo) { |
||||||
|
SysUser user = Util.getUser(session); |
||||||
|
assert user != null; |
||||||
|
if (!user.getAdmin().equals(1)) { |
||||||
|
vo.setStartTime(null); |
||||||
|
vo.setEndTime(DateUtil.getTimestampBeforeNow(-7)); |
||||||
|
} |
||||||
|
return Result.success(recService.searchLoginHistory(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("getUserAction") |
||||||
|
public Result getUserAction(@RequestBody UserActionSearch vo) { |
||||||
|
SysUser user = Util.getUser(session); |
||||||
|
assert user != null; |
||||||
|
if (user.getAdmin() != 1) { |
||||||
|
vo.setStartTime(null); |
||||||
|
vo.setEndTime(DateUtil.getTimestampBeforeNow(-7)); |
||||||
|
} |
||||||
|
return Result.success(recService.searchUserAction(vo)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("add") |
||||||
|
public Result add(@RequestBody SysUser user) { |
||||||
|
String errMsg = validateUserCreateParam(user); |
||||||
|
if (errMsg != null) { |
||||||
|
return Result.fail(errMsg); |
||||||
|
} |
||||||
|
return userService.add(user); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("update") |
||||||
|
public Result update(@RequestBody SysUser user) { |
||||||
|
String errMsg = validateUserUpdateParam(user); |
||||||
|
if (errMsg != null) { |
||||||
|
return Result.fail(errMsg); |
||||||
|
} |
||||||
|
userService.setUpdateAction(user); |
||||||
|
return userService.update(user); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("del") |
||||||
|
public Result del(@RequestBody SysUser user) { |
||||||
|
if (user.getId() == null) { |
||||||
|
return Result.fail("删除失败"); |
||||||
|
} |
||||||
|
return userService.del(user); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("kick") |
||||||
|
public Result kick(@RequestBody List<SysUser> users) { |
||||||
|
if (users == null || users.isEmpty()) { |
||||||
|
return Result.fail("参数错误"); |
||||||
|
} |
||||||
|
RecUserAction action = ThreadUtil.getAction(); |
||||||
|
List<String> names = users.stream().map(SysUser::getName).collect(Collectors.toList()); |
||||||
|
action.setAction("踢出用户:【" + String.join(",", names) + "】"); |
||||||
|
|
||||||
|
return userService.kick(users); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("updatePwd") |
||||||
|
public Result updatePwd(@RequestBody UserUpdatePwd vo) { |
||||||
|
SysUser user = Util.getUser(session); |
||||||
|
assert user != null; |
||||||
|
vo.setId(user.getId()); |
||||||
|
String errMsg = validateUpdatePwdParam(vo); |
||||||
|
if (errMsg != null) { |
||||||
|
return Result.fail(errMsg); |
||||||
|
} |
||||||
|
vo.setOld_pwd(DigestUtils.md5DigestAsHex(vo.getOld_pwd().getBytes())); |
||||||
|
vo.setNew_pwd(DigestUtils.md5DigestAsHex(vo.getNew_pwd().getBytes())); |
||||||
|
return userService.updatePwd(vo); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("resetPwd") |
||||||
|
public Result resetPwd(@RequestBody SysUser user) { |
||||||
|
if (user.getId() == null || StringUtils.isEmpty(user.getName())) { |
||||||
|
return Result.fail("参数错误"); |
||||||
|
} |
||||||
|
return userService.resetPwd(user); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("updateAvatar") |
||||||
|
public Result updateAvatar(@RequestParam String key) throws UnsupportedEncodingException { |
||||||
|
if (StringUtils.isEmpty(key)) return Result.fail("参数错误"); |
||||||
|
SysUser user = Util.getUser(session); |
||||||
|
assert user != null; |
||||||
|
return userService.updateAvatar(user, URLDecoder.decode(key, "utf-8"), session); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("validate") |
||||||
|
public Result validate(@RequestParam String pwd) { |
||||||
|
SysUser current = Util.getUser(session); |
||||||
|
if (!pwd.equals(current.getPwd())) return Result.fail("校验失败"); |
||||||
|
return Result.success("校验通过"); |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUserCreateParam(SysUser user) { |
||||||
|
if (user.getId() != null) return "创建失败,参数错误"; |
||||||
|
if (StringUtils.isEmpty(user.getName())) return "创建失败,用户名称不能为空"; |
||||||
|
if (user.getRole() == null) return "创建失败,用户角色不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUserUpdateParam(SysUser user) { |
||||||
|
if (user.getId() == null) return "修改失败,参数错误"; |
||||||
|
if (StringUtils.isEmpty(user.getName())) return "修改失败,用户名称不能为空"; |
||||||
|
if (user.getRole() == null) return "修改失败,用户角色不能为空"; |
||||||
|
if (user.getStatus() == null) return "修改失败,用户状态不能为空"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
private String validateUpdatePwdParam(UserUpdatePwd vo) { |
||||||
|
if (vo.getId() == null) return "修改失败,参数错误"; |
||||||
|
if (StringUtils.isEmpty(vo.getOld_pwd())) return "修改失败,原密码不能为空"; |
||||||
|
if (StringUtils.isEmpty(vo.getNew_pwd())) return "修改失败,新密码不能为空"; |
||||||
|
if (vo.getOld_pwd().equals(vo.getNew_pwd())) return "修改失败,新密码不得与旧密码相同"; |
||||||
|
if (vo.getNew_pwd().length() < 6 || vo.getNew_pwd().length() > 32) return "修改失败,密码长度为6-32位"; |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,48 @@ |
|||||||
|
package com.toesbieya.my.controller; |
||||||
|
|
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.util.LinkedHashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping("test") |
||||||
|
@CrossOrigin |
||||||
|
@Slf4j |
||||||
|
public class TestController { |
||||||
|
|
||||||
|
@GetMapping("pressure/1") |
||||||
|
@ResponseBody |
||||||
|
public void pressure1() { |
||||||
|
Map<String, String> map = new LinkedHashMap<>(); |
||||||
|
map = null; |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("pressure/2") |
||||||
|
@ResponseBody |
||||||
|
public void pressure2() { |
||||||
|
Map<String, String> map = new LinkedHashMap<>(); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("test") |
||||||
|
@ResponseBody |
||||||
|
public Result test() { |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("upload") |
||||||
|
@ResponseBody |
||||||
|
public Result upload(MultipartFile file, @RequestParam String extraParam1, @RequestParam String extraParam2) throws IOException { |
||||||
|
/*System.out.println("extraParam1:" + extraParam1); |
||||||
|
System.out.println("extraParam2:" + extraParam2); |
||||||
|
System.out.println("文件名称:" + file.getOriginalFilename()); |
||||||
|
String tempPath = "C:/static/" + file.getOriginalFilename(); |
||||||
|
file.transferTo(Paths.get(tempPath));*/ |
||||||
|
return Result.success("ok"); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.enumeration; |
||||||
|
|
||||||
|
public enum BizDocumentFinishEnum { |
||||||
|
TO_BE_STARTED(0), UNDERWAY(1), FINISHED(2); |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
BizDocumentFinishEnum(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.enumeration; |
||||||
|
|
||||||
|
public enum BizDocumentHistoryEnum { |
||||||
|
WITHDRAW(0), COMMIT(1), PASS(2), REJECT(3); |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
BizDocumentHistoryEnum(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.enumeration; |
||||||
|
|
||||||
|
public enum BizDocumentStatusEnum { |
||||||
|
DRAFT(0), WAIT_VERIFY(1), VERIFIED(2); |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
BizDocumentStatusEnum(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.enumeration; |
||||||
|
|
||||||
|
public enum GeneralStatusEnum { |
||||||
|
DISABLED(0), ENABLED(1); |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
GeneralStatusEnum(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.enumeration; |
||||||
|
|
||||||
|
public enum RecLoginHistoryEnum { |
||||||
|
LOGOUT(0), LOGIN(1); |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
RecLoginHistoryEnum(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.enumeration; |
||||||
|
|
||||||
|
public enum UserActionEnum { |
||||||
|
FAIL(0), SUCCESS(1); |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
UserActionEnum(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
package com.toesbieya.my.exception; |
||||||
|
|
||||||
|
public class JsonResultException extends RuntimeException { |
||||||
|
public JsonResultException(String message) { |
||||||
|
super(message); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
package com.toesbieya.my.handler; |
||||||
|
|
||||||
|
import com.toesbieya.my.enumeration.UserActionEnum; |
||||||
|
import com.toesbieya.my.exception.JsonResultException; |
||||||
|
import com.toesbieya.my.model.entity.RecUserAction; |
||||||
|
import com.toesbieya.my.service.RecService; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.ThreadUtil; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.util.StringUtils; |
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler; |
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice; |
||||||
|
import org.springframework.web.multipart.MaxUploadSizeExceededException; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestControllerAdvice |
||||||
|
public class GlobalExceptionHandler { |
||||||
|
@Resource |
||||||
|
private RecService recService; |
||||||
|
|
||||||
|
//抛出异常时希望返回给前台
|
||||||
|
@ExceptionHandler(JsonResultException.class) |
||||||
|
public Result handleJsonResultException(JsonResultException e) { |
||||||
|
recordUserAction(e); |
||||||
|
return Result.fail(e.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
//上传文件过大
|
||||||
|
@ExceptionHandler(MaxUploadSizeExceededException.class) |
||||||
|
public Result handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) { |
||||||
|
log.error("上传的文件超出限定大小,{}", e.getMessage()); |
||||||
|
recordUserAction(e); |
||||||
|
return Result.fail("上传的文件过大"); |
||||||
|
} |
||||||
|
|
||||||
|
//最终捕获
|
||||||
|
@ExceptionHandler(Exception.class) |
||||||
|
public Result handleException(Exception e) { |
||||||
|
log.error("服务运行异常", e); |
||||||
|
recordUserAction(e); |
||||||
|
return Result.fail("服务运行异常"); |
||||||
|
} |
||||||
|
|
||||||
|
private void recordUserAction(Exception e) { |
||||||
|
RecUserAction action = ThreadUtil.getAction(); |
||||||
|
if (action != null && !StringUtils.isEmpty(action.getAction())) { |
||||||
|
action.setError(Util.exception2Str(e)); |
||||||
|
recService.insertUserAction(action, UserActionEnum.FAIL); |
||||||
|
} |
||||||
|
ThreadUtil.clearAll(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
package com.toesbieya.my.interceptor; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.module.request.RequestModule; |
||||||
|
import com.toesbieya.my.utils.IpUtil; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.ThreadUtil; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.servlet.HandlerInterceptor; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
public class RateControlInterceptor implements HandlerInterceptor { |
||||||
|
@Override |
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
||||||
|
SysUser user = ThreadUtil.getUser(); |
||||||
|
if (user.getAdmin() == 1) return true; |
||||||
|
|
||||||
|
String url = request.getServletPath(); |
||||||
|
String ip = IpUtil.getIp(request); |
||||||
|
int result = RequestModule.pass(url, ip); |
||||||
|
switch (result) { |
||||||
|
case -1: |
||||||
|
log.warn("限流拦截,服务的总请求频率超出,url:{},用户:{},ip:{}", url, user.getName(), ip); |
||||||
|
Util.responseJson(response, Result.overload()); |
||||||
|
break; |
||||||
|
case 0: |
||||||
|
log.warn("限流拦截,ip已被暂时拉黑,url:{},用户:{},ip:{}", url, user.getName(), ip); |
||||||
|
Util.responseJson(response, Result.tooManyRequest()); |
||||||
|
break; |
||||||
|
case -2: |
||||||
|
log.warn("限流拦截,ip的请求频率超出,url:{},用户:{},ip:{}", url, user.getName(), ip); |
||||||
|
Util.responseJson(response, Result.tooManyRequest()); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
return true; |
||||||
|
} |
||||||
|
ThreadUtil.clearUser(); |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,66 @@ |
|||||||
|
package com.toesbieya.my.interceptor; |
||||||
|
|
||||||
|
import com.toesbieya.my.constant.SessionConstant; |
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.module.PermissionModule; |
||||||
|
import com.toesbieya.my.module.request.RequestModule; |
||||||
|
import com.toesbieya.my.utils.IpUtil; |
||||||
|
import com.toesbieya.my.utils.Result; |
||||||
|
import com.toesbieya.my.utils.ThreadUtil; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.servlet.HandlerInterceptor; |
||||||
|
import org.springframework.web.servlet.ModelAndView; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
import javax.servlet.http.HttpSession; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
public class SecurityInterceptor implements HandlerInterceptor { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
||||||
|
HttpSession session = request.getSession(); |
||||||
|
String url = request.getServletPath(); |
||||||
|
String method = request.getMethod(); |
||||||
|
String ip = IpUtil.getIp(request); |
||||||
|
|
||||||
|
if (!RequestModule.urlExistMapping(url, method)) { |
||||||
|
Util.responseJson(response, Result.notfound()); |
||||||
|
log.error("请求地址不存在:{},{},IP:{}", url, method, ip); |
||||||
|
ThreadUtil.clearUser(); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
SysUser sysUser = Util.getUser(session); |
||||||
|
if (sysUser == null |
||||||
|
|| request.getHeader(SessionConstant.TOKEN_KEY) == null |
||||||
|
|| !request.getHeader(SessionConstant.TOKEN_KEY).equals(session.getAttribute(SessionConstant.TOKEN_KEY))) { |
||||||
|
Util.responseJson(response, Result.requireLogin()); |
||||||
|
ThreadUtil.clearUser(); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
if (!PermissionModule.authority(sysUser, url)) { |
||||||
|
Util.responseJson(response, Result.noPermission()); |
||||||
|
log.warn("权限拦截,访问路径:{},用户:{},IP:{}", url, sysUser.getName(), ip); |
||||||
|
ThreadUtil.clearUser(); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
ThreadUtil.setUser(sysUser); |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.interceptor; |
||||||
|
|
||||||
|
import com.toesbieya.my.utils.ThreadUtil; |
||||||
|
import org.springframework.web.servlet.HandlerInterceptor; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
public class UserActionInterceptor implements HandlerInterceptor { |
||||||
|
@Override |
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
||||||
|
ThreadUtil.quicklySetAction(request); |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
package com.toesbieya.my.listener; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.module.SocketModule; |
||||||
|
import com.toesbieya.my.utils.Util; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpSessionEvent; |
||||||
|
import javax.servlet.http.HttpSessionListener; |
||||||
|
|
||||||
|
public class RedisSessionListener implements HttpSessionListener { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void sessionCreated(HttpSessionEvent se) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void sessionDestroyed(HttpSessionEvent se) { |
||||||
|
SysUser sysUser = Util.getUser(se.getSession()); |
||||||
|
if (sysUser != null) { |
||||||
|
SocketModule.logout(sysUser.getId(), "登陆状态过期,请重新登陆"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.BizDocumentHistory; |
||||||
|
import com.toesbieya.my.model.vo.search.DocumentHistorySearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface BizDocumentHistoryMapper { |
||||||
|
List<BizDocumentHistory> getByPid(@Param("pid") String pid); |
||||||
|
|
||||||
|
List<BizDocumentHistory> search(DocumentHistorySearch vo); |
||||||
|
|
||||||
|
int add(BizDocumentHistory history); |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseInbound; |
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseInboundSub; |
||||||
|
import com.toesbieya.my.model.vo.export.PurchaseInboundExport; |
||||||
|
import com.toesbieya.my.model.vo.search.PurchaseInboundSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface BizPurchaseInboundMapper { |
||||||
|
BizPurchaseInbound getById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizPurchaseInboundSub> getSubById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizPurchaseInbound> search(PurchaseInboundSearch vo); |
||||||
|
|
||||||
|
List<PurchaseInboundExport> export(PurchaseInboundSearch vo); |
||||||
|
|
||||||
|
int add(BizPurchaseInbound param); |
||||||
|
|
||||||
|
void addSub(List<BizPurchaseInboundSub> list); |
||||||
|
|
||||||
|
int update(BizPurchaseInbound param); |
||||||
|
|
||||||
|
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||||
|
|
||||||
|
int reject(@Param("id") String id); |
||||||
|
|
||||||
|
int del(@Param("id") String id); |
||||||
|
|
||||||
|
void delSubByPid(@Param("pid") String pid); |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseOrder; |
||||||
|
import com.toesbieya.my.model.entity.BizPurchaseOrderSub; |
||||||
|
import com.toesbieya.my.model.entity.StatProfitGoods; |
||||||
|
import com.toesbieya.my.model.vo.export.PurchaseOrderExport; |
||||||
|
import com.toesbieya.my.model.vo.search.PurchaseOrderSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface BizPurchaseOrderMapper { |
||||||
|
BizPurchaseOrder getById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizPurchaseOrderSub> getSubById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizPurchaseOrder> search(PurchaseOrderSearch vo); |
||||||
|
|
||||||
|
List<PurchaseOrderExport> export(PurchaseOrderSearch vo); |
||||||
|
|
||||||
|
int add(BizPurchaseOrder param); |
||||||
|
|
||||||
|
void addSub(List<BizPurchaseOrderSub> list); |
||||||
|
|
||||||
|
int update(BizPurchaseOrder param); |
||||||
|
|
||||||
|
int updateSubRemainNum(@Param("id") Integer id, @Param("remain_num") double remain_num); |
||||||
|
|
||||||
|
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||||
|
|
||||||
|
int reject(@Param("id") String id); |
||||||
|
|
||||||
|
int del(@Param("id") String id); |
||||||
|
|
||||||
|
void delSubByPid(@Param("pid") String pid); |
||||||
|
|
||||||
|
int updateFinish(@Param("id") String id, @Param("finish") Integer finish, @Param("ftime") Long ftime); |
||||||
|
|
||||||
|
double getDailyTotalPurchasePrice(@Param("start") Long start, @Param("end") Long end); |
||||||
|
|
||||||
|
List<StatProfitGoods> getDailyProfitGoods(@Param("start") long start, @Param("end") long end); |
||||||
|
|
||||||
|
Integer getLastDayFinishOrderNum(); |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.BizSellOrder; |
||||||
|
import com.toesbieya.my.model.entity.BizSellOrderSub; |
||||||
|
import com.toesbieya.my.model.entity.StatProfitGoods; |
||||||
|
import com.toesbieya.my.model.vo.export.SellOrderExport; |
||||||
|
import com.toesbieya.my.model.vo.search.SellOrderSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface BizSellOrderMapper { |
||||||
|
BizSellOrder getById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizSellOrderSub> getSubById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizSellOrder> search(SellOrderSearch vo); |
||||||
|
|
||||||
|
List<SellOrderExport> export(SellOrderSearch vo); |
||||||
|
|
||||||
|
int add(BizSellOrder param); |
||||||
|
|
||||||
|
void addSub(List<BizSellOrderSub> list); |
||||||
|
|
||||||
|
int update(BizSellOrder param); |
||||||
|
|
||||||
|
int updateSubRemainNum(@Param("id") Integer id, @Param("remain_num") double remain_num); |
||||||
|
|
||||||
|
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||||
|
|
||||||
|
int reject(@Param("id") String id); |
||||||
|
|
||||||
|
int del(@Param("id") String id); |
||||||
|
|
||||||
|
void delSubByPid(@Param("pid") String pid); |
||||||
|
|
||||||
|
int updateFinish(@Param("id") String id, @Param("finish") Integer finish, @Param("ftime") Long ftime); |
||||||
|
|
||||||
|
double getDailyTotalPurchasePrice(@Param("start") Long start, @Param("end") Long end); |
||||||
|
|
||||||
|
List<StatProfitGoods> getDailyProfitGoods(@Param("start") long start, @Param("end") long end); |
||||||
|
|
||||||
|
Integer getLastDayFinishOrderNum(); |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.BizSellOutbound; |
||||||
|
import com.toesbieya.my.model.entity.BizSellOutboundSub; |
||||||
|
import com.toesbieya.my.model.vo.export.SellOutboundExport; |
||||||
|
import com.toesbieya.my.model.vo.search.SellOutboundSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface BizSellOutboundMapper { |
||||||
|
BizSellOutbound getById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizSellOutboundSub> getSubById(@Param("id") String id); |
||||||
|
|
||||||
|
List<BizSellOutbound> search(SellOutboundSearch vo); |
||||||
|
|
||||||
|
List<SellOutboundExport> export(SellOutboundSearch vo); |
||||||
|
|
||||||
|
int add(BizSellOutbound param); |
||||||
|
|
||||||
|
void addSub(List<BizSellOutboundSub> list); |
||||||
|
|
||||||
|
int update(BizSellOutbound param); |
||||||
|
|
||||||
|
int pass(@Param("id") String id, @Param("vid") Integer vid, @Param("vname") String vname, @Param("vtime") long vtime); |
||||||
|
|
||||||
|
int reject(@Param("id") String id); |
||||||
|
|
||||||
|
int del(@Param("id") String id); |
||||||
|
|
||||||
|
void delSubByPid(@Param("pid") String pid); |
||||||
|
} |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.BizStock; |
||||||
|
import com.toesbieya.my.model.vo.export.StockExport; |
||||||
|
import com.toesbieya.my.model.vo.result.StockSearchResult; |
||||||
|
import com.toesbieya.my.model.vo.search.StockSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface BizStockMapper { |
||||||
|
List<StockSearchResult> search(StockSearch vo); |
||||||
|
|
||||||
|
List<BizStock> getDetail(@Param("cid") String cid); |
||||||
|
|
||||||
|
List<BizStock> getDetailById(@Param("ids") String ids); |
||||||
|
|
||||||
|
List<StockExport> export(StockSearch vo); |
||||||
|
|
||||||
|
int deleteByPrimaryKey(Integer id); |
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(BizStock record); |
||||||
|
|
||||||
|
int updateByPrimaryKey(BizStock record); |
||||||
|
|
||||||
|
int updateBatchSelective(List<BizStock> list); |
||||||
|
|
||||||
|
int batchInsert(@Param("list") List<BizStock> list); |
||||||
|
|
||||||
|
int outbound(@Param("id") Integer id, @Param("num") Double num); |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.RecAttachment; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface RecAttachmentMapper { |
||||||
|
List<RecAttachment> getByPid(@Param("pid") String pid); |
||||||
|
|
||||||
|
List<String> getUrlByPid(@Param("pid") String pid); |
||||||
|
|
||||||
|
int add(List<RecAttachment> list); |
||||||
|
|
||||||
|
int del(RecAttachment attachment); |
||||||
|
|
||||||
|
int delByPid(@Param("pid") String pid); |
||||||
|
|
||||||
|
int delByUrls(List<String> list); |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.RecLoginHistory; |
||||||
|
import com.toesbieya.my.model.vo.search.LoginHistorySearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface RecLoginHistoryMapper { |
||||||
|
int insert(RecLoginHistory history); |
||||||
|
|
||||||
|
List<RecLoginHistory> search(LoginHistorySearch vo); |
||||||
|
|
||||||
|
List<RecLoginHistory> getByUid(@Param("uid") Integer uid); |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.RecUserAction; |
||||||
|
import com.toesbieya.my.model.vo.search.UserActionSearch; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface RecUserActionMapper { |
||||||
|
void insert(RecUserAction action); |
||||||
|
|
||||||
|
List<RecUserAction> search(UserActionSearch vo); |
||||||
|
} |
||||||
@ -0,0 +1,28 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.StatFinishOrder; |
||||||
|
import com.toesbieya.my.model.entity.StatProfitGoods; |
||||||
|
import com.toesbieya.my.model.entity.StatProfitTotal; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface StatisticMapper { |
||||||
|
List<StatProfitTotal> searchTotalProfit(@Param("start") Long start, @Param("end") Long end); |
||||||
|
|
||||||
|
List<StatProfitGoods> searchGoodsProfit(@Param("start") Long start, @Param("end") Long end); |
||||||
|
|
||||||
|
List<StatFinishOrder> searchFinishOrder(@Param("start") Long start, @Param("end") Long end); |
||||||
|
|
||||||
|
List<StatProfitGoods> getHistoryTotalProfitGoods(); |
||||||
|
|
||||||
|
boolean checkDailyFinishOrderExist(@Param("time") long time); |
||||||
|
|
||||||
|
int insertFinishOrder(StatFinishOrder param); |
||||||
|
|
||||||
|
boolean checkDailyProfitExist(@Param("time") long time); |
||||||
|
|
||||||
|
int insertProfitTotal(StatProfitTotal param); |
||||||
|
|
||||||
|
int insertProfitGoodsBatch(@Param("list") List<StatProfitGoods> list); |
||||||
|
} |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysCategory; |
||||||
|
import com.toesbieya.my.model.vo.search.CategorySearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysCategoryMapper { |
||||||
|
List<SysCategory> getAll(); |
||||||
|
|
||||||
|
List<SysCategory> search(CategorySearch vo); |
||||||
|
|
||||||
|
SysCategory getById(@Param("id") int id); |
||||||
|
|
||||||
|
int add(SysCategory sysCategory); |
||||||
|
|
||||||
|
int update(SysCategory sysCategory); |
||||||
|
|
||||||
|
int del(@Param("id") int id); |
||||||
|
|
||||||
|
boolean hasChildren(@Param("id") int id); |
||||||
|
|
||||||
|
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||||
|
|
||||||
|
boolean checkIsUse(@Param("cid") Integer cid); |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysCustomer; |
||||||
|
import com.toesbieya.my.model.vo.result.RegionValueResult; |
||||||
|
import com.toesbieya.my.model.vo.search.CustomerSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysCustomerMapper { |
||||||
|
List<SysCustomer> get(); |
||||||
|
|
||||||
|
SysCustomer getById(int id); |
||||||
|
|
||||||
|
List<SysCustomer> search(CustomerSearch vo); |
||||||
|
|
||||||
|
int add(SysCustomer category); |
||||||
|
|
||||||
|
int update(SysCustomer category); |
||||||
|
|
||||||
|
int del(int id); |
||||||
|
|
||||||
|
List<RegionValueResult> getLimitRegion(); |
||||||
|
|
||||||
|
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysDepartment; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysDepartmentMapper { |
||||||
|
List<SysDepartment> get(); |
||||||
|
|
||||||
|
List<SysDepartment> getAll(); |
||||||
|
|
||||||
|
int add(SysDepartment department); |
||||||
|
|
||||||
|
int update(SysDepartment department); |
||||||
|
|
||||||
|
int del(@Param("id") int id); |
||||||
|
|
||||||
|
boolean nameExist(@Param("id") Integer id, @Param("pid") int pid, @Param("name") String name); |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysResource; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysResourceMapper { |
||||||
|
List<SysResource> get(); |
||||||
|
|
||||||
|
List<SysResource> getAll(); |
||||||
|
|
||||||
|
List<SysResource> getByRole(int role); |
||||||
|
|
||||||
|
int update(SysResource resource); |
||||||
|
} |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysRole; |
||||||
|
import com.toesbieya.my.model.vo.search.RoleSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysRoleMapper { |
||||||
|
List<SysRole> get(); |
||||||
|
|
||||||
|
List<SysRole> getAll(); |
||||||
|
|
||||||
|
List<SysRole> search(RoleSearch vo); |
||||||
|
|
||||||
|
int add(SysRole role); |
||||||
|
|
||||||
|
int update(SysRole role); |
||||||
|
|
||||||
|
int del(int id); |
||||||
|
|
||||||
|
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysSupplier; |
||||||
|
import com.toesbieya.my.model.vo.result.RegionValueResult; |
||||||
|
import com.toesbieya.my.model.vo.search.SupplierSearch; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysSupplierMapper { |
||||||
|
List<SysSupplier> get(); |
||||||
|
|
||||||
|
SysSupplier getById(int id); |
||||||
|
|
||||||
|
List<SysSupplier> search(SupplierSearch vo); |
||||||
|
|
||||||
|
int add(SysSupplier category); |
||||||
|
|
||||||
|
int update(SysSupplier category); |
||||||
|
|
||||||
|
int del(int id); |
||||||
|
|
||||||
|
List<RegionValueResult> getLimitRegion(); |
||||||
|
|
||||||
|
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||||
|
} |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
package com.toesbieya.my.mapper; |
||||||
|
|
||||||
|
import com.toesbieya.my.model.entity.SysUser; |
||||||
|
import com.toesbieya.my.model.vo.search.UserSearch; |
||||||
|
import com.toesbieya.my.model.vo.update.UserUpdatePwd; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public interface SysUserMapper { |
||||||
|
SysUser getById(@Param("id") Integer id); |
||||||
|
|
||||||
|
SysUser getByNameAndPwd(@Param("name") String name, @Param("pwd") String pwd); |
||||||
|
|
||||||
|
List<SysUser> search(UserSearch vo); |
||||||
|
|
||||||
|
boolean isNameExist(@Param("name") String name, @Param("id") Integer id); |
||||||
|
|
||||||
|
int add(SysUser user); |
||||||
|
|
||||||
|
int update(SysUser user); |
||||||
|
|
||||||
|
int del(@Param("id") Integer id); |
||||||
|
|
||||||
|
int resetPwd(@Param("id") Integer id, @Param("pwd") String pwd); |
||||||
|
|
||||||
|
int updatePwd(UserUpdatePwd vo); |
||||||
|
|
||||||
|
int updateAvatar(@Param("id") Integer id, @Param("avatar") String avatar); |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class BizDocument<T> { |
||||||
|
private String id; |
||||||
|
private Integer cid; |
||||||
|
private String cname; |
||||||
|
private Long ctime; |
||||||
|
private Integer vid; |
||||||
|
private String vname; |
||||||
|
private Long vtime; |
||||||
|
private Integer status; |
||||||
|
private String remark; |
||||||
|
private List<T> data; |
||||||
|
private List<RecAttachment> imageList; |
||||||
|
private List<RecAttachment> uploadImageList; |
||||||
|
private List<String> deleteImageList; |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class BizDocumentHistory { |
||||||
|
private Integer id; |
||||||
|
private String pid; |
||||||
|
private Integer type; |
||||||
|
private Integer uid; |
||||||
|
private String uname; |
||||||
|
private Integer status_before; |
||||||
|
private Integer status_after; |
||||||
|
private Long time; |
||||||
|
private String info; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class BizDocumentSub { |
||||||
|
private Integer id; |
||||||
|
private String pid; |
||||||
|
private Integer cid; |
||||||
|
private String cname; |
||||||
|
private Double num; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizPurchaseInbound extends BizDocument<BizPurchaseInboundSub> { |
||||||
|
private String pid; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizPurchaseInboundSub extends BizDocumentSub { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizPurchaseOrder extends BizDocument<BizPurchaseOrderSub>{ |
||||||
|
private Integer sid; |
||||||
|
private String sname; |
||||||
|
private Integer finish; |
||||||
|
private Long ftime; |
||||||
|
private Double total; |
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizPurchaseOrderSub extends BizDocumentSub { |
||||||
|
private Double price; |
||||||
|
private Double remain_num; |
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizSellOrder extends BizDocument<BizSellOrderSub>{ |
||||||
|
private Integer customer_id; |
||||||
|
private String customer_name; |
||||||
|
private Integer finish; |
||||||
|
private Long ftime; |
||||||
|
private Double total; |
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizSellOrderSub extends BizDocumentSub{ |
||||||
|
private Double price; |
||||||
|
private Double remain_num; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizSellOutbound extends BizDocument<BizSellOutboundSub>{ |
||||||
|
private String pid; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class BizSellOutboundSub extends BizDocumentSub{ |
||||||
|
private Integer sid; |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class BizStock { |
||||||
|
private Integer id; |
||||||
|
private Integer cid; |
||||||
|
private String cname; |
||||||
|
private Double num; |
||||||
|
private Double price; |
||||||
|
private Long ctime; |
||||||
|
private String cgrkid; |
||||||
|
private String cgddid; |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
public class RecAttachment { |
||||||
|
private Integer id; |
||||||
|
private String pid; |
||||||
|
private String name; |
||||||
|
private Long time; |
||||||
|
private Integer order; |
||||||
|
private String url; |
||||||
|
private Long size; |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class RecLoginHistory { |
||||||
|
private Long id; |
||||||
|
private Integer uid; |
||||||
|
private String uname; |
||||||
|
private String ip; |
||||||
|
private String address; |
||||||
|
private Integer type; |
||||||
|
private Long time; |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class RecUserAction { |
||||||
|
private Long id; |
||||||
|
private Integer uid; |
||||||
|
private String uname; |
||||||
|
private String url; |
||||||
|
private String ip; |
||||||
|
private Long time; |
||||||
|
private String action; |
||||||
|
private String error; |
||||||
|
private Integer type; |
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class StatFinishOrder { |
||||||
|
private Integer id; |
||||||
|
private Integer purchase; |
||||||
|
private Integer sell; |
||||||
|
private Long time; |
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import lombok.ToString; |
||||||
|
|
||||||
|
@Data |
||||||
|
@ToString(callSuper = true) |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StatProfitGoods extends StatProfitTotal { |
||||||
|
private Integer cid; |
||||||
|
private String cname; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class StatProfitTotal { |
||||||
|
private Integer id; |
||||||
|
private Double purchase; |
||||||
|
private Double sell; |
||||||
|
private Double profit; |
||||||
|
private Long time; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SysCategory { |
||||||
|
private Integer id; |
||||||
|
private Integer pid; |
||||||
|
private String name; |
||||||
|
private Integer type; |
||||||
|
private Long ctime; |
||||||
|
} |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class SysCustomer { |
||||||
|
private Integer id; |
||||||
|
private String name; |
||||||
|
private String address; |
||||||
|
private String linkman; |
||||||
|
private String linkphone; |
||||||
|
private String region; |
||||||
|
private String region_name; |
||||||
|
private Integer status; |
||||||
|
private Long ctime; |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SysDepartment { |
||||||
|
private Integer id; |
||||||
|
private Integer pid; |
||||||
|
private String name; |
||||||
|
private Integer status; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SysRegion { |
||||||
|
private String id; |
||||||
|
private String pid; |
||||||
|
private String name; |
||||||
|
private String fullname; |
||||||
|
private int level; |
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class SysResource { |
||||||
|
private Integer id; |
||||||
|
private Integer pid; |
||||||
|
private String name; |
||||||
|
private String fullName; |
||||||
|
private String url; |
||||||
|
private Integer admin; |
||||||
|
private Integer total_rate; |
||||||
|
private Integer ip_rate; |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class SysRole { |
||||||
|
private Integer id; |
||||||
|
private String name; |
||||||
|
private String resource_id; |
||||||
|
private Integer cid; |
||||||
|
private String cname; |
||||||
|
private Long ctime; |
||||||
|
private Integer status; |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SysSupplier { |
||||||
|
private Integer id; |
||||||
|
private String name; |
||||||
|
private String address; |
||||||
|
private String linkman; |
||||||
|
private String linkphone; |
||||||
|
private String region; |
||||||
|
private String region_name; |
||||||
|
private Integer status; |
||||||
|
private Long ctime; |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
package com.toesbieya.my.model.entity; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.HashSet; |
||||||
|
|
||||||
|
@Data |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class SysUser implements Serializable { |
||||||
|
private static final long serialVersionUID = 9527L; |
||||||
|
private Integer id; |
||||||
|
private String name; |
||||||
|
private String pwd; |
||||||
|
private Integer role; |
||||||
|
private String role_name; |
||||||
|
private String avatar; |
||||||
|
private Long ctime; |
||||||
|
private Integer admin; |
||||||
|
private Integer status; |
||||||
|
private Boolean online; |
||||||
|
private HashSet<Integer> resource_ids; |
||||||
|
|
||||||
|
public static String getUpdateInfo(SysUser origin, SysUser update) { |
||||||
|
StringBuilder stringBuilder = new StringBuilder(); |
||||||
|
if (!origin.getName().equals(update.getName())) { |
||||||
|
stringBuilder.append(String.format(",名称改为【%s】", update.getName())); |
||||||
|
} |
||||||
|
if (!origin.getRole().equals(update.getRole())) { |
||||||
|
stringBuilder.append(String.format(",角色改为【%s】", update.getRole_name())); |
||||||
|
} |
||||||
|
if (!origin.getStatus().equals(update.getStatus())) { |
||||||
|
stringBuilder.append(String.format(",状态改为【%s】", update.getStatus() == 1 ? "正常" : "禁用")); |
||||||
|
} |
||||||
|
return stringBuilder.toString(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.toesbieya.my.model.vo; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class IpResultVo { |
||||||
|
private Integer code; |
||||||
|
private JSONObject data; |
||||||
|
} |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
package com.toesbieya.my.model.vo.export; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class PurchaseInboundExport{ |
||||||
|
@ExcelProperty(value="单号",index=0) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String id; |
||||||
|
|
||||||
|
@ExcelProperty(value="采购订单单号",index=1) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String pid; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建人",index=2) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cname; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建时间",index=3) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ctime; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核人",index=4) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vname; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核时间",index=5) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vtime; |
||||||
|
|
||||||
|
@ExcelProperty(value="状态",index=6) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String status; |
||||||
|
|
||||||
|
@ExcelProperty(value="备注",index=7) |
||||||
|
@ColumnWidth(50) |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
package com.toesbieya.my.model.vo.export; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class PurchaseOrderExport{ |
||||||
|
@ExcelProperty(value="单号",index=0) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String id; |
||||||
|
|
||||||
|
@ExcelProperty(value="供应商",index=1) |
||||||
|
@ColumnWidth(30) |
||||||
|
private String sname; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建人",index=2) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cname; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建时间",index=3) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ctime; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核人",index=4) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vname; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核时间",index=5) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vtime; |
||||||
|
|
||||||
|
@ExcelProperty(value="状态",index=6) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String status; |
||||||
|
|
||||||
|
@ExcelProperty(value="完成情况",index=7) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String finish; |
||||||
|
|
||||||
|
@ExcelProperty(value="完成时间",index=8) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ftime; |
||||||
|
|
||||||
|
@ExcelProperty(value="总额",index=9) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String total; |
||||||
|
|
||||||
|
@ExcelProperty(value="备注",index=10) |
||||||
|
@ColumnWidth(50) |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
package com.toesbieya.my.model.vo.export; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SellOrderExport{ |
||||||
|
@ExcelProperty(value="单号",index=0) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String id; |
||||||
|
|
||||||
|
@ExcelProperty(value="客户",index=1) |
||||||
|
@ColumnWidth(30) |
||||||
|
private String customer_name; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建人",index=2) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cname; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建时间",index=3) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ctime; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核人",index=4) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vname; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核时间",index=5) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vtime; |
||||||
|
|
||||||
|
@ExcelProperty(value="状态",index=6) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String status; |
||||||
|
|
||||||
|
@ExcelProperty(value="完成情况",index=7) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String finish; |
||||||
|
|
||||||
|
@ExcelProperty(value="完成时间",index=8) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ftime; |
||||||
|
|
||||||
|
@ExcelProperty(value="总额",index=9) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String total; |
||||||
|
|
||||||
|
@ExcelProperty(value="备注",index=10) |
||||||
|
@ColumnWidth(50) |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,40 @@ |
|||||||
|
package com.toesbieya.my.model.vo.export; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class SellOutboundExport{ |
||||||
|
@ExcelProperty(value="单号",index=0) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String id; |
||||||
|
|
||||||
|
@ExcelProperty(value="销售订单单号",index=1) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String pid; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建人",index=2) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cname; |
||||||
|
|
||||||
|
@ExcelProperty(value="创建时间",index=3) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ctime; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核人",index=4) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vname; |
||||||
|
|
||||||
|
@ExcelProperty(value="审核时间",index=5) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String vtime; |
||||||
|
|
||||||
|
@ExcelProperty(value="状态",index=6) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String status; |
||||||
|
|
||||||
|
@ExcelProperty(value="备注",index=7) |
||||||
|
@ColumnWidth(50) |
||||||
|
private String remark; |
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
package com.toesbieya.my.model.vo.export; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore; |
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class StockExport { |
||||||
|
@ExcelIgnore |
||||||
|
private int cid; |
||||||
|
|
||||||
|
@ExcelProperty(value = "序号", index = 0) |
||||||
|
@ColumnWidth(20) |
||||||
|
private int id; |
||||||
|
|
||||||
|
@ExcelProperty(value = "分类名称", index = 1) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cname; |
||||||
|
|
||||||
|
@ExcelProperty(value = "库存总数", index = 2) |
||||||
|
@ColumnWidth(20) |
||||||
|
private double total_num; |
||||||
|
|
||||||
|
@ExcelProperty(value = "库存总值", index = 3) |
||||||
|
@ColumnWidth(20) |
||||||
|
private double total_price; |
||||||
|
|
||||||
|
@ExcelProperty(value = "采购订单号", index = 4) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cgddid; |
||||||
|
|
||||||
|
@ExcelProperty(value = "采购单价", index = 5) |
||||||
|
@ColumnWidth(20) |
||||||
|
private double cg_price; |
||||||
|
|
||||||
|
@ExcelProperty(value = "采购数量", index = 6) |
||||||
|
@ColumnWidth(20) |
||||||
|
private double cg_num; |
||||||
|
|
||||||
|
@ExcelProperty(value = "采购入库单号", index = 7) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String cgrkid; |
||||||
|
|
||||||
|
@ExcelProperty(value = "入库时间", index = 8) |
||||||
|
@ColumnWidth(20) |
||||||
|
private String ctime; |
||||||
|
|
||||||
|
@ExcelProperty(value = "入库数量", index = 9) |
||||||
|
@ColumnWidth(20) |
||||||
|
private double rk_num; |
||||||
|
} |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
package com.toesbieya.my.model.vo.info; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
import oshi.hardware.CentralProcessor; |
||||||
|
|
||||||
|
@Data |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class CpuInfo { |
||||||
|
//cpu名称
|
||||||
|
private String name; |
||||||
|
//核心数
|
||||||
|
private int core; |
||||||
|
//内核态CPU时间
|
||||||
|
private double system; |
||||||
|
//用户态CPU时间
|
||||||
|
private double user; |
||||||
|
//低优先级用户态CPU时间
|
||||||
|
private double nice; |
||||||
|
//空闲时间,不包括io等待时间
|
||||||
|
private double idle; |
||||||
|
//等待I/O的CPU时间
|
||||||
|
private double ioWait; |
||||||
|
//处理硬中断的CPU时间
|
||||||
|
private double irq; |
||||||
|
//处理软中断的CPU时间
|
||||||
|
private double softIrq; |
||||||
|
//运行在虚拟机中的时候,被其他虚拟机占用的CPU时间
|
||||||
|
private double steal; |
||||||
|
|
||||||
|
public CpuInfo(CentralProcessor processor, long[] prevTicks, long[] ticks) { |
||||||
|
this.name = processor.getProcessorIdentifier().getName().trim(); |
||||||
|
this.core = processor.getLogicalProcessorCount(); |
||||||
|
long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()]; |
||||||
|
long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()]; |
||||||
|
long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()]; |
||||||
|
long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()]; |
||||||
|
long system = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()]; |
||||||
|
long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()]; |
||||||
|
long ioWait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()]; |
||||||
|
long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()]; |
||||||
|
long total = user + nice + system + idle + ioWait + irq + softIrq + steal; |
||||||
|
this.system = system * 1.0 / total * 100; |
||||||
|
this.nice = nice * 1.0 / total * 100; |
||||||
|
this.user = user * 1.0 / total * 100; |
||||||
|
this.idle = idle * 1.0 / total * 100; |
||||||
|
this.ioWait = ioWait * 1.0 / total * 100; |
||||||
|
this.irq = irq * 1.0 / total * 100; |
||||||
|
this.softIrq = softIrq * 1.0 / total * 100; |
||||||
|
this.steal = steal * 1.0 / total * 100; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package com.toesbieya.my.model.vo.info; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
import oshi.software.os.OSFileStore; |
||||||
|
|
||||||
|
@Data |
||||||
|
@AllArgsConstructor |
||||||
|
@NoArgsConstructor |
||||||
|
public class DiskInfo { |
||||||
|
private String name; |
||||||
|
private long total; |
||||||
|
private long used; |
||||||
|
private long remain; |
||||||
|
private double utilizationRate; |
||||||
|
|
||||||
|
public DiskInfo(OSFileStore fs) { |
||||||
|
this.name = fs.getMount(); |
||||||
|
this.total = fs.getTotalSpace(); |
||||||
|
this.remain = fs.getUsableSpace(); |
||||||
|
this.used = this.total - this.remain; |
||||||
|
this.utilizationRate = this.used * 1.0 / this.total * 100; |
||||||
|
} |
||||||
|
} |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue