master
parent
f57d2b5b0d
commit
f2af977ea8
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,31 +0,0 @@
|
||||
HELP.md
|
||||
**/target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**
|
||||
!**/src/test/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
@ -1,5 +0,0 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
###
|
@ -1,99 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.arm.equipment.system</groupId>
|
||||
<artifactId>arm-equipment-system-parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>admin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>admin</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.arm.equipment.system</groupId>
|
||||
<artifactId>data</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>arm-equipment-system-parent-${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,39 +0,0 @@
|
||||
package com.arm.equipment.system.admin.app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.util.IntrospectorCleanupListener;
|
||||
|
||||
/**
|
||||
* 工程启动配置
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@ComponentScan("com.arm.equipment.system")
|
||||
@EnableTransactionManagement
|
||||
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 86400)
|
||||
@EnableAsync
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
public class AdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletListenerRegistrationBean introspectorCleanupListener() {
|
||||
ServletListenerRegistrationBean listenerRegistration = new ServletListenerRegistrationBean();
|
||||
listenerRegistration.setListener(new IntrospectorCleanupListener());
|
||||
return listenerRegistration;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package com.arm.equipment.system.admin.app;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* CORS配置
|
||||
*/
|
||||
@Configuration
|
||||
public class AdminCorsConfiguration {
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
// 添加CORS配置信息
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 放行哪些原始域
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 是否发送Cookie信息
|
||||
config.setAllowCredentials(true);
|
||||
// 放行哪些原始域(请求方式)
|
||||
config.addAllowedMethod("*");
|
||||
// 放行哪些原始域(头部信息)
|
||||
config.addAllowedHeader("*");
|
||||
// 暴露哪些头部信息(因为跨域访问默认不能获取全部头部信息)
|
||||
// config.addExposedHeader("*");
|
||||
|
||||
//2.添加映射路径
|
||||
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
|
||||
configSource.registerCorsConfiguration("/**", config);
|
||||
|
||||
//3.返回新的CorsFilter.
|
||||
return new CorsFilter(configSource);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.arm.equipment.system.admin.app;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
|
||||
@Configuration
|
||||
public class RedisListenerConfiguration {
|
||||
|
||||
@Bean
|
||||
RedisMessageListenerContainer redisMessageListenerContainer(RedisConnectionFactory lettuceConnectionFactory) {
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(lettuceConnectionFactory);
|
||||
return container;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.arm.equipment.system.admin.app;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* 定时任务配置
|
||||
* @author admin
|
||||
*/
|
||||
@Configuration
|
||||
public class SchedulerConfiguration implements SchedulingConfigurer {
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
taskRegistrar.setScheduler(taskExecutor());
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建线程池
|
||||
* @return
|
||||
*/
|
||||
public ScheduledExecutorService taskExecutor() {
|
||||
return Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 接口的基础类
|
||||
* @author admin
|
||||
*/
|
||||
public abstract class BaseController{
|
||||
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.arm.equipment.system.data.exception.AuthException;
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.ReturnCode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.QueryTimeoutException;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* 统一异常处理
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class ExceptionController {
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(ExceptionController.class);
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@ExceptionHandler(value = IllegalArgumentException.class)
|
||||
@ResponseBody
|
||||
public RespJSON illegalArgumentException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, "参数错误: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = MethodArgumentTypeMismatchException.class)
|
||||
@ResponseBody
|
||||
public RespJSON methodArgumentTypeMismatchException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
String field = ((MethodArgumentTypeMismatchException) e).getName();
|
||||
String rejectedValue = ((MethodArgumentTypeMismatchException) e).getValue().toString();
|
||||
String message = "参数:" + field + "注入的值不合法:" + rejectedValue;
|
||||
LOGGER.error("入参错误", e);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, message);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = BusinessException.class)
|
||||
@ResponseBody
|
||||
public RespJSON customException(HttpServletRequest req, BusinessException e) {
|
||||
//投票成功返自定义message
|
||||
if (e.getErrorCode() != null && StringUtils.isNotBlank(e.getMessage())) {
|
||||
return RespJSON.returnCustomCodeWithMessage(e.getErrorCode(), e.getMessage());
|
||||
}
|
||||
LOGGER.info("自定义异常: {}", e.getMessage());
|
||||
LOGGER.info("异常请求: {}", req.getRequestURI());
|
||||
LOGGER.info("异常参数: {}", JSON.toJSONString(req.getParameterMap()));
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = AuthException.class)
|
||||
@ResponseBody
|
||||
public RespJSON authException(HttpServletRequest req, AuthException e) {
|
||||
logErrDetail(req);
|
||||
if (e.getReturnCode() != null) {
|
||||
return RespJSON.returnCode(e.getReturnCode());
|
||||
} else {
|
||||
return RespJSON.returnCode(ReturnCode.CODE_OK, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = BindException.class)
|
||||
@ResponseBody
|
||||
public RespJSON bindException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
FieldError fieldError = ((BindException) e).getBindingResult().getFieldError();
|
||||
String field = fieldError.getField();
|
||||
Object rejectedValue = fieldError.getRejectedValue();
|
||||
String message = "参数:" + field + "注入的值不合法:" + rejectedValue;
|
||||
LOGGER.error("入参错误", e);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, message);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = ParseException.class)
|
||||
@ResponseBody
|
||||
public RespJSON parseException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
return RespJSON.returnCode(ReturnCode.PARSE_ERROR);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = QueryTimeoutException.class)
|
||||
@ResponseBody
|
||||
public RespJSON queryTimeoutException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
((LettuceConnectionFactory) redisTemplate.getConnectionFactory()).resetConnection();
|
||||
((LettuceConnectionFactory) redisTemplate.getConnectionFactory()).afterPropertiesSet();
|
||||
LOGGER.info("reset redis connection");
|
||||
return RespJSON.returnCode(ReturnCode.SYS_ERROR);
|
||||
}
|
||||
|
||||
// @ExceptionHandler(value = MethodNotSupportedException.class)
|
||||
// @ResponseBody
|
||||
// public RespJSON httpRequestMethodNotSupportedException(HttpServletRequest req, Exception e) {
|
||||
// logErrDetail(req);
|
||||
// return RespJSON.genJsonResultWithMsgData(ReturnCode.CUSTOM_MESSAGE, "请求方式不支持!");
|
||||
// }
|
||||
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseBody
|
||||
public RespJSON defaultErrorHandler(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return RespJSON.returnCode(ReturnCode.SYS_ERROR);
|
||||
}
|
||||
|
||||
|
||||
private void logErrDetail(HttpServletRequest req) {
|
||||
LOGGER.error("异常请求: " + req.getRequestURI());
|
||||
LOGGER.error("异常参数: " + JSON.toJSONString(req.getParameterMap()));
|
||||
LOGGER.error("异常UA: {}", req.getHeader("user-agent"));
|
||||
LOGGER.error("异常referer: {}", req.getHeader("referer"));
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.common;
|
||||
|
||||
import com.arm.equipment.system.data.service.common.IDictService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.dict.DictVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/dict")
|
||||
public class DictController {
|
||||
@Autowired
|
||||
private IDictService dictService;
|
||||
|
||||
/**
|
||||
* 统计枚举名称获得枚举的数据
|
||||
*
|
||||
* @param name 枚举名称, 枚举文件必须在com.arm.equipment.system.data.enums.dict包下
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getDictDataByName/{name}")
|
||||
public RespJSON getDictDataByName(@PathVariable String name) {
|
||||
List<DictVO> dictData = dictService.getDictData(name);
|
||||
return RespJSON.success(dictData);
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.file;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.data.enums.file.EnumUpload;
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
import com.arm.equipment.system.data.service.file.IFileService;
|
||||
import com.arm.equipment.system.data.util.StringUtils;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 公共文件上传接口
|
||||
*
|
||||
* @author: xly
|
||||
* @time: 2023/3/10 10:56
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/file/upload")
|
||||
public class UploadController extends BaseController {
|
||||
@Autowired
|
||||
private IFileService fileService;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public RespJSON upload(String uploadItem, @RequestParam("file") MultipartFile file) {
|
||||
if (null == file) {
|
||||
throw new BusinessException("文件不合法");
|
||||
}
|
||||
EnumUpload enumUploadItem = EnumUpload.RES_PHOTO_LIB;
|
||||
if (StringUtils.isNotBlank(uploadItem)) {
|
||||
enumUploadItem = EnumUpload.getEnum(uploadItem);
|
||||
}
|
||||
if (enumUploadItem == null) {
|
||||
throw new BusinessException("上传文件类目不正确");
|
||||
}
|
||||
try {
|
||||
return RespJSON.success(fileService.upload(file, enumUploadItem));
|
||||
} catch (Exception e) {
|
||||
logger.error("文件上传错误", e);
|
||||
throw new BusinessException("文件上传错误");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysBaseParam;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.service.system.ISysBaseParamService;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--基础参数
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2021年10月26日 16:36:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysBaseParam")
|
||||
public class SysBaseParamController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysBaseParamService sysBaseParamService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param sysBaseParamReq sysBaseParamReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody SysBaseParam sysBaseParamReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysBaseParamService.save(sysBaseParamReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param sysBaseParamReq sysBaseParamReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody SysBaseParam sysBaseParamReq) {
|
||||
int count = sysBaseParamService.getCount(sysBaseParamReq);
|
||||
List<SysBaseParam> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysBaseParamService.getPageList(sysBaseParamReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysBaseParamReq.getPageNo(), sysBaseParamReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(sysBaseParamService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/audit")
|
||||
@ResponseBody
|
||||
public RespJSON audit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
sysBaseParamService.audit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public RespJSON delete(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
sysBaseParamService.delete(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/unaudit")
|
||||
@ResponseBody
|
||||
public RespJSON unaudit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
sysBaseParamService.unaudit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code查value
|
||||
*
|
||||
* @param unicode
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectValueByUnicode")
|
||||
public RespJSON selectValueByUnicode(String unicode) {
|
||||
WJAssert.isMaxLength(unicode, 33, "参数非法");
|
||||
String value = sysBaseParamService.getOneByUniCode(unicode).getValue();
|
||||
return RespJSON.success(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code设置value
|
||||
*
|
||||
* @param sysBaseParamReq
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/setValueByUnicode")
|
||||
public RespJSON setValueByUnicode(@RequestBody SysBaseParam sysBaseParamReq) {
|
||||
WJAssert.notNull(sysBaseParamReq.getUniCode(), "参数非法");
|
||||
WJAssert.notNull(sysBaseParamReq.getValue(), "参数值非法");
|
||||
SysBaseParam sysBaseParamDB = sysBaseParamService.getOneByUniCode(sysBaseParamReq.getUniCode());
|
||||
sysBaseParamDB.setValue(sysBaseParamReq.getValue());
|
||||
return RespJSON.success(sysBaseParamService.updateSelectiveById(sysBaseParamDB));
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysLog;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.service.system.ISysLogService;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2022年09月16日 12:41:35
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysLog")
|
||||
public class SysLogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param sysLogReq sysLogReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody SysLog sysLogReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysLogService.save(sysLogReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param sysLogReq sysLogReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody SysLog sysLogReq) {
|
||||
int count = sysLogService.getCount(sysLogReq);
|
||||
List<SysLog> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysLogService.getPageList(sysLogReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysLogReq.getPageNo(), sysLogReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(sysLogService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/audit")
|
||||
@ResponseBody
|
||||
public RespJSON audit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
sysLogService.audit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/unaudit")
|
||||
@ResponseBody
|
||||
public RespJSON unaudit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
sysLogService.unaudit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.domain.system.SysResource;
|
||||
import com.arm.equipment.system.data.service.system.ISysResourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 系统--权限表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysResource")
|
||||
public class SysResourceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysResourceService sysResourceService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param sysResourceReq sysResourceReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody SysResource sysResourceReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
sysResourceService.save(sysResourceReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param sysResourceReq sysResourceReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody SysResource sysResourceReq) {
|
||||
int count = sysResourceService.getCount(sysResourceReq);
|
||||
List<SysResource> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysResourceService.getPageList(sysResourceReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysResourceReq.getPageNo(), sysResourceReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录树分页查询
|
||||
*
|
||||
* @param sysResourceReq sysResourceReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageTreeList")
|
||||
public RespJSON getPageTreeList(@RequestBody SysResource sysResourceReq) {
|
||||
int count = sysResourceService.getCount(sysResourceReq);
|
||||
List<SysResource> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysResourceService.getPageTreeList(sysResourceReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysResourceReq.getPageNo(), sysResourceReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(sysResourceService.getOneById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*获取资源树
|
||||
*
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getResourceTree")
|
||||
public RespJSON getResourceTree() {
|
||||
return RespJSON.success(sysResourceService.getResourceTree());
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysRole;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.enums.dict.EnumStatus;
|
||||
import com.arm.equipment.system.data.service.system.ISysRoleService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--角色表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:47
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysRole")
|
||||
public class SysRoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService sysRoleService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param sysRoleReq sysRoleReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody SysRole sysRoleReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysRoleService.save(sysRoleReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param sysRoleReq sysRoleReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody SysRole sysRoleReq) {
|
||||
sysRoleReq.setStatus(EnumStatus.NEW.getCode());
|
||||
int count = sysRoleService.getCount(sysRoleReq);
|
||||
List<SysRole> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysRoleService.getPageList(sysRoleReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysRoleReq.getPageNo(), sysRoleReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param id
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public RespJSON delete(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysRoleService.delete(id, loginSysUser.getName());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
|
||||
return RespJSON.success(sysRoleService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户角色
|
||||
*
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getCurrentUserRole")
|
||||
public RespJSON getCurrentUserRole(@SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
List<SysRole> sysRoleList = sysRoleService.getCurrentUserRole(loginSysUser.getId());
|
||||
return RespJSON.success(sysRoleList);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.service.system.ISysRoleResourceService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.system.SysRoleResourceVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 系统-角色权限关联表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:41
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysRoleResource")
|
||||
public class SysRoleResourceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysRoleResourceService sysRoleResourceService;
|
||||
|
||||
/**
|
||||
* 添加角色按此单
|
||||
* @param roleResourceVO
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addResource")
|
||||
public RespJSON addResource(@RequestBody SysRoleResourceVO roleResourceVO, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysRoleResourceService.addResource(roleResourceVO, loginSysUser.getName());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询所拥有菜单权限
|
||||
*
|
||||
* @param roleResourceVO
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getResourcesIdListByRoleId")
|
||||
public RespJSON getResourcesIdListByRoleId(@RequestBody SysRoleResourceVO roleResourceVO) {
|
||||
return RespJSON.success(sysRoleResourceService.getResourcesIdListByRoleId(roleResourceVO.getRoleId()));
|
||||
}
|
||||
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.*;
|
||||
import com.arm.equipment.system.data.service.system.*;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--用户表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:07:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysUser")
|
||||
public class SysUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private ISysRoleService sysRoleService;
|
||||
@Autowired
|
||||
private ISysRoleResourceService roleResourceService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param sysUserReq sysUserReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody SysUser sysUserReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysUserService.save(sysUserReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param sysUserReq sysUserReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody SysUser sysUserReq) {
|
||||
int count = sysUserService.getCount(sysUserReq);
|
||||
List<SysUser> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysUserService.getPageList(sysUserReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysUserReq.getPageNo(), sysUserReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(sysUserService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public RespJSON delete(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysUserService.delete(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登陆
|
||||
* <p>
|
||||
* param username 用户名
|
||||
* param password 密码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public RespJSON login(@RequestBody SysUser sysUser, HttpSession webSession) {
|
||||
SysUser sysUserDB = sysUserService.login(sysUser, webSession);
|
||||
webSession.setAttribute(CurrentUserUtils.SYSTEM_USER, sysUserDB);
|
||||
return RespJSON.success(webSession.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*
|
||||
* @param webSession
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/logout")
|
||||
public RespJSON logout(HttpSession webSession) {
|
||||
webSession.removeAttribute(CurrentUserUtils.SYSTEM_USER);
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getCurrentUser")
|
||||
public RespJSON getCurrentUserAndRole(@SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
List<SysRole> currentUserRole = sysRoleService.getCurrentUserRole(loginSysUser.getId());
|
||||
|
||||
loginSysUser.setSysRoleList(currentUserRole);
|
||||
List<String> sysResourceIdentityList = new ArrayList<>();
|
||||
List<SysResource> sysResourceList = new ArrayList<>();
|
||||
|
||||
roleResourceService.buildUserResourceListAndIdentityList(currentUserRole, sysResourceList, sysResourceIdentityList);
|
||||
if (CollectionUtils.isEmpty(currentUserRole)) {
|
||||
currentUserRole = new ArrayList<>();
|
||||
SysRole sysRole = new SysRole();
|
||||
sysRole.setName("首页");
|
||||
currentUserRole.add(sysRole);
|
||||
loginSysUser.setSysRoleList(currentUserRole);
|
||||
}
|
||||
loginSysUser.setSysResourceList(sysResourceList);
|
||||
loginSysUser.setSysResourceIdentityList(sysResourceIdentityList);
|
||||
return RespJSON.success(loginSysUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @param oldPassword
|
||||
* @param newPassword
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updatePassword")
|
||||
public RespJSON login(String oldPassword, String newPassword, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.isMaxLength(oldPassword, 32, "旧密码错误");
|
||||
WJAssert.isMaxLength(newPassword, 32, "新密码错误");
|
||||
sysUserService.updatePassword(oldPassword, newPassword, loginSysUser.getId());
|
||||
return RespJSON.success();
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.system;
|
||||
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.domain.system.SysUserRole;
|
||||
import com.arm.equipment.system.data.service.system.ISysUserRoleService;
|
||||
import com.arm.equipment.system.data.service.system.ISysUserService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.system.AddRoleVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 系统--用户角色关联表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:59
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysUserRole")
|
||||
public class SysUserRoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param sysUserRoleReq sysUserRoleReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody SysUserRole sysUserRoleReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysUserRoleService.save(sysUserRoleReq, loginSysUser.getOperator());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param sysUserRoleReq sysUserRoleReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody SysUserRole sysUserRoleReq) {
|
||||
int count = sysUserRoleService.getCount(sysUserRoleReq);
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = sysUserRoleService.getPageList(sysUserRoleReq);
|
||||
}
|
||||
PageResult result = new PageResult(sysUserRoleReq.getPageNo(), sysUserRoleReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(sysUserRoleService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 为用户分配角色
|
||||
*
|
||||
* @param addRoleVO
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addRole")
|
||||
public RespJSON addRole(@RequestBody AddRoleVO addRoleVO, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
sysUserRoleService.addRole(addRoleVO, loginSysUser);
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param sysUserRoleReq
|
||||
* @param loginSysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getList")
|
||||
public RespJSON addRole(@RequestBody SysUserRole sysUserRoleReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
List<SysUser> sysUserList = sysUserRoleService.getList(sysUserRoleReq).stream().map(item -> {
|
||||
return sysUserService.getExitOneById(item.getSysUserId());
|
||||
}).collect(Collectors.toList());
|
||||
sysUserList.removeAll(Collections.singleton(null));
|
||||
return RespJSON.success(sysUserList);
|
||||
}
|
||||
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.user;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.domain.user.AppUser;
|
||||
import com.arm.equipment.system.data.service.user.IAppUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* APP用户
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月13日 22:34:47
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/appUser")
|
||||
public class AppUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param appUserReq appUserReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody AppUser appUserReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
appUserService.save(appUserReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param appUserReq appUserReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody AppUser appUserReq) {
|
||||
int count = appUserService.getCount(appUserReq);
|
||||
List<AppUser> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = appUserService.getPageList(appUserReq);
|
||||
}
|
||||
PageResult result = new PageResult(appUserReq.getPageNo(), appUserReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(appUserService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/audit")
|
||||
@ResponseBody
|
||||
public RespJSON audit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
appUserService.audit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/unaudit")
|
||||
@ResponseBody
|
||||
public RespJSON unaudit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
appUserService.unaudit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.verifycode;
|
||||
|
||||
|
||||
import com.arm.equipment.system.data.service.common.IVerifyCodeService;
|
||||
import com.arm.equipment.system.data.util.ValidCodeUtil;
|
||||
import com.arm.equipment.system.data.vo.system.VerifyCodeVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author: admin
|
||||
* @time: 2022/9/16 14:35
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/verifycode")
|
||||
public class VerifyCodeController {
|
||||
@Autowired
|
||||
private IVerifyCodeService verifyCodeService;
|
||||
/**
|
||||
* 验证码key开头
|
||||
*/
|
||||
public final static String KEY_TOP = "verifyCode_";
|
||||
|
||||
/**
|
||||
* 生成验证码图片与存入SESSION
|
||||
*
|
||||
* @param response
|
||||
* @param webSession
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/getVerifyCode")
|
||||
public void getVerifyCode(HttpServletResponse response, HttpSession webSession) throws IOException {
|
||||
VerifyCodeVO verifyCode = verifyCodeService.generate(80, 28);
|
||||
String code = verifyCode.getCode();
|
||||
webSession.setAttribute(KEY_TOP + code, verifyCode);
|
||||
response.setContentType(MediaType.IMAGE_JPEG_VALUE);
|
||||
ServletOutputStream outputStream;
|
||||
try {
|
||||
outputStream = response.getOutputStream();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("获得响应流失败");
|
||||
}
|
||||
try {
|
||||
BufferedImage image = ValidCodeUtil.generateImg(code);
|
||||
ImageIO.write(image, "png", outputStream);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("验证码输出到流失败");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.weaponry;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.domain.weaponry.Weaponry;
|
||||
import com.arm.equipment.system.data.service.weaponry.IWeaponryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 装备武器
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月23日 10:29:48
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/weaponry/weaponry")
|
||||
public class WeaponryController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWeaponryService weaponryService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param weaponryReq weaponryReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody Weaponry weaponryReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
weaponryService.save(weaponryReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param weaponryReq weaponryReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody Weaponry weaponryReq) {
|
||||
int count = weaponryService.getCount(weaponryReq);
|
||||
List<Weaponry> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = weaponryService.getPageList(weaponryReq);
|
||||
}
|
||||
PageResult result = new PageResult(weaponryReq.getPageNo(), weaponryReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(weaponryService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/audit")
|
||||
@ResponseBody
|
||||
public RespJSON audit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
weaponryService.audit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/unaudit")
|
||||
@ResponseBody
|
||||
public RespJSON unaudit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
weaponryService.unaudit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.weaponry;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.domain.weaponry.WeaponryLendRecord;
|
||||
import com.arm.equipment.system.data.service.weaponry.IWeaponryLendRecordService;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 装备武器借出记录
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月23日 09:20:19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/weaponry/weaponryLendRecord")
|
||||
public class WeaponryLendRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWeaponryLendRecordService weaponryLendRecordService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param weaponryLendRecordReq weaponryLendRecordReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody WeaponryLendRecord weaponryLendRecordReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
weaponryLendRecordService.save(weaponryLendRecordReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param weaponryLendRecordReq weaponryLendRecordReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody WeaponryLendRecord weaponryLendRecordReq) {
|
||||
int count = weaponryLendRecordService.getCount(weaponryLendRecordReq);
|
||||
List<WeaponryLendRecord> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = weaponryLendRecordService.getPageList(weaponryLendRecordReq);
|
||||
}
|
||||
PageResult result = new PageResult(weaponryLendRecordReq.getPageNo(), weaponryLendRecordReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(weaponryLendRecordService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/refuse")
|
||||
@ResponseBody
|
||||
public RespJSON refuse(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
weaponryLendRecordService.refuse(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/adopt")
|
||||
@ResponseBody
|
||||
public RespJSON adopt(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER) SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
weaponryLendRecordService.adopt(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.arm.equipment.system.admin.controller.weaponry;
|
||||
|
||||
import com.arm.equipment.system.admin.controller.BaseController;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.PageResult;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.domain.weaponry.WeaponryReturnRecord;
|
||||
import com.arm.equipment.system.data.service.weaponry.IWeaponryReturnRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 装备武器归还记录
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月23日 09:20:25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/weaponry/weaponryReturnRecord")
|
||||
public class WeaponryReturnRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWeaponryReturnRecordService weaponryReturnRecordService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param weaponryReturnRecordReq weaponryReturnRecordReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody WeaponryReturnRecord weaponryReturnRecordReq, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
weaponryReturnRecordService.save(weaponryReturnRecordReq, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param weaponryReturnRecordReq weaponryReturnRecordReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody WeaponryReturnRecord weaponryReturnRecordReq) {
|
||||
int count = weaponryReturnRecordService.getCount(weaponryReturnRecordReq);
|
||||
List<WeaponryReturnRecord> list = new ArrayList<>();
|
||||
if (count > 0) {
|
||||
list = weaponryReturnRecordService.getPageList(weaponryReturnRecordReq);
|
||||
}
|
||||
PageResult result = new PageResult(weaponryReturnRecordReq.getPageNo(), weaponryReturnRecordReq.getPageSize(), count, list);
|
||||
return RespJSON.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneById")
|
||||
public RespJSON getOneById(Long id) {
|
||||
return RespJSON.success(weaponryReturnRecordService.getOneById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/audit")
|
||||
@ResponseBody
|
||||
public RespJSON audit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
weaponryReturnRecordService.audit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消审核
|
||||
*
|
||||
* @param id id
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/unaudit")
|
||||
@ResponseBody
|
||||
public RespJSON unaudit(Long id, @SessionAttribute(CurrentUserUtils.SYSTEM_USER)SysUser loginSysUser) {
|
||||
WJAssert.notNull(id, "ID 不合法");
|
||||
weaponryReturnRecordService.unaudit(id, loginSysUser.getUsername());
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package com.arm.equipment.system.admin.filter;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* request封装
|
||||
*/
|
||||
public class BodyReaderHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private final byte[] body;
|
||||
private String bodyStr;
|
||||
|
||||
public BodyReaderHttpServletRequestWrapper(HttpServletRequest request) throws IOException {
|
||||
super(request);
|
||||
String bodyString = getBodyString(request);
|
||||
body = bodyString.getBytes(StandardCharsets.UTF_8);
|
||||
bodyStr = bodyString;
|
||||
}
|
||||
|
||||
public String getBodyStr() {
|
||||
return bodyStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body);
|
||||
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return byteArrayInputStream.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public String getBodyString(HttpServletRequest request) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStream inputStream = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
inputStream = request.getInputStream();
|
||||
reader = new BufferedReader(
|
||||
new InputStreamReader(inputStream, Charset.forName("UTF-8")));
|
||||
|
||||
char[] bodyCharBuffer = new char[1024];
|
||||
int len = 0;
|
||||
while ((len = reader.read(bodyCharBuffer)) != -1) {
|
||||
sb.append(new String(bodyCharBuffer, 0, len));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
package com.arm.equipment.system.admin.filter;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.ReturnCode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: admin
|
||||
* @time: 2022/9/16 11:20
|
||||
*/
|
||||
@Order(1001)
|
||||
@Configuration
|
||||
public class LoginPermissionsFilter implements HandlerInterceptor {
|
||||
private final static Logger logger = LoggerFactory.getLogger(LoginPermissionsFilter.class);
|
||||
@Value("${domain.admin}")
|
||||
private String adminDomain;
|
||||
|
||||
private static final List<String> IGNORE_URL_LIST = Arrays.asList("/login", "/file/upload", "/common/dict", "/verifycode/getVerifyCode");
|
||||
|
||||
private final String RETURN_INFO = JSON.toJSONString(RespJSON.returnCode(ReturnCode.NOT_LOGIN_ERROR));
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// 将 options 请求放过
|
||||
String method = request.getMethod();
|
||||
if ("options".equalsIgnoreCase(method)) {
|
||||
return true;
|
||||
}
|
||||
String uri = request.getRequestURI();
|
||||
for (String ignoreUrl : IGNORE_URL_LIST) {
|
||||
if (StringUtils.contains(uri, ignoreUrl)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
SysUser sysUser = (SysUser) request.getSession().getAttribute(CurrentUserUtils.SYSTEM_USER);
|
||||
if (null != sysUser) {
|
||||
return true;
|
||||
}
|
||||
returnNoLogin(response, request);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private void returnNoLogin(HttpServletResponse response, HttpServletRequest request) {
|
||||
String origin = adminDomain;
|
||||
String originHeader = request.getHeader("Origin");
|
||||
if (StringUtils.isNotEmpty(originHeader)) {
|
||||
origin = originHeader;
|
||||
}
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Origin", origin);
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
writer.write(RETURN_INFO);
|
||||
} catch (IOException e) {
|
||||
logger.error(Throwables.getStackTraceAsString(e));
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.arm.equipment.system.admin.filter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 记录用户请求参数
|
||||
*/
|
||||
@Component
|
||||
@WebFilter(filterName = "httpServletRequestWrapperFilter", urlPatterns = {"/"})
|
||||
public class RequestBodyFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
ServletRequest requestWrapper = null;
|
||||
if (request instanceof HttpServletRequest) {
|
||||
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||
//遇到post方法才对request进行包装
|
||||
String methodType = httpRequest.getMethod();
|
||||
String contentType = ((HttpServletRequest) request).getHeader("Content-Type");
|
||||
if (StringUtils.isNotEmpty(contentType) && contentType.contains("application/json") && "POST".equals(methodType)) {
|
||||
requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request);
|
||||
}
|
||||
}
|
||||
if (null == requestWrapper) {
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
chain.doFilter(requestWrapper, response);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
package com.arm.equipment.system.admin.filter;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.arm.equipment.system.admin.util.CurrentUserUtils;
|
||||
import com.arm.equipment.system.data.domain.system.SysLog;
|
||||
import com.arm.equipment.system.data.domain.system.SysUser;
|
||||
import com.arm.equipment.system.data.enums.dict.EnumSysLogType;
|
||||
import com.arm.equipment.system.data.service.system.ISysLogService;
|
||||
import com.arm.equipment.system.data.util.IPUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 系统日志filter, 记录所有请求
|
||||
*/
|
||||
@Order(1002)
|
||||
@Configuration
|
||||
public class SysLogFilter implements HandlerInterceptor {
|
||||
private final static Logger logger = LoggerFactory.getLogger(SysLogFilter.class);
|
||||
@Autowired
|
||||
private ISysLogService sysLogService;
|
||||
/**
|
||||
* 50个线程, 无界队列, 超过异常
|
||||
*/
|
||||
private final static ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(50, 50, 120, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadPoolExecutor.AbortPolicy());
|
||||
/**
|
||||
* 登录路径
|
||||
*/
|
||||
private final static String LOGIN_PATH = "/system/sysUser/login";
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
THREAD_POOL_EXECUTOR.submit(() -> {
|
||||
String userAgent = request.getHeader("User-Agent");
|
||||
SysLog sysLog = new SysLog();
|
||||
sysLog.setType(EnumSysLogType.LOG.getCode());
|
||||
// todo 尽量设置访问链接的菜单
|
||||
sysLog.setTitle(" ");
|
||||
sysLog.setRemoteAddr(IPUtil.getRemoteAddress(request));
|
||||
|
||||
sysLog.setUserAgent(userAgent);
|
||||
sysLog.setRequestUri(buildUri(request));
|
||||
sysLog.setMethod(request.getMethod());
|
||||
String requestBody = getRequestBody(((BodyReaderHttpServletRequestWrapper) request).getBodyStr());
|
||||
sysLog.setParams(requestBody);
|
||||
//登录接口日志特殊处理 不显示密码
|
||||
if (sysLog.getRequestUri().contains(LOGIN_PATH)) {
|
||||
JSONObject loginInfoJson = JSONObject.parseObject(requestBody);
|
||||
loginInfoJson.put("password", "");
|
||||
sysLog.setParams(loginInfoJson.toJSONString());
|
||||
}
|
||||
SysUser sysUser = (SysUser) request.getSession().getAttribute(CurrentUserUtils.SYSTEM_USER);
|
||||
if (null != sysUser) {
|
||||
sysLogService.save(sysLog, sysUser.getUsername());
|
||||
} else {
|
||||
sysLogService.save(sysLog, "SYSTEM");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
private Map<String, String> getAllHeader(HttpServletRequest request) {
|
||||
Enumeration<String> headerNames = request.getHeaderNames();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String key = headerNames.nextElement();
|
||||
map.put(key, request.getHeader(key));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private String getRequestBody(String requestBody) {
|
||||
if (StringUtils.isEmpty(requestBody)) {
|
||||
return null;
|
||||
}
|
||||
return requestBody;
|
||||
}
|
||||
|
||||
private String buildUri(HttpServletRequest request) {
|
||||
String path = request.getRequestURL().toString();
|
||||
String query = request.getQueryString();
|
||||
if (StringUtils.isEmpty(query)) {
|
||||
return path;
|
||||
}
|
||||
return path + "?" + query;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.arm.equipment.system.admin.util;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author: admin
|
||||
* @time: 2022/9/16 11:20
|
||||
*/
|
||||
public class CurrentUserUtils {
|
||||
|
||||
public static final String SYSTEM_USER = "system_user";
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
env: dev
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/arm-equipment-system?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
auto-commit: true
|
||||
connection-timeout: 30000
|
||||
idle-timeout: 600000
|
||||
max-lifetime: 1800000
|
||||
minimum-idle: 1
|
||||
maximum-pool-size: 10
|
||||
pool-name: hikaricp
|
||||
validation-timeout: 5000
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
database: 0
|
||||
timeout: 5000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-idle: 100
|
||||
min-idle: 1
|
||||
max-active: 1000
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:admin/src/main/resources/static
|
||||
# 域名配置
|
||||
domain:
|
||||
admin: http://localhost:9527
|
@ -1,25 +0,0 @@
|
||||
git:
|
||||
version: "@git.commit.id.abbrev@"
|
||||
commitTime: "@git.commit.time@"
|
||||
server:
|
||||
port: 18081
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
|
||||
spring:
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: true
|
||||
output:
|
||||
ansi:
|
||||
enabled: always
|
||||
webflux:
|
||||
static-path-pattern: /**
|
||||
session:
|
||||
store-type: redis
|
||||
timeout: 86400
|
||||
profiles:
|
||||
active: dev
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 1024MB
|
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
<substitutionProperty name="log.base" value="logs/app" />
|
||||
|
||||
<springProfile name="dev">
|
||||
<logger name="com.arm.equipment.system" level="debug" additivity="false">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</logger>
|
||||
<logger name="io.swagger.models.parameters.AbstractSerializableParameter" level="error" additivity="false">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="prod,test">
|
||||
<appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${log.base}.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
<maxHistory>30</maxHistory>
|
||||
<FileNamePattern>
|
||||
${log.base}.%d{yyyy-MM-dd}.log
|
||||
</FileNamePattern>
|
||||
</rollingPolicy>
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<pattern>
|
||||
%date [%thread] %-5level %logger{80} - %msg%n
|
||||
</pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
<logger name="io.swagger.models.parameters.AbstractSerializableParameter" level="error" additivity="false">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="logfile" />
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="logfile" />
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
|
@ -1,38 +0,0 @@
|
||||
package com.arm.equipment.system.admin;
|
||||
|
||||
import com.arm.equipment.system.admin.app.AdminApplication;
|
||||
import com.arm.equipment.system.data.service.common.IIdWorkerService;
|
||||
import com.arm.equipment.system.data.util.passwordEncoder.BCryptPasswordEncoderUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = AdminApplication.class)
|
||||
@ActiveProfiles(profiles = "dev")
|
||||
public class AdminApplicationTests {
|
||||
|
||||
@Autowired
|
||||
private BCryptPasswordEncoderUtils bCryptPasswordEncoder;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
System.out.println(bCryptPasswordEncoder.encode("123123"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
IIdWorkerService idWorkerService;
|
||||
|
||||
@Test
|
||||
public void aa(){
|
||||
for (int i = 0; i < 30; i++) {
|
||||
System.out.println(idWorkerService.getNextId());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
package com.arm.equipment.system.admin;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.arm.equipment.system.admin.app.AdminApplication;
|
||||
import com.arm.equipment.system.data.domain.system.SysResource;
|
||||
import com.arm.equipment.system.data.service.system.ISysResourceService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = AdminApplication.class)
|
||||
@ActiveProfiles(profiles = "dev")
|
||||
public class SysResourceTests {
|
||||
@Autowired
|
||||
private ISysResourceService sysResourceService;
|
||||
|
||||
/**
|
||||
* 公共按钮map
|
||||
*/
|
||||
private final static Map<String, String> MAP = ImmutableMap.<String, String>builder()
|
||||
.put("list", "查询")
|
||||
.put("add", "添加")
|
||||
.put("edit", "编辑")
|
||||
.put("delete", "删除")
|
||||
.put("audit", "审核")
|
||||
.put("unAudit", "取消审核")
|
||||
.put("publish", "发布")
|
||||
.put("unPublish", "取消发布")
|
||||
.put("archives", "归档")
|
||||
.put("unArchives", "取消归档")
|
||||
.put("setPosition", "调整位置")
|
||||
.put("exportToExcel", "导出Excel")
|
||||
.put("recommend", "推荐")
|
||||
.put("unRecommend", "取消推荐")
|
||||
.put("used", "标记使用")
|
||||
.put("clueFee", "线索费")
|
||||
.put("show", "显示")
|
||||
.put("unShow", "取消显示")
|
||||
.put("send", "发放红包")
|
||||
.put("refuse", "拒绝")
|
||||
.put("top", "置顶")
|
||||
.put("unTop", "取消置顶")
|
||||
.put("handle", "处理")
|
||||
.put("onShelves", "上架")
|
||||
.put("offShell", "下架")
|
||||
.put("push", "推送")
|
||||
.put("recruit", "招聘管理")
|
||||
.put("download", "下载简历模板")
|
||||
.put("recruitmentDeliverInfoList", "查看职位投递信息")
|
||||
.put("updateStatus", "操作提醒状态")
|
||||
.put("option", "直播间设置")
|
||||
.put("startLuckyBag", "直播间开启福袋")
|
||||
.put("closeLuckyBag", "直播间关闭福袋")
|
||||
.put("modifyLuckyBag", "直播间修改福袋")
|
||||
.put("startRedPacket", "直播间开启红包")
|
||||
.put("modifyRedPacket", "直播间修改红包")
|
||||
.put("interaction", "直播间互动")
|
||||
.put("data", "直播间数据")
|
||||
.put("split", "直播间拆条")
|
||||
.put("startLive", "直播间开始直播")
|
||||
.put("stopLive", "直播间结束直播")
|
||||
.put("modifyLive", "直播间修改直播")
|
||||
.put("addLine", "直播间新增线路")
|
||||
.put("breakLine", "直播间断开线路")
|
||||
.put("restoreLine", "直播间恢复线路")
|
||||
.put("modifyLine", "直播间修改线路")
|
||||
.put("deleteLine", "直播间删除线路")
|
||||
.put("addVote", "直播间添加投票")
|
||||
.put("modifyVote", "直播间修改投票")
|
||||
.put("deleteVote", "直播间删除投票")
|
||||
.put("deleteComment", "直播间删除评论")
|
||||
.put("cancelTopComment", "直播间取消置顶评论")
|
||||
.put("topComment", "直播间置顶评论")
|
||||
.put("addDraw", "直播间创建抽奖")
|
||||
.put("addCoupon", "直播间创建优惠券")
|
||||
.put("startCoupon", "直播间开启优惠券")
|
||||
.put("closeCoupon", "直播间关闭优惠券")
|
||||
.put("modifyCoupon", "直播间修改优惠券")
|
||||
.put("updateBrowseMultiple", "浏览倍率")
|
||||
.put("sliderManage", "轮播管理")
|
||||
.put("navManage", "导航栏管理")
|
||||
.put("start", "导播台开启")
|
||||
.put("stop", "导播台关闭")
|
||||
.put("detail", "导播台详情")
|
||||
.put("canPublish", "可发布文章")
|
||||
.put("sign", "标记")
|
||||
.build();
|
||||
/**父级菜单查询条件 这里是根据路径找到对象 根据需求更换*/
|
||||
private final static String URL_WHERE = "/live/liveStudioGiftsList";
|
||||
/**按钮标识前缀 根据需求更换*/
|
||||
private final static String SUFFIX_IDENTITY = "live_studio_gifts"+"_";
|
||||
/**按钮名称前缀 根据需求更换*/
|
||||
private final static String SUFFIX_NAME = "直播间礼物";
|
||||
/**需要生成的按钮权限 已公共map中的为准 有其他公共权限可以自行添加到map 一般如果存在多个按钮 list按钮权限最好生成 根据需求更换*/
|
||||
private final static List<String> COMMON_ROLE = Arrays.asList("list", "add","edit","delete","audit","unAudit");
|
||||
// "startRedPacket", "modifyRedPacket", "interaction", "data", "split", "startLive", "stopLive", "modifyLive",
|
||||
// "addLine", "breakLine", "restoreLine", "modifyLine", "deleteLine", "addVote", "modifyVote", "deleteVote",
|
||||
// "deleteComment", "cancelTopComment", "topComment", "addDraw", "addCoupon", "startCoupon", "closeCoupon");
|
||||
/**
|
||||
* 公共添加
|
||||
*/
|
||||
@Test
|
||||
public void commonSave() {
|
||||
SysResource where = new SysResource();
|
||||
where.setUrl(URL_WHERE);
|
||||
List<SysResource> sysResourcesListDB = sysResourceService.getList(where);
|
||||
COMMON_ROLE.forEach(item -> {
|
||||
buildSave(sysResourcesListDB.get(0).getId().toString(), SUFFIX_IDENTITY + item, SUFFIX_NAME + MAP.get(item));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个添加
|
||||
*/
|
||||
// @Test
|
||||
// public void save() {
|
||||
// SysResource where = new SysResource();
|
||||
// where.setUrl(URL_WHERE);
|
||||
// List<SysResource> sysResourcesListDB = sysResourceService.getList(where);
|
||||
// buildSave(sysResourcesListDB.get(0).getId(), SUFFIX_IDENTITY + "generalize", SUFFIX_NAME + "微兔眼爆料跟踪信息");
|
||||
// }
|
||||
|
||||
private void buildSave(String parentId, String identity, String name) {
|
||||
SysResource req = new SysResource();
|
||||
req.setIdentity(identity);
|
||||
req.setName(name);
|
||||
req.setParentId(parentId);
|
||||
req.setType(2);
|
||||
req.setSort(1);
|
||||
req.setIsShow(1);
|
||||
sysResourceService.save(req, "admin");
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.arm.equipment.system</groupId>
|
||||
<artifactId>arm-equipment-system-parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>api</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>api</name>
|
||||
<description>接口工程</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.arm.equipment.system</groupId>
|
||||
<artifactId>data</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>arm-equipment-system-parent-${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
package com.arm.equipment.system.api.annotation;
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* 判断接口是否必须要登录才能使用
|
||||
* @author admin
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface LoginCheck {
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package com.arm.equipment.system.api.app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.web.util.IntrospectorCleanupListener;
|
||||
|
||||
/**
|
||||
* 工程启动配置
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@ComponentScan("com.arm.equipment.system")
|
||||
@EnableTransactionManagement
|
||||
@EnableRedisHttpSession
|
||||
@EnableCaching
|
||||
public class ApiApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletListenerRegistrationBean introspectorCleanupListener() {
|
||||
ServletListenerRegistrationBean listenerRegistration = new ServletListenerRegistrationBean();
|
||||
listenerRegistration.setListener(new IntrospectorCleanupListener());
|
||||
return listenerRegistration;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package com.arm.equipment.system.api.app;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* CORS配置
|
||||
*/
|
||||
@Configuration
|
||||
public class ApiCorsConfiguration {
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
// 添加CORS配置信息
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 放行哪些原始域
|
||||
config.addAllowedOriginPattern("*");
|
||||
// 是否发送Cookie信息
|
||||
config.setAllowCredentials(true);
|
||||
// 放行哪些原始域(请求方式)
|
||||
config.addAllowedMethod("*");
|
||||
// 放行哪些原始域(头部信息)
|
||||
config.addAllowedHeader("*");
|
||||
// 暴露哪些头部信息(因为跨域访问默认不能获取全部头部信息)
|
||||
// config.addExposedHeader("*");
|
||||
|
||||
//2.添加映射路径
|
||||
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
|
||||
configSource.registerCorsConfiguration("/**", config);
|
||||
|
||||
//3.返回新的CorsFilter.
|
||||
return new CorsFilter(configSource);
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
||||
/**
|
||||
* 接口的基础类
|
||||
* @author admin
|
||||
*/
|
||||
public abstract class BaseController{
|
||||
@Autowired
|
||||
protected RedisTemplate redisTemplate;
|
||||
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
}
|
@ -1,155 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.arm.equipment.system.data.constant.ConstantValues;
|
||||
import com.arm.equipment.system.data.exception.AuthException;
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
import com.arm.equipment.system.data.util.EnvUtil;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.ReturnCode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.QueryTimeoutException;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.server.ServerWebInputException;
|
||||
import org.springframework.web.server.UnsupportedMediaTypeStatusException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* 统一异常处理
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class ExceptionController {
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(ExceptionController.class);
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@ExceptionHandler(value = IllegalArgumentException.class)
|
||||
@ResponseBody
|
||||
public RespJSON illegalArgumentException(HttpServletRequest req, Exception e) {
|
||||
if (EnvUtil.isDev()) {
|
||||
LOGGER.error("异常", e);
|
||||
} else {
|
||||
LOGGER.info("异常: {}", e.getMessage());
|
||||
}
|
||||
logErrDetail(req);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, "参数错误: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = MethodArgumentTypeMismatchException.class)
|
||||
@ResponseBody
|
||||
public RespJSON methodArgumentTypeMismatchException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
String field = ((MethodArgumentTypeMismatchException) e).getName();
|
||||
String rejectedValue = ((MethodArgumentTypeMismatchException) e).getValue().toString();
|
||||
String message = "参数:" + field + "注入的值不合法:" + rejectedValue;
|
||||
LOGGER.error("入参错误", e);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, message);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = BusinessException.class)
|
||||
@ResponseBody
|
||||
public RespJSON customException(HttpServletRequest req, BusinessException e) {
|
||||
if (EnvUtil.isDev()) {
|
||||
LOGGER.error("自定义异常", e);
|
||||
} else {
|
||||
LOGGER.info("自定义异常: {}", e.getMessage());
|
||||
}
|
||||
logErrDetail(req);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = AuthException.class)
|
||||
@ResponseBody
|
||||
public RespJSON authException(HttpServletRequest req, AuthException e) {
|
||||
logErrDetail(req);
|
||||
if (e.getReturnCode() != null) {
|
||||
return RespJSON.returnCode(e.getReturnCode());
|
||||
} else {
|
||||
return RespJSON.returnCode(ReturnCode.CODE_OK, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = BindException.class)
|
||||
@ResponseBody
|
||||
public RespJSON bindException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
FieldError fieldError = ((BindException) e).getBindingResult().getFieldError();
|
||||
String field = fieldError.getField();
|
||||
Object rejectedValue = fieldError.getRejectedValue();
|
||||
String message = "参数:" + field + "注入的值不合法:" + rejectedValue;
|
||||
LOGGER.error("入参错误", e);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, message);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = ParseException.class)
|
||||
@ResponseBody
|
||||
public RespJSON parseException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
return RespJSON.returnCode(ReturnCode.PARSE_ERROR);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = UnsupportedMediaTypeStatusException.class)
|
||||
@ResponseBody
|
||||
public RespJSON unsupportedMediaTypeStatusException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
return RespJSON.returnCustomCodeWithMessage(ReturnCode.SYS_ERROR.getCode(), "错误的请求格式");
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = ServerWebInputException.class)
|
||||
@ResponseBody
|
||||
public RespJSON serverWebInputException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return RespJSON.returnCodeWithMessage(ReturnCode.CUSTOM_MESSAGE, "请在body中传参");
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = QueryTimeoutException.class)
|
||||
@ResponseBody
|
||||
public RespJSON queryTimeoutException(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
((LettuceConnectionFactory)redisTemplate.getConnectionFactory()).initConnection();
|
||||
LOGGER.info("reset redis connection");
|
||||
return RespJSON.returnCode(ReturnCode.SYS_ERROR);
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseBody
|
||||
public RespJSON defaultErrorHandler(HttpServletRequest req, Exception e) {
|
||||
logErrDetail(req);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
return RespJSON.returnCode(ReturnCode.SYS_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打印异常参数等信息
|
||||
* @param req
|
||||
*/
|
||||
private void logErrDetail(HttpServletRequest req) {
|
||||
LOGGER.error("异常请求: {}", req.getRequestURI());
|
||||
LOGGER.error("异常参数: {}", JSON.toJSONString(req.getParameterMap()));
|
||||
Object requestBody = req.getAttribute(ConstantValues.REQUEST_BODY);
|
||||
if (null == requestBody) {
|
||||
requestBody = "";
|
||||
}
|
||||
LOGGER.error("异常参数: {}", requestBody.toString());
|
||||
LOGGER.error("异常UA: {}", req.getHeader("user-agent"));
|
||||
LOGGER.error("异常referer: {}", req.getHeader("referer"));
|
||||
LOGGER.error("异常Content-Type: {}", req.getHeader("Content-Type"));
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller.app;
|
||||
|
||||
import com.arm.equipment.system.api.controller.BaseController;
|
||||
import com.arm.equipment.system.data.domain.system.SysBaseParam;
|
||||
import com.arm.equipment.system.data.service.system.ISysBaseParamService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 系统--基础参数
|
||||
*
|
||||
* @author: admin
|
||||
* @time: 2022/9/22 22:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysBaseParam")
|
||||
public class SysBaseParamAction extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysBaseParamService sysBaseParamService;
|
||||
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
* @param uniCode uniCode
|
||||
* @return RespJSON
|
||||
*/
|
||||
@RequestMapping("/getOneUniCode/{uniCode}")
|
||||
public RespJSON getOneUniCode(@PathVariable String uniCode) {
|
||||
SysBaseParam baseParamDB = sysBaseParamService.getOneByUniCode(uniCode);
|
||||
if (baseParamDB != null) {
|
||||
//不返回备注
|
||||
baseParamDB.setDescription(null);
|
||||
}
|
||||
return RespJSON.success(baseParamDB);
|
||||
}
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller.common;
|
||||
|
||||
|
||||
import com.arm.equipment.system.api.controller.BaseController;
|
||||
import com.arm.equipment.system.data.enums.file.EnumUpload;
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
import com.arm.equipment.system.data.service.file.IFileService;
|
||||
import com.arm.equipment.system.data.util.StringUtils;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 公共文件上传接口
|
||||
*
|
||||
* @author: xly
|
||||
* @time: 2023/3/10 10:55
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/file")
|
||||
public class UploadAction extends BaseController {
|
||||
@Autowired
|
||||
private IFileService fileService;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public RespJSON upload(String uploadItem, @RequestParam("file") MultipartFile file) {
|
||||
if (null == file) {
|
||||
throw new BusinessException("文件不合法");
|
||||
}
|
||||
EnumUpload enumUploadItem = EnumUpload.RES_PHOTO_LIB;
|
||||
if (StringUtils.isNotBlank(uploadItem)) {
|
||||
enumUploadItem = EnumUpload.getEnum(uploadItem);
|
||||
}
|
||||
if (enumUploadItem == null) {
|
||||
throw new BusinessException("上传文件类目不正确");
|
||||
}
|
||||
try {
|
||||
return RespJSON.success(fileService.upload(file, enumUploadItem));
|
||||
} catch (Exception e) {
|
||||
logger.error("文件上传错误", e);
|
||||
throw new BusinessException("文件上传错误");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller.dict;
|
||||
|
||||
|
||||
import com.arm.equipment.system.data.service.common.IDictService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 字典接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common/dict")
|
||||
public class DictAction {
|
||||
@Autowired
|
||||
private IDictService dictService;
|
||||
|
||||
/**
|
||||
* 统计枚举名称获得枚举的数据
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getDictData/{name}")
|
||||
public RespJSON getDictData(@PathVariable("name") String name) {
|
||||
return RespJSON.success(dictService.getDictData(name));
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller.user;
|
||||
|
||||
import com.arm.equipment.system.api.annotation.LoginCheck;
|
||||
import com.arm.equipment.system.api.controller.BaseController;
|
||||
import com.arm.equipment.system.api.util.LoginUtil;
|
||||
import com.arm.equipment.system.data.constant.RedisKeys;
|
||||
import com.arm.equipment.system.data.domain.user.AppUser;
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
import com.arm.equipment.system.data.service.user.IAppUserService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author ousei
|
||||
* @date 2020年11月4日15:13:16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/appUser")
|
||||
public class AppUserAction extends BaseController {
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
|
||||
@LoginCheck
|
||||
@PostMapping("/getUserInfo")
|
||||
public RespJSON getBaseUserInfo(@SessionAttribute(value = LoginUtil.LOGIN_USER_SESSION_KEY, required = false) AppUser loginUser, HttpServletRequest request) {
|
||||
AppUser appUserDB = Optional.ofNullable(appUserService.getOneById(loginUser.getId())).orElseThrow(() -> new BusinessException("用户不存在"));
|
||||
LoginUtil.saveInCache(appUserDB, request);
|
||||
return RespJSON.success(appUserDB);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* * @return
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public RespJSON login(@RequestBody AppUser appUser, HttpServletRequest request) {
|
||||
AppUser appUserDB = appUserService.login(appUser);
|
||||
LoginUtil.saveInCache(appUserDB, request);
|
||||
return RespJSON.success(appUserDB);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody AppUser req) {
|
||||
appUserService.saveUser(req);
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登陆
|
||||
*
|
||||
* @param loginUser
|
||||
* @return
|
||||
*/
|
||||
@LoginCheck
|
||||
@PostMapping("/logout")
|
||||
public RespJSON logout(@SessionAttribute(LoginUtil.LOGIN_USER_SESSION_KEY) AppUser loginUser) {
|
||||
// 删除登陆缓存
|
||||
redisTemplate.delete(RedisKeys.getAppUserSessionKey(loginUser.getToken()));
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller.weaponry;
|
||||
|
||||
|
||||
import com.arm.equipment.system.api.controller.BaseController;
|
||||
import com.arm.equipment.system.data.domain.weaponry.WeaponryLendRecord;
|
||||
import com.arm.equipment.system.data.enums.dict.EnumWeaponryLendRecordStatus;
|
||||
import com.arm.equipment.system.data.service.weaponry.IWeaponryLendRecordService;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 装备武器借出表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月22日 10:57:51
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/weaponry/weaponryLend")
|
||||
public class WeaponryLendRecordAction extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWeaponryLendRecordService weaponryLendRecordService;
|
||||
|
||||
/**
|
||||
* 保存或更新
|
||||
*
|
||||
* @param weaponryLendRecord weaponryLendRecord
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public RespJSON save(@RequestBody WeaponryLendRecord weaponryLendRecord) {
|
||||
weaponryLendRecordService.saveLend(weaponryLendRecord);
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param weaponryLendReq weaponryLendReq
|
||||
* @return RespJSON
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
public RespJSON getPageList(@RequestBody WeaponryLendRecord weaponryLendReq) {
|
||||
WJAssert.notNull(weaponryLendReq.getPageNo(), "参数非法");
|
||||
WJAssert.notNull(weaponryLendReq.getPageSize(), "参数非法");
|
||||
weaponryLendReq.setStatus(EnumWeaponryLendRecordStatus.ADOPT.getCode());
|
||||
List<WeaponryLendRecord> pageList = weaponryLendRecordService.getPageList(weaponryLendReq);
|
||||
return RespJSON.success(pageList);
|
||||
}
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.arm.equipment.system.api.controller.weaponry;
|
||||
|
||||
import com.arm.equipment.system.api.controller.BaseController;
|
||||
import com.arm.equipment.system.data.service.weaponry.IWeaponryReturnRecordService;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 装备武器归还日志
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月22日 10:42:24
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/weaponry/weaponryReturnRecord")
|
||||
public class WeaponryReturnRecordAction extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWeaponryReturnRecordService weaponryReturnRecordService;
|
||||
|
||||
/**
|
||||
* 保存归还
|
||||
*
|
||||
* @param lendRecordId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/save")
|
||||
public RespJSON save( Long lendRecordId) {
|
||||
weaponryReturnRecordService.saveReturn(lendRecordId);
|
||||
return RespJSON.success();
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package com.arm.equipment.system.api.filter;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* request封装
|
||||
*/
|
||||
public class BodyReaderHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private final byte[] body;
|
||||
private String bodyStr;
|
||||
|
||||
public BodyReaderHttpServletRequestWrapper(HttpServletRequest request) throws IOException {
|
||||
super(request);
|
||||
String bodyString = getBodyString(request);
|
||||
body = bodyString.getBytes(StandardCharsets.UTF_8);
|
||||
bodyStr = bodyString;
|
||||
}
|
||||
|
||||
public String getBodyStr() {
|
||||
return bodyStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body);
|
||||
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return byteArrayInputStream.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public String getBodyString(HttpServletRequest request) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStream inputStream = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
inputStream = request.getInputStream();
|
||||
reader = new BufferedReader(
|
||||
new InputStreamReader(inputStream, Charset.forName("UTF-8")));
|
||||
|
||||
char[] bodyCharBuffer = new char[1024];
|
||||
int len = 0;
|
||||
while ((len = reader.read(bodyCharBuffer)) != -1) {
|
||||
sb.append(new String(bodyCharBuffer, 0, len));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
package com.arm.equipment.system.api.filter;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.arm.equipment.system.api.annotation.LoginCheck;
|
||||
import com.arm.equipment.system.api.util.LoginUtil;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.arm.equipment.system.data.domain.user.AppUser;
|
||||
import com.arm.equipment.system.data.util.StringUtils;
|
||||
import com.arm.equipment.system.data.vo.RespJSON;
|
||||
import com.arm.equipment.system.data.vo.ReturnCode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* 登录过滤器
|
||||
* 用于将登录信息放到session中
|
||||
**/
|
||||
@Order(1004)
|
||||
@Configuration
|
||||
public class LoginFilter implements HandlerInterceptor {
|
||||
private final static Logger logger = LoggerFactory.getLogger(LoginFilter.class);
|
||||
private final String NO_LOGIN_RETURN_INFO = JSON.toJSONString(RespJSON.returnCode(ReturnCode.NOT_LOGIN_ERROR));
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// 将 options 请求放过
|
||||
String method = request.getMethod();
|
||||
if ("options".equalsIgnoreCase(method)) {
|
||||
return true;
|
||||
}
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
LoginCheck loginCheckAnnotation = handlerMethod.getMethodAnnotation(LoginCheck.class);
|
||||
String userTokenHeader = request.getHeader("User-Token");
|
||||
AppUser loginUser;
|
||||
// 不需要登录的接口直接放过
|
||||
if (null == loginCheckAnnotation) {
|
||||
if (StringUtils.isEmpty(userTokenHeader)) {
|
||||
return true;
|
||||
}
|
||||
// 没有获取到用户信息 直接报错
|
||||
loginUser = LoginUtil.getLoginUser(userTokenHeader);
|
||||
|
||||
} else {
|
||||
// 请求头没有token 直接报错
|
||||
if (StringUtils.isEmpty(userTokenHeader)) {
|
||||
returnNoLogin(response);
|
||||
return false;
|
||||
}
|
||||
// 没有获取到用户信息 直接报错
|
||||
loginUser = LoginUtil.getLoginUser(userTokenHeader);
|
||||
if (null == loginUser) {
|
||||
returnNoLogin(response);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 用户信息保存到session
|
||||
AppUser finalLoginUser = loginUser;
|
||||
HttpSession session = request.getSession();
|
||||
session.setAttribute(LoginUtil.LOGIN_USER_SESSION_KEY, finalLoginUser);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 未登录时的返回内容
|
||||
*
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
private void returnNoLogin(HttpServletResponse response) {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
PrintWriter writer = null;
|
||||
try {
|
||||
writer = response.getWriter();
|
||||
writer.write(NO_LOGIN_RETURN_INFO);
|
||||
} catch (IOException e) {
|
||||
logger.error(Throwables.getStackTraceAsString(e));
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.arm.equipment.system.api.filter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 记录用户请求参数
|
||||
*/
|
||||
@Component
|
||||
@WebFilter(filterName = "httpServletRequestWrapperFilter", urlPatterns = {"/"})
|
||||
public class RequestBodyFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
ServletRequest requestWrapper = null;
|
||||
if (request instanceof HttpServletRequest) {
|
||||
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||
//遇到post方法才对request进行包装
|
||||
String methodType = httpRequest.getMethod();
|
||||
String contentType = ((HttpServletRequest) request).getHeader("Content-Type");
|
||||
if (StringUtils.isNotEmpty(contentType) && contentType.contains("application/json") && "POST".equals(methodType)) {
|
||||
requestWrapper = new BodyReaderHttpServletRequestWrapper((HttpServletRequest) request);
|
||||
}
|
||||
}
|
||||
if (null == requestWrapper) {
|
||||
chain.doFilter(request, response);
|
||||
} else {
|
||||
chain.doFilter(requestWrapper, response);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
package com.arm.equipment.system.api.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.arm.equipment.system.data.constant.RedisKeys;
|
||||
import com.arm.equipment.system.data.domain.user.AppUser;
|
||||
import com.arm.equipment.system.data.util.UuidUtils;
|
||||
import com.arm.equipment.system.data.util.WJAssert;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.SetOperations;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 登录用户的工具类
|
||||
*/
|
||||
@Component
|
||||
public class LoginUtil {
|
||||
private final static Logger logger = LoggerFactory.getLogger(LoginUtil.class);
|
||||
private static RedisTemplate redisTemplate;
|
||||
private static ValueOperations<String, String> valueOps;
|
||||
/**
|
||||
* 登录用户在session中的key
|
||||
*/
|
||||
public static final String LOGIN_USER_SESSION_KEY = "appUserSessionKey";
|
||||
/**
|
||||
* 50个线程, 无界队列, 超过异常
|
||||
*/
|
||||
private final static ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(50, 50, 120, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
public static AppUser getLoginUser(String token) {
|
||||
WJAssert.isMaxLength(token, 500, "token非法");
|
||||
String key = RedisKeys.getAppUserSessionKey(token);
|
||||
String s = valueOps.get(key);
|
||||
if (StringUtils.isEmpty(s)) {
|
||||
return null;
|
||||
}
|
||||
return JSONObject.parseObject(s, AppUser.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录状态保存到redis
|
||||
* 不会重新设置token
|
||||
*
|
||||
* @param appUser
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static AppUser refreshCache(AppUser appUser, HttpServletRequest request) {
|
||||
String key = RedisKeys.getAppUserSessionKey(appUser.getToken());
|
||||
valueOps.set(key, JSON.toJSONString(appUser), 1, TimeUnit.DAYS);
|
||||
HttpSession session = request.getSession();
|
||||
if (null == session) {
|
||||
logger.info("session 是空的");
|
||||
return null;
|
||||
}
|
||||
session.setAttribute(LoginUtil.LOGIN_USER_SESSION_KEY, appUser);
|
||||
return appUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录状态保存到redis
|
||||
* 会重新设置token
|
||||
*
|
||||
* @param appUser
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static AppUser saveInCache(AppUser appUser, HttpServletRequest request) {
|
||||
appUser.setToken(UuidUtils.uuid());
|
||||
refreshCache(appUser, request);
|
||||
// 保存token和用户的关系, 是个 set
|
||||
String appUsernameByTokenSetKey = RedisKeys.getAppUsernameByTokenSetKey(appUser.getUsername());
|
||||
SetOperations<String, String> setOps = redisTemplate.opsForSet();
|
||||
setOps.add(appUsernameByTokenSetKey, appUser.getToken());
|
||||
// 清除set中的过期token, 避免set过大
|
||||
clearUserTokenSet(appUsernameByTokenSetKey);
|
||||
return appUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除用户的登录token set避免过大
|
||||
*
|
||||
* @param appUsernameByTokenSetKey
|
||||
*/
|
||||
private static void clearUserTokenSet(String appUsernameByTokenSetKey) {
|
||||
THREAD_POOL_EXECUTOR.submit(() -> {
|
||||
SetOperations<String, String> setOps = redisTemplate.opsForSet();
|
||||
Set<String> tokenSet = setOps.members(appUsernameByTokenSetKey);
|
||||
if (CollectionUtils.isEmpty(tokenSet)) {
|
||||
return;
|
||||
}
|
||||
tokenSet.forEach(token -> {
|
||||
String appUserSessionKey = RedisKeys.getAppUserSessionKey(token);
|
||||
Long expire = redisTemplate.getExpire(appUserSessionKey);
|
||||
if (null == expire || expire < 0) {
|
||||
logger.info("删除过期key {}", token);
|
||||
setOps.remove(appUsernameByTokenSetKey, token);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void setRedisTemplate(RedisTemplate redisTemplate) {
|
||||
LoginUtil.redisTemplate = redisTemplate;
|
||||
LoginUtil.valueOps = redisTemplate.opsForValue();
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.arm.equipment.system.api.vo.user;
|
||||
|
||||
public class RefreshTokenVO {
|
||||
/** 手机号 */
|
||||
private String data;
|
||||
/** 平台 */
|
||||
private Integer platform;
|
||||
|
||||
public Integer getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(Integer platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package com.arm.equipment.system.api.vo.user;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* 编辑用户信息VO
|
||||
* @author: xly
|
||||
* @time: 2022/9/19 12:00
|
||||
*/
|
||||
public class UpdateUserVO {
|
||||
/** 生日 */
|
||||
private Date birthday;
|
||||
/** 昵称 */
|
||||
private String nickname;
|
||||
/** 性别 1 男 2 女 */
|
||||
private Integer genderCode;
|
||||
/** 所在地址 */
|
||||
private String address;
|
||||
/** 学历 */
|
||||
private String education;
|
||||
/**头像 */
|
||||
private String avatarPath;
|
||||
|
||||
public String getAvatarPath() {
|
||||
return avatarPath;
|
||||
}
|
||||
|
||||
public void setAvatarPath(String avatarPath) {
|
||||
this.avatarPath = avatarPath;
|
||||
}
|
||||
|
||||
public Date getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(Date birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
public Integer getGenderCode() {
|
||||
return genderCode;
|
||||
}
|
||||
|
||||
public void setGenderCode(Integer genderCode) {
|
||||
this.genderCode = genderCode;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getEducation() {
|
||||
return education;
|
||||
}
|
||||
|
||||
public void setEducation(String education) {
|
||||
this.education = education;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.arm.equipment.system.api.vo.user;
|
||||
|
||||
/**
|
||||
* 用户中心VO
|
||||
* @author: xly
|
||||
* @time: 2021/11/19 17:41
|
||||
*/
|
||||
public class UserCenterVO {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 由于微兔眼小程序只统计爆料评论的总数 所以这里由此类型
|
||||
* 请求类型 type (0 智能农机云 1 微兔眼小程序)
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
package com.arm.equipment.system.api.vo.user;
|
||||
|
||||
/**
|
||||
* 用户登录信息VO
|
||||
*
|
||||
* @author ousei
|
||||
* @date 2020年11月4日15:17:48
|
||||
*/
|
||||
public class UserLoginVO {
|
||||
/** 手机号 */
|
||||
private String username;
|
||||
/** 验证码 */
|
||||
private String verifyCode;
|
||||
/** 设备TOKEN */
|
||||
private String deviceToken;
|
||||
/** unionid */
|
||||
private String unionid;
|
||||
/** 登录的类型 */
|
||||
private Integer loginType;
|
||||
/**用户密码*/
|
||||
private String password;
|
||||
/**平台*/
|
||||
private Integer platform;
|
||||
/**邀请码*/
|
||||
private String invcode;
|
||||
/**微信code**/
|
||||
private String code;
|
||||
/**一键登录手机号token*/
|
||||
private String usernameToken;
|
||||
|
||||
public String getUsernameToken() {
|
||||
return usernameToken;
|
||||
}
|
||||
|
||||
public void setUsernameToken(String usernameToken) {
|
||||
this.usernameToken = usernameToken;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public Integer getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(Integer platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public String getInvcode() {
|
||||
return invcode;
|
||||
}
|
||||
|
||||
public void setInvcode(String invcode) {
|
||||
this.invcode = invcode;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Integer getLoginType() {
|
||||
return loginType;
|
||||
}
|
||||
|
||||
public void setLoginType(Integer loginType) {
|
||||
this.loginType = loginType;
|
||||
}
|
||||
|
||||
public String getUnionid() {
|
||||
return unionid;
|
||||
}
|
||||
|
||||
public void setUnionid(String unionid) {
|
||||
this.unionid = unionid;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getVerifyCode() {
|
||||
return verifyCode;
|
||||
}
|
||||
|
||||
public void setVerifyCode(String verifyCode) {
|
||||
this.verifyCode = verifyCode;
|
||||
}
|
||||
|
||||
public String getDeviceToken() {
|
||||
return deviceToken;
|
||||
}
|
||||
|
||||
public void setDeviceToken(String deviceToken) {
|
||||
this.deviceToken = deviceToken;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
env: dev
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/arm-equipment-system?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
username: root
|
||||
password:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
auto-commit: true
|
||||
connection-timeout: 30000
|
||||
idle-timeout: 600000
|
||||
max-lifetime: 1800000
|
||||
minimum-idle: 1
|
||||
maximum-pool-size: 10
|
||||
pool-name: hikaricp
|
||||
validation-timeout: 5000
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
database: 0
|
||||
timeout: 5000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-idle: 100
|
||||
min-idle: 1
|
||||
max-active: 1000
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:admin/src/main/resources/static
|
@ -1,21 +0,0 @@
|
||||
git:
|
||||
version: "@git.commit.id.abbrev@"
|
||||
commitTime: "@git.commit.time@"
|
||||
server:
|
||||
port: 8088
|
||||
compression:
|
||||
enabled: true
|
||||
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
|
||||
spring:
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: true
|
||||
output:
|
||||
ansi:
|
||||
enabled: always
|
||||
webflux:
|
||||
static-path-pattern: /**
|
||||
session:
|
||||
store-type: redis
|
||||
profiles:
|
||||
active: dev
|
@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
<substitutionProperty name="log.base" value="logs/app" />
|
||||
|
||||
<springProfile name="dev">
|
||||
<logger name="com.arm.equipment.system" level="debug" additivity="false">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
</springProfile>
|
||||
|
||||
<springProfile name="prod,test">
|
||||
<appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${log.base}.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<cleanHistoryOnStart>true</cleanHistoryOnStart>
|
||||
<maxHistory>30</maxHistory>
|
||||
<FileNamePattern>
|
||||
${log.base}.%d{yyyy-MM-dd}.log
|
||||
</FileNamePattern>
|
||||
</rollingPolicy>
|
||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||
<pattern>
|
||||
%date [%thread] %-5level %logger{80} - %msg%n
|
||||
</pattern>
|
||||
</layout>
|
||||
</appender>
|
||||
<logger name="io.swagger.models.parameters.AbstractSerializableParameter" level="error" additivity="false">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="logfile" />
|
||||
</logger>
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="logfile" />
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
|
@ -1,22 +0,0 @@
|
||||
package com.arm.equipment.system.api;
|
||||
|
||||
import com.arm.equipment.system.api.app.ApiApplication;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(classes = ApiApplication.class)
|
||||
@ActiveProfiles(profiles = "dev")
|
||||
public class ApiApplicationTests {
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(ApiApplicationTests.class);
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
}
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.arm.equipment.system</groupId>
|
||||
<artifactId>arm-equipment-system-parent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>data</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>data</name>
|
||||
<description>业务公共项目</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk16</artifactId>
|
||||
<version>1.46</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 生成器依赖velocity -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>5.2.0.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<!--jsoup解析html-->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.13.1</version>
|
||||
</dependency>
|
||||
<!--拼英工具类-->
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>4.0.1</version>
|
||||
</dependency>
|
||||
<!-- zxing二维码生成工具类 -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>16.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@ -1,25 +0,0 @@
|
||||
package com.arm.equipment.system.data.app;
|
||||
|
||||
import com.arm.equipment.system.data.util.passwordEncoder.BCryptPasswordEncoderUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author: admin
|
||||
* @time: 2022/9/16 11:20
|
||||
*/
|
||||
@Configuration
|
||||
public class BCryptConfiguration {
|
||||
|
||||
/**
|
||||
* BCrypt密码校验
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public BCryptPasswordEncoderUtils bCryptPasswordEncoder() {
|
||||
return new BCryptPasswordEncoderUtils(5, null);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.arm.equipment.system.data.app;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@ComponentScan("com.arm.equipment.system")
|
||||
public class DataApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package com.arm.equipment.system.data.app;
|
||||
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
/**
|
||||
* mybatis配置
|
||||
* @author admin
|
||||
*/
|
||||
@MapperScan("com.arm.equipment.system.data.mapper")
|
||||
@Configuration
|
||||
public class MyBatisConfiguration {
|
||||
|
||||
@Bean(name = "sessionFactory")
|
||||
public SqlSessionFactory sessionFactory(HikariDataSource dataSource) {
|
||||
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setDatabaseIdProvider(new VendorDatabaseIdProvider());
|
||||
bean.setTypeHandlersPackage("com.arm.equipment.system.data.mybatis.type");
|
||||
|
||||
//添加XML目录
|
||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
try {
|
||||
//设置xml扫描路径
|
||||
Resource[] baseMapperResource = resolver.getResources("classpath*:/mybatis/base-mapper.xml");
|
||||
Resource[] resources = resolver.getResources("classpath*:/mybatis/**/*.xml");
|
||||
bean.setMapperLocations(ArrayUtils.addAll(resources, resources));
|
||||
return bean.getObject();
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("sessionFactory init fail",e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置事务管理器
|
||||
*/
|
||||
@Bean(name = "transactionManager")
|
||||
public DataSourceTransactionManager transactionManager(HikariDataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
}
|
@ -1,174 +0,0 @@
|
||||
package com.arm.equipment.system.data.app;
|
||||
|
||||
import com.arm.equipment.system.data.constant.RedisKeys;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
||||
import org.springframework.boot.context.event.ApplicationStartedEvent;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.cache.RedisCacheWriter;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
|
||||
import org.springframework.data.redis.connection.stream.MapRecord;
|
||||
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.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* redis 配置
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Configuration
|
||||
public class RedisConfiguration implements ApplicationListener<ApplicationEvent> {
|
||||
@Autowired
|
||||
private RedisProperties redisProperties;
|
||||
/**
|
||||
* 100个线程, 无界队列, 超过异常
|
||||
*/
|
||||
private final static ThreadPoolExecutor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(100, 100, 120, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
/**
|
||||
* lettuce对象连接池
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public LettuceConnectionFactory lettuceConnectionFactory() {
|
||||
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration();
|
||||
configuration.setHostName(redisProperties.getHost());
|
||||
configuration.setDatabase(redisProperties.getDatabase());
|
||||
configuration.setPort(redisProperties.getPort());
|
||||
configuration.setPassword(redisProperties.getPassword());
|
||||
//连接池配置
|
||||
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
|
||||
RedisProperties.Pool pool = redisProperties.getLettuce().getPool();
|
||||
poolConfig.setMaxIdle(20);
|
||||
poolConfig.setMinIdle(1);
|
||||
poolConfig.setMaxTotal(100);
|
||||
poolConfig.setMaxWaitMillis(3000);
|
||||
poolConfig.setTimeBetweenEvictionRunsMillis(20000);
|
||||
poolConfig.setTestWhileIdle(true);
|
||||
LettucePoolingClientConfiguration clientConfiguration = LettucePoolingClientConfiguration.builder()
|
||||
.commandTimeout(Duration.ofSeconds(10))
|
||||
.poolConfig(poolConfig).build();
|
||||
return new LettuceConnectionFactory(configuration, clientConfiguration);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisTemplate getTemplate(@Qualifier(value = "redisTemplate") RedisTemplate template) {
|
||||
template.setConnectionFactory(lettuceConnectionFactory());
|
||||
template.setDefaultSerializer(new StringRedisSerializer());
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
template.setValueSerializer(new StringRedisSerializer());
|
||||
template.setHashKeySerializer(new GenericJackson2JsonRedisSerializer());
|
||||
template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
return template;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存管理器
|
||||
* 1.默认缓存为1天
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
public RedisCacheManager cacheManager() {
|
||||
RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(lettuceConnectionFactory());
|
||||
GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig()
|
||||
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.string()))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(genericJackson2JsonRedisSerializer))
|
||||
.entryTtl(Duration.ofDays(1));
|
||||
RedisCacheManager redisCacheManager = RedisCacheManager.builder(redisCacheWriter)
|
||||
.cacheDefaults(redisCacheConfiguration)
|
||||
.withInitialCacheConfigurations(getRedisCacheConfigurationMap()).build();
|
||||
return redisCacheManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为指定 key 设置过期时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Map<String, RedisCacheConfiguration> getRedisCacheConfigurationMap() {
|
||||
Map<String, RedisCacheConfiguration> redisCacheConfigurationMap = new HashMap<>();
|
||||
redisCacheConfigurationMap.put(RedisKeys.WECHAT_ACCESS_TOKEN, getRedisCacheConfigurationWithTtl(600));
|
||||
// 直播间统计ID集合 默认保存七天
|
||||
return redisCacheConfigurationMap;
|
||||
}
|
||||
|
||||
private RedisCacheConfiguration getRedisCacheConfigurationWithTtl(Integer seconds) {
|
||||
GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
return RedisCacheConfiguration.defaultCacheConfig()
|
||||
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(RedisSerializer.string()))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(genericJackson2JsonRedisSerializer))
|
||||
.computePrefixWith(name -> name + ":").entryTtl(Duration.ofSeconds(seconds));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 流监听容器, 这里只是创建, 需要在下面启动
|
||||
*
|
||||
* @param redisConnectionFactory
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public StreamMessageListenerContainer<String, MapRecord<String, String, String>> streamMessageListenerContainer(RedisConnectionFactory redisConnectionFactory) {
|
||||
// 创建配置对象
|
||||
StreamMessageListenerContainer.StreamMessageListenerContainerOptions<String, MapRecord<String, String, String>> listenerContainerOptions = StreamMessageListenerContainer.StreamMessageListenerContainerOptions
|
||||
.builder()
|
||||
// 一次性最多拉取多少条消息
|
||||
.batchSize(100)
|
||||
.executor(THREAD_POOL_EXECUTOR)
|
||||
.build();
|
||||
// 根据配置对象创建监听容器
|
||||
|
||||
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = StreamMessageListenerContainer.create(redisConnectionFactory, listenerContainerOptions);
|
||||
return listenerContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1.spring启动后启动redis监听容器
|
||||
* 2.spring结束后关闭redis监听容器
|
||||
*
|
||||
* @param applicationEvent
|
||||
*/
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent applicationEvent) {
|
||||
if (applicationEvent instanceof ApplicationStartedEvent) {
|
||||
// 启动redis stream 监听
|
||||
((ApplicationStartedEvent) applicationEvent).getApplicationContext()
|
||||
.getBeanProvider(StreamMessageListenerContainer.class)
|
||||
.ifAvailable(Lifecycle::start);
|
||||
}
|
||||
if (applicationEvent instanceof ContextClosedEvent) {
|
||||
// 启动redis stream 监听
|
||||
((ContextClosedEvent) applicationEvent).getApplicationContext()
|
||||
.getBeanProvider(StreamMessageListenerContainer.class)
|
||||
.ifAvailable(Lifecycle::stop);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package com.arm.equipment.system.data.app;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.FormHttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class RestTemplateConfiguration {
|
||||
@Bean(name = "restTemplate")
|
||||
public RestTemplate getRestTemplate() {
|
||||
List messageConverters = new ArrayList<>();
|
||||
messageConverters.add(new FormHttpMessageConverter());
|
||||
messageConverters.add(getFastJsonHttpMessageConverter());
|
||||
messageConverters.add(new StringHttpMessageConverter());
|
||||
RestTemplate restTemplate = new RestTemplate(getHttpRequestFactory());
|
||||
restTemplate.setMessageConverters(messageConverters);
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
private FastJsonHttpMessageConverter getFastJsonHttpMessageConverter() {
|
||||
FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
|
||||
fastJsonHttpMessageConverter.setFastJsonConfig(getFastJsonConfig());
|
||||
return fastJsonHttpMessageConverter;
|
||||
}
|
||||
|
||||
private FastJsonConfig getFastJsonConfig() {
|
||||
FastJsonConfig fastJsonConfig = new FastJsonConfig();
|
||||
fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteDateUseDateFormat);
|
||||
return fastJsonConfig;
|
||||
}
|
||||
|
||||
private SimpleClientHttpRequestFactory getHttpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory simpleClientHttpRequestFactory = new SimpleClientHttpRequestFactory();
|
||||
simpleClientHttpRequestFactory.setConnectTimeout(120000);
|
||||
simpleClientHttpRequestFactory.setReadTimeout(120000);
|
||||
return simpleClientHttpRequestFactory;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.arm.equipment.system.data.constant;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全局变量存放处
|
||||
* @author wyd
|
||||
*/
|
||||
public class ConstantValues {
|
||||
/** request请求中的参数 */
|
||||
public final static String REQUEST_BODY = "WJ-Request-Body";
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.arm.equipment.system.data.constant;
|
||||
|
||||
/**
|
||||
* redisKey集合
|
||||
*/
|
||||
public class RedisKeys {
|
||||
public final static String SYS_BASE_PARAM_KEY = "sysBaseParamKey";
|
||||
/** * 微信accesstoken*/
|
||||
public final static String WECHAT_ACCESS_TOKEN = "wechatAccessToken";
|
||||
/*** id worker service中的worker id*/
|
||||
public static final String SNOW_FLAKE_WORKER_ID = "snow:flake_worker:id";
|
||||
/**系统用户登陆错误次数*/
|
||||
public static final String SYS_USER_LOGIN_ERROR_NUM = "sys:user:login:error:num:%s";
|
||||
/**
|
||||
* token和用户的对应关系
|
||||
* <p>
|
||||
* 数据结构: SET
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public static String getAppUsernameByTokenSetKey(String token) {
|
||||
return String.format("app:user:token:%s", token);
|
||||
}
|
||||
|
||||
public static String getAppUserSessionKey(String token) {
|
||||
return String.format("app:user:session:%s", token);
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 数据库实体基类
|
||||
* @author admin
|
||||
*/
|
||||
public class BaseDomain extends BasePage {
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
/** 更新时间结束 */
|
||||
private Date updateTimeEnd;
|
||||
/** 操作人*/
|
||||
private String operator;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getCreateTime() { return createTime; }
|
||||
|
||||
public void setCreateTime(Date createTime) { this.createTime = createTime; }
|
||||
|
||||
public Date getUpdateTime() { return updateTime; }
|
||||
|
||||
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
|
||||
|
||||
public Date getUpdateTimeEnd() { return updateTimeEnd; }
|
||||
|
||||
public void setUpdateTimeEnd(Date updateTimeEnd) { this.updateTimeEnd = updateTimeEnd; }
|
||||
|
||||
public String getRemark() { return remark; }
|
||||
|
||||
public void setRemark(String remark) { this.remark = remark; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BaseDomain{" +
|
||||
"id=" + id +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
", updateTimeEnd=" + updateTimeEnd +
|
||||
", remark='" + remark + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*/
|
||||
public class PageResult {
|
||||
/** 页数 */
|
||||
private int pageNo;
|
||||
/** 总页数 */
|
||||
private int pageCount;
|
||||
/** 总条数 */
|
||||
private int total;
|
||||
/** 数据 */
|
||||
private Collection<?> rows;
|
||||
/** 页大小 */
|
||||
private int pageSize;
|
||||
|
||||
public PageResult() {
|
||||
}
|
||||
|
||||
public PageResult(int pageNo, int pageSize, int total, Collection<?> rows) {
|
||||
this.pageNo = pageNo;
|
||||
this.total = total;
|
||||
this.rows = rows;
|
||||
this.pageSize = pageSize;
|
||||
this.pageCount = calcPageCount(total);
|
||||
|
||||
}
|
||||
|
||||
private int calcPageCount(int count) {
|
||||
if (pageSize == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (count % pageSize == 0) {
|
||||
return count / pageSize;
|
||||
} else {
|
||||
return count / pageSize + 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPageCount(int count, int pageSize) {
|
||||
if (pageSize == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (count % pageSize == 0) {
|
||||
return count / pageSize;
|
||||
} else {
|
||||
return count / pageSize + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public void setPageNo(int pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
return pageCount;
|
||||
}
|
||||
|
||||
public void setPageCount(int pageCount) {
|
||||
this.pageCount = pageCount;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Collection<?> getRows() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(Collection<?> rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
/**
|
||||
* 系统--基础参数
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2021年10月26日 16:36:52
|
||||
*/
|
||||
public class SysBaseParam extends BaseDomain {
|
||||
/** 唯一编码 */
|
||||
private String uniCode;
|
||||
/** 值 */
|
||||
private String value;
|
||||
/** 描述 */
|
||||
private String description;
|
||||
/** 操作人 */
|
||||
private String operator;
|
||||
/** 数据状态 */
|
||||
private Integer status;
|
||||
|
||||
public String getUniCode() {
|
||||
return uniCode;
|
||||
}
|
||||
|
||||
public void setUniCode(String uniCode) {
|
||||
this.uniCode = uniCode;
|
||||
}
|
||||
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
@ -1,166 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--权限表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月20日 08:59:10
|
||||
*/
|
||||
public class SysResource extends BaseDomain {
|
||||
/** 菜单名称 */
|
||||
private String name;
|
||||
/** 链接地址 */
|
||||
private String url;
|
||||
/** 父菜单ID */
|
||||
private String parentId;
|
||||
/** 图标 */
|
||||
private String icon;
|
||||
/** 排序 */
|
||||
private Integer sort;
|
||||
/** 菜单类型 */
|
||||
private Integer type;
|
||||
/** 权限标识 */
|
||||
private String identity;
|
||||
/** 是否显示 */
|
||||
private Integer isShow;
|
||||
/** 状态 */
|
||||
private Integer status;
|
||||
/** 操作人 */
|
||||
private String operator;
|
||||
/** 根路径,用.分隔 */
|
||||
private String rootPath;
|
||||
|
||||
/********VO******/
|
||||
/**子集集合*/
|
||||
private List<SysResource> children;
|
||||
/**标签*/
|
||||
private String label;
|
||||
/**ID集合*/
|
||||
private List<Long> idsList;
|
||||
|
||||
public List<Long> getIdsList() {
|
||||
return idsList;
|
||||
}
|
||||
|
||||
public void setIdsList(List<Long> idsList) {
|
||||
this.idsList = idsList;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
|
||||
public Integer getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public void setIsShow(Integer isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
|
||||
public String getRootPath() {
|
||||
return rootPath;
|
||||
}
|
||||
|
||||
public void setRootPath(String rootPath) {
|
||||
this.rootPath = rootPath;
|
||||
}
|
||||
|
||||
public List<SysResource> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysResource> children) {
|
||||
this.children = children;
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--角色表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:47
|
||||
*/
|
||||
public class SysRole extends BaseDomain {
|
||||
/** 角色名称 */
|
||||
private String name;
|
||||
/** 描述 */
|
||||
private String description;
|
||||
/** 状态 */
|
||||
private Integer status;
|
||||
/** 操作人 */
|
||||
private String operator;
|
||||
|
||||
/****** VO ***/
|
||||
/**角色ID集合*/
|
||||
private List<Long> sysRoleIdList;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public List<Long> getSysRoleIdList() {
|
||||
return sysRoleIdList;
|
||||
}
|
||||
|
||||
public void setSysRoleIdList(List<Long> sysRoleIdList) {
|
||||
this.sysRoleIdList = sysRoleIdList;
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统-角色权限关联表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:41
|
||||
*/
|
||||
public class SysRoleResource extends BaseDomain {
|
||||
/** 角色ID */
|
||||
private Long sysRoleId;
|
||||
/** 权限ID */
|
||||
private Long sysResourceId;
|
||||
/** 状态 */
|
||||
private Integer status;
|
||||
/** 操作人 */
|
||||
private String operator;
|
||||
|
||||
/****** VO ***/
|
||||
/**添加新权限(修改权限)*/
|
||||
private List<String> newResources;
|
||||
|
||||
public List<String> getNewResources() {
|
||||
return newResources;
|
||||
}
|
||||
|
||||
public void setNewResources(List<String> newResources) {
|
||||
this.newResources = newResources;
|
||||
}
|
||||
|
||||
public Long getSysRoleId() {
|
||||
return sysRoleId;
|
||||
}
|
||||
|
||||
public void setSysRoleId(Long sysRoleId) {
|
||||
this.sysRoleId = sysRoleId;
|
||||
}
|
||||
|
||||
|
||||
public Long getSysResourceId() {
|
||||
return sysResourceId;
|
||||
}
|
||||
|
||||
public void setSysResourceId(Long sysResourceId) {
|
||||
this.sysResourceId = sysResourceId;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--用户表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:07:06
|
||||
*/
|
||||
public class SysUser extends BaseDomain {
|
||||
/** 用户名 */
|
||||
private String username;
|
||||
/** 密码 */
|
||||
private String password;
|
||||
/** 手机 */
|
||||
private String phone;
|
||||
/** 姓名 */
|
||||
private String name;
|
||||
/** 邮箱 */
|
||||
private String email;
|
||||
/**
|
||||
* 用户标签
|
||||
* @see
|
||||
* */
|
||||
private String tag;
|
||||
/** 状态 */
|
||||
private Integer status;
|
||||
/**是否需要二次登陆*/
|
||||
private Integer isSecondLanding;
|
||||
|
||||
/******VO****/
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
private String verifyCode;
|
||||
/**
|
||||
* 角色信息
|
||||
*/
|
||||
private List<SysRole> sysRoleList;
|
||||
/**
|
||||
* 用户菜单标识信息
|
||||
*/
|
||||
private List<String> sysResourceIdentityList;
|
||||
/**
|
||||
* 用户菜单列表
|
||||
*/
|
||||
private List<SysResource> sysResourceList;
|
||||
/**标签集合*/
|
||||
private List<String> tagList;
|
||||
/**二次登陆验证码*/
|
||||
private String twoVerifyCode;
|
||||
|
||||
public String getTwoVerifyCode() {
|
||||
return twoVerifyCode;
|
||||
}
|
||||
|
||||
public void setTwoVerifyCode(String twoVerifyCode) {
|
||||
this.twoVerifyCode = twoVerifyCode;
|
||||
}
|
||||
|
||||
public Integer getIsSecondLanding() {
|
||||
return isSecondLanding;
|
||||
}
|
||||
|
||||
public void setIsSecondLanding(Integer isSecondLanding) {
|
||||
this.isSecondLanding = isSecondLanding;
|
||||
}
|
||||
|
||||
public List<String> getTagList() {
|
||||
return tagList;
|
||||
}
|
||||
|
||||
public void setTagList(List<String> tagList) {
|
||||
this.tagList = tagList;
|
||||
}
|
||||
|
||||
public String getVerifyCode() {
|
||||
return verifyCode;
|
||||
}
|
||||
|
||||
public void setVerifyCode(String verifyCode) {
|
||||
this.verifyCode = verifyCode;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public List<SysRole> getSysRoleList() {
|
||||
return sysRoleList;
|
||||
}
|
||||
|
||||
public void setSysRoleList(List<SysRole> sysRoleList) {
|
||||
this.sysRoleList = sysRoleList;
|
||||
}
|
||||
|
||||
public List<String> getSysResourceIdentityList() {
|
||||
return sysResourceIdentityList;
|
||||
}
|
||||
|
||||
public void setSysResourceIdentityList(List<String> sysResourceIdentityList) {
|
||||
this.sysResourceIdentityList = sysResourceIdentityList;
|
||||
}
|
||||
|
||||
public List<SysResource> getSysResourceList() {
|
||||
return sysResourceList;
|
||||
}
|
||||
|
||||
public void setSysResourceList(List<SysResource> sysResourceList) {
|
||||
this.sysResourceList = sysResourceList;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
/**
|
||||
* 系统--用户角色关联表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2021年10月19日 15:06:59
|
||||
*/
|
||||
public class SysUserRole extends BaseDomain {
|
||||
/** 角色ID */
|
||||
private Long sysRoleId;
|
||||
/** 用户ID */
|
||||
private Long sysUserId;
|
||||
/** 状态 */
|
||||
private Integer status;
|
||||
/** 执行者 */
|
||||
private String operator;
|
||||
|
||||
public Long getSysRoleId() {
|
||||
return sysRoleId;
|
||||
}
|
||||
|
||||
public void setSysRoleId(Long sysRoleId) {
|
||||
this.sysRoleId = sysRoleId;
|
||||
}
|
||||
|
||||
|
||||
public Long getSysUserId() {
|
||||
return sysUserId;
|
||||
}
|
||||
|
||||
public void setSysUserId(Long sysUserId) {
|
||||
this.sysUserId = sysUserId;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(String operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.user;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* APP用户
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月13日 22:34:47
|
||||
*/
|
||||
public class AppUser extends BaseDomain {
|
||||
/** 用户昵称 */
|
||||
private String nickname;
|
||||
/** 登录账号 */
|
||||
private String username;
|
||||
/** 密码 */
|
||||
private String password;
|
||||
/** 手机号 */
|
||||
private String phone;
|
||||
/** 数据状态 */
|
||||
private Integer status;
|
||||
/** 登录时间 */
|
||||
private Date loginTime;
|
||||
|
||||
private String token;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
public Date getLoginTime() {
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(Date loginTime) {
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package com.arm.equipment.system.data.domain.weaponry;
|
||||
|
||||
import com.arm.equipment.system.data.domain.BaseDomain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 装备武器归还记录
|
||||
*
|
||||
* @author admin
|
||||
* @date 2023年03月23日 11:03:25
|
||||
*/
|
||||
public class WeaponryReturnRecord extends BaseDomain {
|
||||
/** 武器ID */
|
||||
private Long weaponryId;
|
||||
/** 武器名称 */
|
||||
private String weaponryName;
|
||||
/** 记录ID */
|
||||
private Long lendRecordId;
|
||||
/** 借出数量 */
|
||||
private Integer num;
|
||||
/** 归还时间 */
|
||||
private Date returnTime;
|
||||
/** 数据状态 */
|
||||
private Integer status;
|
||||
|
||||
/****************VO**************/
|
||||
private Weaponry weaponry;
|
||||
|
||||
public Weaponry getWeaponry() {
|
||||
return weaponry;
|
||||
}
|
||||
|
||||
public void setWeaponry(Weaponry weaponry) {
|
||||
this.weaponry = weaponry;
|
||||
}
|
||||
|
||||
public Long getWeaponryId() {
|
||||
return weaponryId;
|
||||
}
|
||||
|
||||
public void setWeaponryId(Long weaponryId) {
|
||||
this.weaponryId = weaponryId;
|
||||
}
|
||||
|
||||
|
||||
public String getWeaponryName() {
|
||||
return weaponryName;
|
||||
}
|
||||
|
||||
public void setWeaponryName(String weaponryName) {
|
||||
this.weaponryName = weaponryName;
|
||||
}
|
||||
|
||||
|
||||
public Long getLendRecordId() {
|
||||
return lendRecordId;
|
||||
}
|
||||
|
||||
public void setLendRecordId(Long lendRecordId) {
|
||||
this.lendRecordId = lendRecordId;
|
||||
}
|
||||
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
|
||||
public Date getReturnTime() {
|
||||
return returnTime;
|
||||
}
|
||||
|
||||
public void setReturnTime(Date returnTime) {
|
||||
this.returnTime = returnTime;
|
||||
}
|
||||
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/***
|
||||
*
|
||||
* 资源文件类型
|
||||
* @author: admin
|
||||
* @time: 2021/11/17 17:35
|
||||
*/
|
||||
public enum EnumFileResourceType {
|
||||
/** */
|
||||
IMG(1, "图片"),
|
||||
VIDEO(2, "视频"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumFileResourceType(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}}
|
@ -1,51 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
import com.arm.equipment.system.data.exception.BusinessException;
|
||||
|
||||
/**
|
||||
* 数据状态枚举
|
||||
* @author admin
|
||||
*/
|
||||
public enum EnumGender {
|
||||
/** 审核 */
|
||||
MALE(1, "男"),
|
||||
|
||||
/** The release. */
|
||||
FEMALE(2, "女"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumGender(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public static EnumGender getByCode(Integer code) {
|
||||
if (null == code) {
|
||||
return null;
|
||||
}
|
||||
for (EnumGender type : EnumGender.values()) {
|
||||
if (type.getCode().equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
throw new BusinessException("内容类型非法");
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}}
|
@ -1,51 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* 排序类型
|
||||
*
|
||||
* @author: xly
|
||||
* @time: 2022/9/16 18:30
|
||||
*/
|
||||
public enum EnumSortType {
|
||||
ASC(1, "升序"),
|
||||
DESC(2, "降序"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumSortType(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
|
||||
public static EnumSortType getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
EnumSortType[] values = EnumSortType.values();
|
||||
for (EnumSortType v : values) {
|
||||
if (v.getCode().equals(code)) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* 数据状态枚举
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public enum EnumStatus {
|
||||
/**
|
||||
* The new.
|
||||
*/
|
||||
NEW(0, "新增"),
|
||||
|
||||
AUDIT(1, "已审核"),
|
||||
|
||||
DEL(-9, "已删除");
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
EnumStatus(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获得该枚举类型
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static EnumStatus getByCode(Integer code) {
|
||||
EnumStatus[] values = EnumStatus.values();
|
||||
for (EnumStatus type : values) {
|
||||
if (type.code.equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return NEW;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* 数据状态枚举
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
public enum EnumSysLogType {
|
||||
/**
|
||||
* The new.
|
||||
*/
|
||||
LOG(1, "普通日志"),
|
||||
|
||||
EXCEPTION_LOG(2, "异常日志"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumSysLogType(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获得该枚举类型
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static EnumSysLogType getByCode(Integer code) {
|
||||
EnumSysLogType[] values = EnumSysLogType.values();
|
||||
for (EnumSysLogType type : values) {
|
||||
if (type.code.equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* 系统资源菜单类型
|
||||
*
|
||||
* @author: admin
|
||||
* @time: 2021/10/19 18:02
|
||||
*/
|
||||
public enum EnumSysResourceType {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
CATALOGUE(0, "目录"),
|
||||
MENU(1, "菜单"),
|
||||
BUTTON(2, "按钮"),
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumSysResourceType(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* @author: xly
|
||||
* @time: 2023/3/23 9:02
|
||||
*/
|
||||
public enum EnumWeaponryLendRecordReturnStatus {
|
||||
NOT_RETURN(0, "未归还"),
|
||||
RETURN(1, "已经归还"),
|
||||
;
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumWeaponryLendRecordReturnStatus(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获得该枚举类型
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static EnumSysLogType getByCode(Integer code) {
|
||||
EnumSysLogType[] values = EnumSysLogType.values();
|
||||
for (EnumSysLogType type : values) {
|
||||
if (type.getCode().equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* @author: xly
|
||||
* @time: 2023/3/23 9:02
|
||||
*/
|
||||
public enum EnumWeaponryLendRecordStatus {
|
||||
NEW(0, "新增"),
|
||||
ADOPT(1, "通过"),
|
||||
REFUSE(2, "拒绝"),
|
||||
;
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumWeaponryLendRecordStatus(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获得该枚举类型
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static EnumSysLogType getByCode(Integer code) {
|
||||
EnumSysLogType[] values = EnumSysLogType.values();
|
||||
for (EnumSysLogType type : values) {
|
||||
if (type.getCode().equals(code)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package com.arm.equipment.system.data.enums.dict;
|
||||
|
||||
/**
|
||||
* yes no枚举
|
||||
* @author admin
|
||||
*/
|
||||
public enum EnumYesNo {
|
||||
/** */
|
||||
NO(0, "否"),
|
||||
|
||||
YES(1, "是")
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
private String text;
|
||||
|
||||
EnumYesNo(Integer code, String text) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}}
|
@ -1,62 +0,0 @@
|
||||
package com.arm.equipment.system.data.exception;
|
||||
|
||||
import com.arm.equipment.system.data.vo.ReturnCode;
|
||||
|
||||
/**
|
||||
* @author 向帅 用户登录异常
|
||||
* @Date 2019/7/27 17:11
|
||||
**/
|
||||
public class AuthException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -7429924842303522242L;
|
||||
|
||||
String message;
|
||||
|
||||
ReturnCode returnCode;
|
||||
|
||||
public AuthException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AuthException(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AuthException(ReturnCode returnCode) {
|
||||
this.returnCode = returnCode;
|
||||
}
|
||||
|
||||
public AuthException(String message, ReturnCode returnCode) {
|
||||
this.message = message;
|
||||
this.returnCode = returnCode;
|
||||
}
|
||||
|
||||
public AuthException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public AuthException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
protected AuthException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ReturnCode getReturnCode() {
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
public void setReturnCode(ReturnCode returnCode) {
|
||||
this.returnCode = returnCode;
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
package com.arm.equipment.system.data.mapper.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.system.SysBaseParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统--基础参数
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2021年10月26日 16:36:52
|
||||
*/
|
||||
public interface ISysBaseParamMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param sysBaseParam sysBaseParam
|
||||
* @return int
|
||||
*/
|
||||
int insertSelective(SysBaseParam sysBaseParam);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param setParam setParam
|
||||
* @param whereParam whereParam
|
||||
* @return int
|
||||
*/
|
||||
int updateSelective(SysBaseParam setParam, SysBaseParam whereParam);
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*
|
||||
* @param sysBaseParam sysBaseParam
|
||||
* @return int
|
||||
*/
|
||||
int getCount(SysBaseParam sysBaseParam);
|
||||
|
||||
/**
|
||||
* 单条
|
||||
*
|
||||
* @param sysBaseParam sysBaseParam
|
||||
* @return SysBaseParam
|
||||
*/
|
||||
SysBaseParam getOne(SysBaseParam sysBaseParam);
|
||||
|
||||
/**
|
||||
* 多条
|
||||
*
|
||||
* @param sysBaseParam sysBaseParam
|
||||
* @return List<SysBaseParam>
|
||||
*/
|
||||
List<SysBaseParam> getList(SysBaseParam sysBaseParam);
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param sysBaseParam sysBaseParam
|
||||
* @return List<SysBaseParam>
|
||||
*/
|
||||
List<SysBaseParam> getPageList(SysBaseParam sysBaseParam);
|
||||
|
||||
/**
|
||||
* 根据ID删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int delete(String id);
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package com.arm.equipment.system.data.mapper.system;
|
||||
|
||||
import com.arm.equipment.system.data.domain.system.SysLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志表
|
||||
*
|
||||
* @author admin
|
||||
* @date 2022年09月16日 12:41:35
|
||||
*/
|
||||
public interface ISysLogMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param sysLog sysLog
|
||||
* @return int
|
||||
*/
|
||||
int insertSelective(SysLog sysLog);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param setParam setParam
|
||||
* @param whereParam whereParam
|
||||
* @return int
|
||||
*/
|
||||
int updateSelective(SysLog setParam, SysLog whereParam);
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*
|
||||
* @param sysLog sysLog
|
||||
* @return int
|
||||
*/
|
||||
int getCount(SysLog sysLog);
|
||||
|
||||
/**
|
||||
* 单条
|
||||
*
|
||||
* @param sysLog sysLog
|
||||
* @return SysLog
|
||||
*/
|
||||
SysLog getOne(SysLog sysLog);
|
||||
|
||||
/**
|
||||
* 多条
|
||||
*
|
||||
* @param sysLog sysLog
|
||||
* @return List<SysLog>
|
||||
*/
|
||||
List<SysLog> getList(SysLog sysLog);
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param sysLog sysLog
|
||||
* @return List<SysLog>
|
||||
*/
|
||||
List<SysLog> getPageList(SysLog sysLog);
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue