feat:模块名称调整
This commit is contained in:
92
springboot-web/pom.xml
Normal file
92
springboot-web/pom.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<?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.tiesheng</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>0.0.18</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- aspect -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MySql驱动 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.30</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-db-migration</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.tiesheng.core;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
|
||||
@ComponentScan({
|
||||
"com.tiesheng.core.**.*",
|
||||
})
|
||||
@MapperScan("com.tiesheng.core.mapper")
|
||||
public class CoreAutoConfigurer {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.tiesheng.core;
|
||||
|
||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
||||
import com.tiesheng.login.LoginAutoConfigurer;
|
||||
import com.tiesheng.message.MessageAutoConfigurer;
|
||||
import com.tiesheng.migration.MigrationAutoConfigurer;
|
||||
import com.tiesheng.util.UtilAutoConfigurer;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
@Documented
|
||||
@Import({
|
||||
UtilAutoConfigurer.class,
|
||||
MessageAutoConfigurer.class,
|
||||
CoreAutoConfigurer.class,
|
||||
LoginAutoConfigurer.class,
|
||||
MigrationAutoConfigurer.class
|
||||
})
|
||||
public @interface EnableTieshengWeb {
|
||||
|
||||
Class<? extends TieshengWebConfigurer> webConfigurer();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.tiesheng.core.config.exception;
|
||||
|
||||
import cn.hutool.core.exceptions.ValidateException;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.exception.ApiRespEnum;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.MultipartProperties;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author huang
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class SpringExceptionHandler {
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
|
||||
|
||||
/**
|
||||
* 全局异常捕获
|
||||
*
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ApiResp<String> handle(Exception e) {
|
||||
|
||||
// 自定义异常
|
||||
if (e instanceof ApiException) {
|
||||
return ((ApiException) e).getApiResp();
|
||||
}
|
||||
|
||||
// 请求异常
|
||||
if (e instanceof ValidateException) {
|
||||
return ApiResp.respCust(ApiRespEnum.BadRequest.getCode(), e.getMessage());
|
||||
}
|
||||
if (e instanceof BindException) {
|
||||
FieldError error = ((BindException) e).getFieldError();
|
||||
String msg = "请求参数不合法";
|
||||
if (error != null) {
|
||||
msg = error.getDefaultMessage();
|
||||
}
|
||||
return ApiResp.respCust(ApiRespEnum.BadRequest.getCode(), msg);
|
||||
}
|
||||
if (e instanceof MethodArgumentTypeMismatchException) {
|
||||
return ApiResp.respCust(ApiRespEnum.BadRequest.getCode(), "请求参数不合法");
|
||||
}
|
||||
if (e instanceof HttpRequestMethodNotSupportedException) {
|
||||
return ApiResp.respCust(ApiRespEnum.BadRequest.getCode(), "不支持的请求方式");
|
||||
}
|
||||
if (e instanceof NoHandlerFoundException) {
|
||||
return ApiResp.respCust(ApiRespEnum.BadRequest.getCode(), "请求路径不存在");
|
||||
}
|
||||
if (e instanceof MaxUploadSizeExceededException) {
|
||||
MultipartProperties property = SpringUtil.getBean(MultipartProperties.class);
|
||||
return ApiResp.respCust(ApiRespEnum.BadRequest.getCode(), String.format("上传文件不得超过%dMB", property.getMaxFileSize().toMegabytes()));
|
||||
}
|
||||
|
||||
// 服务器内部异常
|
||||
if (e instanceof IOException) {
|
||||
return ApiResp.respCust(ApiRespEnum.ServerError.getCode(), "IO异常");
|
||||
}
|
||||
|
||||
return tieshengWebConfigurer.addExceptionHandler(e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.tiesheng.core.config.json;
|
||||
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Configuration
|
||||
public class FastJsonMessageConverter {
|
||||
|
||||
/**
|
||||
* 配置FastJson
|
||||
*
|
||||
* @return HttpMessageConverters
|
||||
*/
|
||||
@Bean
|
||||
public HttpMessageConverters fastJsonHttpMessageConverters() {
|
||||
FastJsonConfig config = new FastJsonConfig();
|
||||
config.setSerializerFeatures(SerializerFeature.WriteMapNullValue,
|
||||
SerializerFeature.WriteNullStringAsEmpty,
|
||||
SerializerFeature.WriteEnumUsingName);
|
||||
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
|
||||
fastConverter.setFastJsonConfig(config);
|
||||
fastConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||
|
||||
List<MediaType> mediaTypes = new ArrayList<>();
|
||||
mediaTypes.add(MediaType.APPLICATION_JSON);
|
||||
fastConverter.setSupportedMediaTypes(mediaTypes);
|
||||
|
||||
return new HttpMessageConverters(fastConverter);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.tiesheng.core.config.mybatis;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.extension.MybatisMapWrapperFactory;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusCustomizer {
|
||||
|
||||
/**
|
||||
* 分页器配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
|
||||
interceptor.addInnerInterceptor(paginationInnerInterceptor);
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* map对象自动转驼峰
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public ConfigurationCustomizer configurationCustomizer() {
|
||||
return i -> {
|
||||
i.setObjectWrapperFactory(new MybatisMapWrapperFactory());
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* map中保留null值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public MybatisConfiguration mybatisConfiguration() {
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setCallSettersOnNulls(true);
|
||||
return configuration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tiesheng.core.config.mybatis;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Component
|
||||
public class MybatisTimeMetaHandler implements MetaObjectHandler {
|
||||
|
||||
/**
|
||||
* 在执行mybatisPlus的insert()时,为我们自动给某些字段填充值,这样的话,我们就不需要手动给insert()里的实体类赋值了
|
||||
*
|
||||
* @param metaObject
|
||||
*/
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
// 其中方法参数中第一个是前面自动填充所对应的字段,第二个是要自动填充的值。第三个是指定实体类的对象
|
||||
this.setFieldValByName("createTime", DateUtil.date(), metaObject);
|
||||
this.setFieldValByName("updateTime", DateUtil.date(), metaObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在执行mybatisPlus的update()时,为我们自动给某些字段填充值,这样的话,我们就不需要手动给update()里的实体类赋值了
|
||||
*
|
||||
* @param metaObject
|
||||
*/
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("updateTime", DateUtil.date(), metaObject);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.tiesheng.core.config.operation;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tiesheng.annotation.operation.OperationLog;
|
||||
import com.tiesheng.core.service.CoreLogService;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
* @ProjectName CmccSpring
|
||||
* @Copyright Hangzhou ShuoChuang Technology Co.,Ltd All Right Reserved
|
||||
* @Description 这里是对文件的描述
|
||||
* @data 2019-07-15
|
||||
* @note 这里写文件的详细功能和改动
|
||||
* @note
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class OperationAspect {
|
||||
|
||||
@Autowired
|
||||
CoreLogService coreLogService;
|
||||
|
||||
|
||||
@Pointcut("@annotation(com.tiesheng.annotation.operation.OperationLog)")
|
||||
public void methodArgs() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取操作日志说明
|
||||
*
|
||||
* @param joinPoint
|
||||
*/
|
||||
@Around("methodArgs()")
|
||||
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
OperationLog operationLog = method.getAnnotation(OperationLog.class);
|
||||
String subject = operationLog.subject();
|
||||
String insertKey = operationLog.insertKey();
|
||||
|
||||
Object reqObj = null;
|
||||
Map<String, Object> allParams = new HashMap<>(16);
|
||||
if (joinPoint.getArgs().length > 0) {
|
||||
reqObj = joinPoint.getArgs()[0];
|
||||
allParams.putAll(BeanUtil.beanToMap(reqObj));
|
||||
}
|
||||
|
||||
Object response = joinPoint.proceed(joinPoint.getArgs());
|
||||
allParams.putAll(BeanUtil.beanToMap(response));
|
||||
|
||||
if (!StrUtil.isEmpty(subject)) {
|
||||
|
||||
// 添加、编辑关键字处理
|
||||
if (!StrUtil.isEmpty(insertKey)) {
|
||||
String insertVal = MapUtil.getStr(allParams, insertKey);
|
||||
subject = (StrUtil.isEmpty(insertVal) ? "添加" : "编辑") + subject;
|
||||
}
|
||||
|
||||
// 占位符处理
|
||||
subject = StrUtil.format(subject, allParams);
|
||||
}
|
||||
|
||||
coreLogService.addOperationLog(operationLog.title(), subject, reqObj);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.tiesheng.core.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
||||
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
|
||||
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
||||
import com.tiesheng.core.service.CoreConfigService;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/config")
|
||||
public class ConfigController {
|
||||
|
||||
@Autowired
|
||||
CoreConfigService coreConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/system/page")
|
||||
@TokenIgnore
|
||||
public ApiResp<List<CoreConfigSystem>> systemPage(PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreConfigSystem> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "config_key", "remark");
|
||||
queryWrapper.orderByAsc("config_key");
|
||||
|
||||
Page<CoreConfigSystem> page = dto.pageObj();
|
||||
coreConfigService.page(page, queryWrapper);
|
||||
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/system/update")
|
||||
public ApiResp<String> systemUpdate(@RequestBody ConfigSystemDTO dto) {
|
||||
|
||||
CoreConfigSystem configKey = coreConfigService.getOneByColumn("config_key", dto.getConfigKey());
|
||||
if (configKey == null) {
|
||||
throw new ApiException("该配置不存在,请检查");
|
||||
}
|
||||
if (configKey.getReadOnly() == 1) {
|
||||
throw new ApiException("该配置只读,不可修改");
|
||||
}
|
||||
configKey.setConfigVal(dto.getConfigVal());
|
||||
configKey.setRemark(dto.getRemark());
|
||||
configKey.setExtra(dto.getExtra());
|
||||
coreConfigService.updateById(configKey);
|
||||
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取枚举列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/enum/list")
|
||||
@TokenIgnore
|
||||
public ApiResp<List<CoreConfigEnum>> enumList(EnumTypeDTO dto) {
|
||||
|
||||
QueryWrapper<CoreConfigEnum> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (!StrUtil.isEmpty(dto.getType())) {
|
||||
queryWrapper.eq("type", dto.getType());
|
||||
}
|
||||
List<CoreConfigEnum> selectList = coreConfigService.getEnumMapper().selectList(queryWrapper);
|
||||
|
||||
return ApiResp.respOK(selectList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.tiesheng.core.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
||||
import com.tiesheng.core.service.CoreLogService;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manager/log")
|
||||
public class LogController {
|
||||
|
||||
@Autowired
|
||||
CoreLogService coreLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 操作日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/operation/page")
|
||||
public ApiResp<List<CoreLogOperation>> operationPage(@Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogOperation> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "user_name", "title", "subject", "params");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogOperation> page = dto.pageObj();
|
||||
coreLogService.page(page, queryWrapper);
|
||||
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/login/page")
|
||||
public ApiResp<List<CoreLogLogin>> loginPage(@Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogLogin> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "user_name", "ip", "address");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogLogin> page = dto.pageObj();
|
||||
coreLogService.getLogLoginMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 登录日志列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/message/page")
|
||||
public ApiResp<List<CoreLogMessage>> messagePage(String result, @Valid PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreLogMessage> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
if (!StrUtil.isEmpty(result)) {
|
||||
queryWrapper.eq("result", result);
|
||||
}
|
||||
dto.likeColumns(queryWrapper, "type", "target", "content", "resp_body");
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<CoreLogMessage> page = dto.pageObj();
|
||||
coreLogService.getLogMessageMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.tiesheng.core.controller;
|
||||
|
||||
|
||||
import cn.hutool.captcha.LineCaptcha;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.core.pojos.dto.ImageCodeDTO;
|
||||
import com.tiesheng.core.pojos.vo.PicVerifyVo;
|
||||
import com.tiesheng.core.service.FileUploadService;
|
||||
import com.tiesheng.core.service.TimedCacheService;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 工具类
|
||||
*
|
||||
* @author hao
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tool")
|
||||
public class ToolController {
|
||||
|
||||
@Autowired
|
||||
TimedCacheService timedCacheService;
|
||||
@Autowired
|
||||
FileUploadService fileUploadService;
|
||||
|
||||
|
||||
/**
|
||||
* 图片验证码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@GetMapping("/code/image")
|
||||
public ApiResp<PicVerifyVo> picVerifyV2(ImageCodeDTO dto) {
|
||||
|
||||
LineCaptcha lineCaptcha = dto.lineCaptcha();
|
||||
PicVerifyVo vo = new PicVerifyVo();
|
||||
vo.setBase64(lineCaptcha.getImageBase64Data());
|
||||
vo.setKey(IdUtil.simpleUUID());
|
||||
timedCacheService.setImageCode(vo.getKey(), lineCaptcha.getCode());
|
||||
|
||||
return ApiResp.respOK(vo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传整个文件
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/whole_upload")
|
||||
public ApiResp<String> fileWholeUpload(@RequestParam("file") MultipartFile file) {
|
||||
String filePath = fileUploadService.saveMultipartFile(file);
|
||||
return ApiResp.respOK(filePath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传超大文件,建议超过20M的使用这个方法
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping(value = "/file/chunk_start")
|
||||
public ApiResp<String> fileChunkStart(String fileExt) {
|
||||
fileUploadService.chunkStart(fileExt);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验文件块
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_check")
|
||||
public ApiResp<Boolean> fileChunkCheck(String fileMd5, Integer chunk) {
|
||||
boolean exist = fileUploadService.chunkCheck(fileMd5, chunk);
|
||||
return ApiResp.respOK(exist);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件块
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_upload")
|
||||
public ApiResp<String> fileChunkUpload(@RequestParam("file") MultipartFile file, String fileMd5, Integer chunk) {
|
||||
fileUploadService.chunkUpload(file, fileMd5, chunk);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 合并文件
|
||||
*
|
||||
* @param fileMd5
|
||||
* @return
|
||||
*/
|
||||
@TokenIgnore
|
||||
@PostMapping("/file/chunk_merge")
|
||||
public ApiResp<String> fileChunkMerge(String fileMd5) {
|
||||
String path = fileUploadService.chunkMerge(fileMd5);
|
||||
return ApiResp.respOK(path);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
|
||||
|
||||
public interface CoreConfigEnumMapper extends BaseMapper<CoreConfigEnum> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||
|
||||
public interface CoreConfigSystemMapper extends BaseMapper<CoreConfigSystem> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||
|
||||
public interface CoreLogLoginMapper extends BaseMapper<CoreLogLogin> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||
|
||||
public interface CoreLogMessageMapper extends BaseMapper<CoreLogMessage> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||
|
||||
public interface CoreLogOperationMapper extends BaseMapper<CoreLogOperation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||
|
||||
public interface CorePlatformUniqueMapper extends BaseMapper<CorePlatformUnique> {
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tiesheng.core.pojos;
|
||||
|
||||
public class CurrentWebUser {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private Object data;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.tiesheng.core.pojos;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class DaoBase {
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(value = "is_deleted")
|
||||
private Integer isDeleted;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String 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 Integer getIsDeleted() {
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
public void setIsDeleted(Integer isDeleted) {
|
||||
this.isDeleted = isDeleted;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 配置-枚举
|
||||
*/
|
||||
@TableName(value = "core_config_enum")
|
||||
public class CoreConfigEnum extends DaoBase {
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "`name`")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 扩展字段
|
||||
*/
|
||||
@TableField(value = "ext")
|
||||
private String ext;
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
*
|
||||
* @return type - 类型
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置类型
|
||||
*
|
||||
* @param type 类型
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取名称
|
||||
*
|
||||
* @return name - 名称
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置名称
|
||||
*
|
||||
* @param name 名称
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取备注
|
||||
*
|
||||
* @return remark - 备注
|
||||
*/
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置备注
|
||||
*
|
||||
* @param remark 备注
|
||||
*/
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取扩展字段
|
||||
*
|
||||
* @return ext - 扩展字段
|
||||
*/
|
||||
public String getExt() {
|
||||
return ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置扩展字段
|
||||
*
|
||||
* @param ext 扩展字段
|
||||
*/
|
||||
public void setExt(String ext) {
|
||||
this.ext = ext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 配置-系统
|
||||
*/
|
||||
@TableName(value = "core_config_system")
|
||||
public class CoreConfigSystem extends DaoBase {
|
||||
@TableField(value = "config_key")
|
||||
private String configKey;
|
||||
|
||||
@TableField(value = "config_val")
|
||||
private String configVal;
|
||||
|
||||
/**
|
||||
* 类型:0-文本,1-图片,2-文件
|
||||
*/
|
||||
@TableField(value = "config_type")
|
||||
private Integer configType;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 额外配置
|
||||
*/
|
||||
@TableField(value = "extra")
|
||||
private String extra;
|
||||
|
||||
/**
|
||||
* 0-否,1-是
|
||||
*/
|
||||
@TableField(value = "read_only")
|
||||
private Integer readOnly;
|
||||
|
||||
/**
|
||||
* @return config_key
|
||||
*/
|
||||
public String getConfigKey() {
|
||||
return configKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configKey
|
||||
*/
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return config_val
|
||||
*/
|
||||
public String getConfigVal() {
|
||||
return configVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configVal
|
||||
*/
|
||||
public void setConfigVal(String configVal) {
|
||||
this.configVal = configVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型:0-文本,1-图片,2-文件
|
||||
*
|
||||
* @return config_type - 类型:0-文本,1-图片,2-文件
|
||||
*/
|
||||
public Integer getConfigType() {
|
||||
return configType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置类型:0-文本,1-图片,2-文件
|
||||
*
|
||||
* @param configType 类型:0-文本,1-图片,2-文件
|
||||
*/
|
||||
public void setConfigType(Integer configType) {
|
||||
this.configType = configType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取说明
|
||||
*
|
||||
* @return remark - 说明
|
||||
*/
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置说明
|
||||
*
|
||||
* @param remark 说明
|
||||
*/
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取额外配置
|
||||
*
|
||||
* @return extra - 额外配置
|
||||
*/
|
||||
public String getExtra() {
|
||||
return extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置额外配置
|
||||
*
|
||||
* @param extra 额外配置
|
||||
*/
|
||||
public void setExtra(String extra) {
|
||||
this.extra = extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取0-否,1-是
|
||||
*
|
||||
* @return read_only - 0-否,1-是
|
||||
*/
|
||||
public Integer getReadOnly() {
|
||||
return readOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置0-否,1-是
|
||||
*
|
||||
* @param readOnly 0-否,1-是
|
||||
*/
|
||||
public void setReadOnly(Integer readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
|
||||
/**
|
||||
* 日志-登录
|
||||
*/
|
||||
@TableName(value = "core_log_login")
|
||||
public class CoreLogLogin extends DaoBase {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
@TableField(value = "platform")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
@TableField(value = "ip")
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* ip地址
|
||||
*/
|
||||
@TableField(value = "address")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*
|
||||
* @return user_id - 用户id
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户id
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ip
|
||||
*
|
||||
* @return ip - ip
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置ip
|
||||
*
|
||||
* @param ip ip
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ip地址
|
||||
*
|
||||
* @return address - ip地址
|
||||
*/
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置ip地址
|
||||
*
|
||||
* @param address ip地址
|
||||
*/
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日志-消息
|
||||
*/
|
||||
@TableName(value = "core_log_message")
|
||||
public class CoreLogMessage extends DaoBase {
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 发送对象
|
||||
*/
|
||||
@TableField(value = "target")
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* 发送内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 返回结果
|
||||
*/
|
||||
@TableField(value = "resp_body")
|
||||
private String respBody;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
*/
|
||||
@TableField(value = "`result`")
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
*
|
||||
* @return type - 类型
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置类型
|
||||
*
|
||||
* @param type 类型
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发送对象
|
||||
*
|
||||
* @return target - 发送对象
|
||||
*/
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置发送对象
|
||||
*
|
||||
* @param target 发送对象
|
||||
*/
|
||||
public void setTarget(String target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发送内容
|
||||
*
|
||||
* @return content - 发送内容
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置发送内容
|
||||
*
|
||||
* @param content 发送内容
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取返回结果
|
||||
*
|
||||
* @return resp_body - 返回结果
|
||||
*/
|
||||
public String getRespBody() {
|
||||
return respBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置返回结果
|
||||
*
|
||||
* @param respBody 返回结果
|
||||
*/
|
||||
public void setRespBody(String respBody) {
|
||||
this.respBody = respBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结果
|
||||
*
|
||||
* @return result - 结果
|
||||
*/
|
||||
public Integer getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置结果
|
||||
*
|
||||
* @param result 结果
|
||||
*/
|
||||
public void setResult(Integer result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日志-操作
|
||||
*/
|
||||
@TableName(value = "core_log_operation")
|
||||
public class CoreLogOperation extends DaoBase {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@TableField(value = "user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@TableField(value = "title")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 小标题
|
||||
*/
|
||||
@TableField(value = "subject")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 其他参数
|
||||
*/
|
||||
@TableField(value = "params")
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*
|
||||
* @return user_id - 用户id
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户id
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户名称
|
||||
*
|
||||
* @return user_name - 用户名称
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户名称
|
||||
*
|
||||
* @param userName 用户名称
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标题
|
||||
*
|
||||
* @return title - 标题
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置标题
|
||||
*
|
||||
* @param title 标题
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小标题
|
||||
*
|
||||
* @return subject - 小标题
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置小标题
|
||||
*
|
||||
* @param subject 小标题
|
||||
*/
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取其他参数
|
||||
*
|
||||
* @return params - 其他参数
|
||||
*/
|
||||
public String getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置其他参数
|
||||
*
|
||||
* @param params 其他参数
|
||||
*/
|
||||
public void setParams(String params) {
|
||||
this.params = params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.tiesheng.core.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 平台-唯一值
|
||||
*/
|
||||
@TableName(value = "core_platform_unique")
|
||||
public class CorePlatformUnique extends DaoBase {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* appId
|
||||
*/
|
||||
@TableField(value = "app_id")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 唯一值
|
||||
*/
|
||||
@TableField(value = "unique_id")
|
||||
private String uniqueId;
|
||||
|
||||
/**
|
||||
* 平台
|
||||
*/
|
||||
@TableField(value = "platform")
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 其他参数
|
||||
*/
|
||||
@TableField(value = "info")
|
||||
private String info;
|
||||
|
||||
/**
|
||||
* 获取用户id
|
||||
*
|
||||
* @return user_id - 用户id
|
||||
*/
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户id
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取appId
|
||||
*
|
||||
* @return app_id - appId
|
||||
*/
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置appId
|
||||
*
|
||||
* @param appId appId
|
||||
*/
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取唯一值
|
||||
*
|
||||
* @return unique_id - 唯一值
|
||||
*/
|
||||
public String getUniqueId() {
|
||||
return uniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置唯一值
|
||||
*
|
||||
* @param uniqueId 唯一值
|
||||
*/
|
||||
public void setUniqueId(String uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取平台
|
||||
*
|
||||
* @return platform - 平台
|
||||
*/
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置平台
|
||||
*
|
||||
* @param platform 平台
|
||||
*/
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取其他参数
|
||||
*
|
||||
* @return info - 其他参数
|
||||
*/
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置其他参数
|
||||
*
|
||||
* @param info 其他参数
|
||||
*/
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tiesheng.core.pojos.dto;
|
||||
|
||||
import cn.hutool.captcha.CaptchaUtil;
|
||||
import cn.hutool.captcha.LineCaptcha;
|
||||
import cn.hutool.captcha.generator.RandomGenerator;
|
||||
|
||||
public class ImageCodeDTO {
|
||||
|
||||
private Integer lineCount;
|
||||
private Integer width;
|
||||
private Integer height;
|
||||
|
||||
|
||||
/**
|
||||
* 构建线条图形码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LineCaptcha lineCaptcha() {
|
||||
if (lineCount == null || lineCount < 100) {
|
||||
lineCount = 100;
|
||||
}
|
||||
if (width == null) {
|
||||
width = 220;
|
||||
}
|
||||
if (height == null) {
|
||||
height = 62;
|
||||
}
|
||||
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(width, height, 4, lineCount);
|
||||
lineCaptcha.setGenerator(new RandomGenerator("0123456789", 4));
|
||||
|
||||
return lineCaptcha;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public Integer getLineCount() {
|
||||
return lineCount;
|
||||
}
|
||||
|
||||
public void setLineCount(Integer lineCount) {
|
||||
this.lineCount = lineCount;
|
||||
}
|
||||
|
||||
public Integer getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(Integer width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.tiesheng.core.pojos.dto;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
public class PageDTO {
|
||||
|
||||
private Long pageNum;
|
||||
private Long pageSize;
|
||||
private String keyword;
|
||||
private String between;
|
||||
private String equals;
|
||||
private String order;
|
||||
|
||||
|
||||
/**
|
||||
* 启用分页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public <T> Page<T> pageObj() {
|
||||
Page<T> page = new Page<>();
|
||||
page.setSize(getPageSize());
|
||||
page.setCurrent(getPageNum());
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 启用分页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Page<Map<String, Object>> pageMap() {
|
||||
Page<Map<String, Object>> page = new Page<>();
|
||||
page.setSize(getPageSize());
|
||||
page.setCurrent(getPageNum());
|
||||
return page;
|
||||
}
|
||||
|
||||
/***
|
||||
* 启用排序
|
||||
* @param queryWrapper
|
||||
* @param <T>
|
||||
*/
|
||||
public <T> void doOrder(QueryWrapper<T> queryWrapper) {
|
||||
if (!StrUtil.isEmpty(order)) {
|
||||
if (order.contains("-")) {
|
||||
queryWrapper.orderByDesc(StrUtil.toUnderlineCase(order.replace("-", "")));
|
||||
} else {
|
||||
queryWrapper.orderByAsc(StrUtil.toUnderlineCase(order));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字查询
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param columns
|
||||
* @param <T>
|
||||
*/
|
||||
public <T> void likeColumns(QueryWrapper<T> queryWrapper, String... columns) {
|
||||
keyword = StrUtil.trim(keyword);
|
||||
if (!StrUtil.isEmpty(keyword) && columns != null && columns.length > 0) {
|
||||
queryWrapper.and(s -> {
|
||||
for (String col : columns) {
|
||||
s.like(col, keyword).or();
|
||||
}
|
||||
});
|
||||
}
|
||||
betweenColumns(queryWrapper);
|
||||
equalsColumns(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 区间
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param <T>
|
||||
*/
|
||||
public <T> void betweenColumns(QueryWrapper<T> queryWrapper) {
|
||||
if (!StrUtil.isEmpty(between)) {
|
||||
String[] bets = between.split("=");
|
||||
if (bets.length == 2) {
|
||||
String[] vals = bets[1].split(",");
|
||||
if (vals.length == 2) {
|
||||
queryWrapper.between(StrUtil.toUnderlineCase(bets[0]), vals[0], vals[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配列
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public <T> void equalsColumns(QueryWrapper<T> queryWrapper) {
|
||||
if (!StrUtil.isEmpty(equals)) {
|
||||
String[] kv = equals.split(",");
|
||||
for (String key : kv) {
|
||||
String[] cols = key.split("=");
|
||||
if (cols.length == 2) {
|
||||
queryWrapper.eq(StrUtil.toUnderlineCase(cols[0]), cols[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* between
|
||||
*
|
||||
* @param alias
|
||||
* @return
|
||||
*/
|
||||
public String betweenSql(String alias) {
|
||||
String sql = "";
|
||||
if (!StrUtil.isEmpty(between)) {
|
||||
String[] bets = between.split("=");
|
||||
if (bets.length == 2) {
|
||||
String[] vals = bets[1].split(",");
|
||||
if (vals.length == 2) {
|
||||
sql = sql + " and (" + alias + "." + StrUtil.toUnderlineCase(bets[0])
|
||||
+ " between '" + vals[0] + "' and '" + vals[1] + "')";
|
||||
}
|
||||
}
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排序的sql
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getOrderSql(String alias) {
|
||||
String sql = "";
|
||||
if (!StrUtil.isEmpty(order)) {
|
||||
if (order.contains("-")) {
|
||||
sql = StrUtil.toUnderlineCase(order.replace("-", "")) + " desc";
|
||||
} else {
|
||||
sql = StrUtil.toUnderlineCase(order) + " asc";
|
||||
}
|
||||
sql = "order by " + alias + "." + sql;
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
public String getEqualsSql(String alias) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
if (!StrUtil.isEmpty(equals)) {
|
||||
String[] kv = equals.split(",");
|
||||
for (String key : kv) {
|
||||
String[] cols = key.split("=");
|
||||
if (cols.length == 2) {
|
||||
sql.append(" and ").append(alias).append(".").append(StrUtil.toUnderlineCase(cols[0])).append("=").append(cols[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Long getPageNum() {
|
||||
return pageNum == null ? 1 : pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Long pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Long getPageSize() {
|
||||
return pageSize == null ? 10 : pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Long pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getKeyword() {
|
||||
return keyword;
|
||||
}
|
||||
|
||||
public void setKeyword(String keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
public String getBetween() {
|
||||
return between;
|
||||
}
|
||||
|
||||
public void setBetween(String between) {
|
||||
this.between = between;
|
||||
}
|
||||
|
||||
public String getEquals() {
|
||||
return equals;
|
||||
}
|
||||
|
||||
public void setEquals(String equals) {
|
||||
this.equals = equals;
|
||||
}
|
||||
|
||||
public String getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(String order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.tiesheng.core.pojos.dto.config;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
public class ConfigSystemDTO {
|
||||
|
||||
@NotEmpty(message = "请输入key")
|
||||
private String configKey;
|
||||
private String configVal;
|
||||
private String remark;
|
||||
private String extra;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getConfigKey() {
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey) {
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
public String getConfigVal() {
|
||||
return configVal;
|
||||
}
|
||||
|
||||
public void setConfigVal(String configVal) {
|
||||
this.configVal = configVal;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getExtra() {
|
||||
return extra;
|
||||
}
|
||||
|
||||
public void setExtra(String extra) {
|
||||
this.extra = extra;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.tiesheng.core.pojos.dto.config;
|
||||
|
||||
public class EnumTypeDTO {
|
||||
|
||||
private String type;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.tiesheng.core.pojos.vo;
|
||||
|
||||
public class PicVerifyVo {
|
||||
|
||||
private String base64;
|
||||
private String key;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getBase64() {
|
||||
return base64;
|
||||
}
|
||||
|
||||
public void setBase64(String base64) {
|
||||
this.base64 = base64;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
|
||||
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Service
|
||||
public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, CoreConfigSystem> {
|
||||
|
||||
@Autowired
|
||||
CoreConfigEnumMapper coreConfigEnumMapper;
|
||||
|
||||
public CoreConfigEnumMapper getEnumMapper() {
|
||||
return coreConfigEnumMapper;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.core.mapper.CoreLogLoginMapper;
|
||||
import com.tiesheng.core.mapper.CoreLogMessageMapper;
|
||||
import com.tiesheng.core.mapper.CoreLogOperationMapper;
|
||||
import com.tiesheng.core.pojos.CurrentWebUser;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
||||
import com.tiesheng.util.ServletKit;
|
||||
import com.tiesheng.util.ip2region.DataBlock;
|
||||
import com.tiesheng.util.ip2region.Ip2Region;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Service
|
||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> implements TieshengMessageConfigurer {
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
@Autowired
|
||||
CoreLogLoginMapper coreLogLoginMapper;
|
||||
@Autowired
|
||||
CoreLogMessageMapper coreLogMessageMapper;
|
||||
|
||||
public CoreLogLoginMapper getLogLoginMapper() {
|
||||
return coreLogLoginMapper;
|
||||
}
|
||||
|
||||
public CoreLogMessageMapper getLogMessageMapper() {
|
||||
return coreLogMessageMapper;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 操作日志
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* 添加操作日志
|
||||
*/
|
||||
public void addOperationLog(String title, String subject, Object params) {
|
||||
CoreLogOperation operation = new CoreLogOperation();
|
||||
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName(TsTokenConfig.get().getId());
|
||||
operation.setUserId(currentWebUser.getId());
|
||||
operation.setUserName(currentWebUser.getName());
|
||||
operation.setTitle(title);
|
||||
operation.setSubject(subject);
|
||||
if (params != null) {
|
||||
operation.setParams(JSONUtil.toJsonStr(params));
|
||||
}
|
||||
save(operation);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 登录日志
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 添加登录日志
|
||||
*
|
||||
* @param platformUnique
|
||||
*/
|
||||
public void addLoginLog(CorePlatformUnique platformUnique) {
|
||||
|
||||
HttpServletRequest request = ServletKit.getRequest();
|
||||
String ip = ServletUtil.getClientIP(request);
|
||||
|
||||
CoreLogLogin login = new CoreLogLogin();
|
||||
login.setUserId(platformUnique.getUserId());
|
||||
login.setPlatform(platformUnique.getPlatform());
|
||||
|
||||
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName(platformUnique.getUserId());
|
||||
login.setUserName(currentWebUser.getName());
|
||||
|
||||
login.setIp(ip);
|
||||
DataBlock dataBlock = Ip2Region.getInstance().btreeSearch(ip);
|
||||
login.setAddress(dataBlock.getRegion());
|
||||
coreLogLoginMapper.insert(login);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 消息日志
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 添加消息日志
|
||||
*
|
||||
* @param type
|
||||
* @param reqResp
|
||||
*/
|
||||
@Override
|
||||
public void onMessageSend(String type, MessageReqResp reqResp) {
|
||||
CoreLogMessage coreLogMessage = BeanUtil.copyProperties(reqResp, CoreLogMessage.class);
|
||||
coreLogMessage.setType(type);
|
||||
coreLogMessageMapper.insert(coreLogMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tiesheng.core.mapper.CorePlatformUniqueMapper;
|
||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Service
|
||||
public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueMapper, CorePlatformUnique> implements TieshengLoginConfigurer {
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
@Autowired
|
||||
CoreLogService coreLogService;
|
||||
|
||||
@Override
|
||||
public TokenBean doLogin(String appId, String uniqueId, String platfrom, String info) {
|
||||
|
||||
CorePlatformUnique platformUnique = getByAppAndUnique(appId, uniqueId, platfrom);
|
||||
platformUnique.setInfo(info);
|
||||
TokenBean tokenBean = tieshengWebConfigurer.loginConfigurer().doLogin(platformUnique);
|
||||
if (tokenBean != null) {
|
||||
platformUnique.setUserId(tokenBean.getId());
|
||||
platformUnique.setIsDeleted(0);
|
||||
saveOrUpdate(platformUnique);
|
||||
|
||||
// 添加登录日志
|
||||
coreLogService.addLoginLog(platformUnique);
|
||||
}
|
||||
return tokenBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginRedirect(TokenBean bean, String extra, HttpServletResponse response) {
|
||||
tieshengWebConfigurer.loginConfigurer().redirect(bean, extra, response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过appId获取登录对象
|
||||
*
|
||||
* @param appId
|
||||
* @param uniqueId
|
||||
* @return
|
||||
*/
|
||||
private CorePlatformUnique getByAppAndUnique(String appId, String uniqueId, String platform) {
|
||||
QueryWrapper<CorePlatformUnique> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("app_id", appId);
|
||||
queryWrapper.eq("unique_id", uniqueId);
|
||||
queryWrapper.eq("platform", platform);
|
||||
queryWrapper.last("limit 1");
|
||||
CorePlatformUnique platformUnique = getOne(queryWrapper);
|
||||
if (platformUnique == null) {
|
||||
platformUnique = new CorePlatformUnique();
|
||||
platformUnique.setAppId(appId);
|
||||
platformUnique.setUniqueId(uniqueId);
|
||||
platformUnique.setPlatform(platform);
|
||||
}
|
||||
return platformUnique;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过平台和用户id查询
|
||||
*
|
||||
* @param platform
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
private List<CorePlatformUnique> getByPlatformAndUser(String platform, List<String> userIds) {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
|
||||
QueryWrapper<CorePlatformUnique> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("user_id", userIds);
|
||||
queryWrapper.eq("platform", platform);
|
||||
queryWrapper.last("limit 1");
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.core.io.FileTypeUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.FileUploadPath;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Service
|
||||
public class FileUploadService {
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 方法
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 保存文件
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
public String saveMultipartFile(MultipartFile file) {
|
||||
try {
|
||||
|
||||
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
|
||||
tieshengWebConfigurer.uploadFileCheck(fileType);
|
||||
|
||||
FileUploadPath filePath = FileUploadPath.random();
|
||||
|
||||
InputStream stream = file.getInputStream();
|
||||
FileUtil.writeFromStream(stream, filePath.getAbsolutePath());
|
||||
IoUtil.close(stream);
|
||||
|
||||
return filePath.getHttpPath();
|
||||
} catch (Exception e) {
|
||||
throw new ApiException("文件流读取失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 文件分包上传
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 检查待上传文件是否存在
|
||||
*
|
||||
* @param fileExt
|
||||
*/
|
||||
public void chunkStart(String fileExt) {
|
||||
tieshengWebConfigurer.uploadFileCheck(fileExt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查块文件
|
||||
*
|
||||
* @param fileMd5
|
||||
* @param chunk
|
||||
* @return
|
||||
*/
|
||||
public boolean chunkCheck(String fileMd5, Integer chunk) {
|
||||
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
||||
File chunkFile = FileUtil.file(folder.getAbsolutePath(), chunk.toString());
|
||||
return chunkFile.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 块文件上传
|
||||
*
|
||||
* @param file
|
||||
* @param fileMd5
|
||||
* @param chunk
|
||||
*/
|
||||
public void chunkUpload(MultipartFile file, String fileMd5, Integer chunk) {
|
||||
if (file == null) {
|
||||
throw new ApiException("请选择文件后上传");
|
||||
}
|
||||
|
||||
try {
|
||||
// 块文件
|
||||
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
||||
File chunkfile = new File(folder.getAbsolutePath(), chunk.toString());
|
||||
InputStream stream = file.getInputStream();
|
||||
FileUtil.writeFromStream(stream, chunkfile);
|
||||
IoUtil.close(stream);
|
||||
} catch (Exception ignored) {
|
||||
throw new ApiException("块文件上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并块文件
|
||||
*
|
||||
* @param fileMd5
|
||||
*/
|
||||
public String chunkMerge(String fileMd5) {
|
||||
|
||||
// 1,获取文件块的目录
|
||||
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
||||
|
||||
// 2,如果目录不存在
|
||||
if (!FileUtil.exist(folder.getAbsolutePath())) {
|
||||
throw new ApiException("请先上传文件块");
|
||||
}
|
||||
|
||||
// 3,生成保存文件的路径
|
||||
FileUploadPath uploadPath = FileUploadPath.random();
|
||||
|
||||
// 4,获取块文件,此列表是已经排好序的列表
|
||||
List<File> chunkFiles = getSortedChunkFiles(new File(folder.getAbsolutePath()));
|
||||
|
||||
// 5,合并文件
|
||||
File newFile = FileUtil.newFile(uploadPath.getAbsolutePath());
|
||||
for (File file : chunkFiles) {
|
||||
byte[] bytes = FileUtil.readBytes(file);
|
||||
FileUtil.writeBytes(bytes, newFile, 0, bytes.length, true);
|
||||
}
|
||||
|
||||
// 6,删除块文件目录
|
||||
FileUtil.del(folder.getAbsolutePath());
|
||||
|
||||
return uploadPath.getHttpPath();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有块文件
|
||||
*
|
||||
* @param chunkFileFolder
|
||||
* @return
|
||||
*/
|
||||
private List<File> getSortedChunkFiles(File chunkFileFolder) {
|
||||
|
||||
//获取路径下的所有块文件
|
||||
File[] chunkFiles = chunkFileFolder.listFiles();
|
||||
if (chunkFiles == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
//将文件数组转成list,并排序
|
||||
List<File> chunkFileList = new ArrayList<>(Arrays.asList(chunkFiles));
|
||||
//排序
|
||||
chunkFileList.sort((o1, o2) -> {
|
||||
if (Integer.parseInt(o1.getName()) > Integer.parseInt(o2.getName())) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
});
|
||||
return chunkFileList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.tiesheng.core.pojos.CurrentWebUser;
|
||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||
import com.tiesheng.util.exception.ApiRespEnum;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* WEB配置
|
||||
*
|
||||
* @author hao
|
||||
*/
|
||||
public interface TieshengWebConfigurer {
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前用户的姓名
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
CurrentWebUser getCurrentUserName(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* 添加其他异常处理
|
||||
*
|
||||
* @param e 异常
|
||||
*/
|
||||
default ApiResp<String> addExceptionHandler(Exception e) {
|
||||
ApiResp<String> apiResp = ApiResp.respCust(ApiRespEnum.ServerError);
|
||||
apiResp.setException(e);
|
||||
LogFactory.get().info(apiResp.getException());
|
||||
return apiResp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加文件校验
|
||||
*/
|
||||
default void uploadFileCheck(String fileExt) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 配置登录
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LoginConfigurer loginConfigurer();
|
||||
|
||||
|
||||
interface LoginConfigurer {
|
||||
|
||||
/**
|
||||
* 登录逻辑
|
||||
*
|
||||
* @param platformUnique
|
||||
* @return
|
||||
*/
|
||||
TokenBean doLogin(CorePlatformUnique platformUnique);
|
||||
|
||||
|
||||
/**
|
||||
* 登录重定向
|
||||
*
|
||||
* @param bean
|
||||
* @param extra
|
||||
* @param response
|
||||
*/
|
||||
void redirect(TokenBean bean, String extra, HttpServletResponse response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import com.tiesheng.util.ServletKit;
|
||||
import com.tiesheng.util.TimedCacheHelper;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
* @ProjectName cmcc
|
||||
* @Copyright Hangzhou ShuoChuang Technology Co.,Ltd All Right Reserved
|
||||
* @Description 这里是对文件的描述
|
||||
* @data 2019-06-19
|
||||
* @note 这里写文件的详细功能和改动
|
||||
* @note
|
||||
*/
|
||||
@Service
|
||||
public class TimedCacheService {
|
||||
|
||||
|
||||
/**
|
||||
* 清空数据
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
public void clearByKey(String key) {
|
||||
TimedCacheHelper.getTimedCache().remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 放入缓存
|
||||
*
|
||||
* @param key
|
||||
* @param val
|
||||
*/
|
||||
public void putCache(String key, String val) {
|
||||
TimedCacheHelper.getTimedCache().put(key, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getCache(String key) {
|
||||
return TimedCacheHelper.getTimedCache().get(key);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 图片验证码缓存
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* 缓存 图片验证码
|
||||
*
|
||||
* @param session
|
||||
* @param value
|
||||
*/
|
||||
public void setImageCode(String captcha, String value) {
|
||||
putCache(captcha, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 验证 图片验证码
|
||||
*/
|
||||
public void verifyImage(String value) {
|
||||
String captchaKey = ServletUtil.getHeader(ServletKit.getRequest(), "captcha", "utf-8");
|
||||
String cache = getCache(captchaKey);
|
||||
if (StrUtil.isEmpty(cache) || !StrUtil.equals(cache, value)) {
|
||||
throw new ApiException("验证码不正确");
|
||||
}
|
||||
clearByKey(captchaKey);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* 基础Service
|
||||
*
|
||||
* @author hao
|
||||
*/
|
||||
public class TsServiceBase<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {
|
||||
|
||||
|
||||
/**
|
||||
* 通过属性获取一个对象
|
||||
*
|
||||
* @param column
|
||||
* @param val
|
||||
* @return
|
||||
*/
|
||||
public T getOneByColumn(String column, Object val) {
|
||||
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_deleted", 0);
|
||||
queryWrapper.eq(column, val);
|
||||
queryWrapper.last("limit 1");
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
21
springboot-web/src/main/resources/application.yml
Normal file
21
springboot-web/src/main/resources/application.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
server:
|
||||
compression:
|
||||
enabled: true
|
||||
|
||||
## Spring配置
|
||||
spring:
|
||||
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath:/static/,file:static/
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
|
||||
## 日志
|
||||
logging:
|
||||
file:
|
||||
name: logs/tiesheng.log
|
||||
@@ -0,0 +1,22 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for core_log_login
|
||||
-- ----------------------------
|
||||
CREATE TABLE `core_log_login`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
|
||||
`user_name` varchar(255) DEFAULT NULL COMMENT '用户姓名',
|
||||
`platform` varchar(50) DEFAULT NULL COMMENT '登录方式',
|
||||
`ip` varchar(100) DEFAULT NULL COMMENT 'ip',
|
||||
`address` varchar(255) DEFAULT NULL COMMENT 'ip地址',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-登录';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,23 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for core_log_message
|
||||
-- ----------------------------
|
||||
CREATE TABLE `core_log_message`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '类型',
|
||||
`target` varchar(255) DEFAULT NULL COMMENT '发送对象',
|
||||
`content` text COMMENT '发送内容',
|
||||
`resp_body` text COMMENT '返回结果',
|
||||
`result` int(6) NOT NULL DEFAULT '0' COMMENT '结果',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
ROW_FORMAT = DYNAMIC COMMENT ='日志-消息';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,22 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for core_platform_unique
|
||||
-- ----------------------------
|
||||
CREATE TABLE `core_platform_unique`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
|
||||
`app_id` varchar(255) DEFAULT NULL COMMENT 'appId',
|
||||
`unique_id` varchar(255) DEFAULT NULL COMMENT '唯一值',
|
||||
`platform` varchar(255) DEFAULT NULL COMMENT '平台',
|
||||
`info` text COMMENT '其他参数',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='平台-唯一值';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,66 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
|
||||
CREATE TABLE `core_config_enum`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '类型',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '名称',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
`ext` varchar(255) DEFAULT NULL COMMENT '扩展字段',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-枚举';
|
||||
|
||||
CREATE TABLE `core_log_operation`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
|
||||
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
||||
`title` varchar(255) DEFAULT NULL COMMENT '标题',
|
||||
`subject` varchar(500) DEFAULT NULL COMMENT '小标题',
|
||||
`params` text COMMENT '其他参数',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-操作';
|
||||
|
||||
CREATE TABLE `core_config_system`
|
||||
(
|
||||
`id` varchar(50) NOT NULL,
|
||||
`create_time` datetime NOT NULL,
|
||||
`update_time` datetime NOT NULL,
|
||||
`is_deleted` int(4) NOT NULL DEFAULT '0',
|
||||
`config_key` varchar(255) NOT NULL,
|
||||
`config_val` text,
|
||||
`config_type` int(6) NOT NULL DEFAULT '0' COMMENT '类型:0-文本,1-图片,2-开关',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '说明',
|
||||
`extra` varchar(255) DEFAULT NULL COMMENT '额外配置',
|
||||
`read_only` int(6) NOT NULL DEFAULT '0' COMMENT '0-否,1-是',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uni_key` (`config_key`(50)) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-系统';
|
||||
|
||||
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||
`config_type`, `remark`, `extra`, `read_only`)
|
||||
VALUES ('manager_web_copyright', '2022-02-23 16:52:48', '2022-02-23 16:52:49', 0, 'manager_web_copyright',
|
||||
'杭州铁晟提供技术支持', 0, '网站底部版权信息', '', 0);
|
||||
|
||||
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||
`config_type`, `remark`, `extra`, `read_only`)
|
||||
VALUES ('manager_web_title', '2022-02-24 11:56:53', '2022-02-24 11:56:53', 0, 'manager_web_title', '网站名称', 0,
|
||||
'网站名称', '', 0);
|
||||
|
||||
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||
`config_type`, `remark`, `extra`, `read_only`)
|
||||
VALUES ('manager_web_logo', '2022-02-24 11:56:53', '2022-02-24 11:56:53', 0, 'manager_web_logo', '', 1,
|
||||
'网站LOGO', '', 0);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tiesheng.core.mapper.CoreConfigEnumMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreConfigEnum">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_config_enum-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="ext" jdbcType="VARCHAR" property="ext" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, `type`, `name`, remark, ext
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tiesheng.core.mapper.CoreConfigSystemMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreConfigSystem">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_config_system-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="config_key" jdbcType="VARCHAR" property="configKey" />
|
||||
<result column="config_val" jdbcType="LONGVARCHAR" property="configVal" />
|
||||
<result column="config_type" jdbcType="INTEGER" property="configType" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="extra" jdbcType="VARCHAR" property="extra" />
|
||||
<result column="read_only" jdbcType="INTEGER" property="readOnly" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, config_key, config_val, config_type, remark,
|
||||
extra, read_only
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tiesheng.core.mapper.CoreLogLoginMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreLogLogin">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_log_login-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="platform" jdbcType="VARCHAR" property="platform" />
|
||||
<result column="ip" jdbcType="VARCHAR" property="ip" />
|
||||
<result column="address" jdbcType="VARCHAR" property="address" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, user_id, user_name, platform, ip, address
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tiesheng.core.mapper.CoreLogMessageMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreLogMessage">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_log_message-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="target" jdbcType="VARCHAR" property="target" />
|
||||
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
||||
<result column="resp_body" jdbcType="LONGVARCHAR" property="respBody" />
|
||||
<result column="result" jdbcType="INTEGER" property="result" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, `type`, target, content, resp_body, `result`
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tiesheng.core.mapper.CoreLogOperationMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreLogOperation">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_log_operation-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="user_name" jdbcType="VARCHAR" property="userName" />
|
||||
<result column="title" jdbcType="VARCHAR" property="title" />
|
||||
<result column="subject" jdbcType="VARCHAR" property="subject" />
|
||||
<result column="params" jdbcType="LONGVARCHAR" property="params" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, user_id, user_name, title, subject, params
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tiesheng.core.mapper.CorePlatformUniqueMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CorePlatformUnique">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_platform_unique-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="app_id" jdbcType="VARCHAR" property="appId" />
|
||||
<result column="unique_id" jdbcType="VARCHAR" property="uniqueId" />
|
||||
<result column="platform" jdbcType="VARCHAR" property="platform" />
|
||||
<result column="info" jdbcType="LONGVARCHAR" property="info" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, user_id, app_id, unique_id, platform, info
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user