fix: 码全代码添加
This commit is contained in:
38
template/cvbp/cvbp-base/.gitignore
vendored
Normal file
38
template/cvbp/cvbp-base/.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
137
template/cvbp/cvbp-base/pom.xml
Normal file
137
template/cvbp/cvbp-base/pom.xml
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.codvision</groupId>
|
||||
<artifactId>cvbp</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>cvbp-base</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<description>基础平台-基础能力中心</description>
|
||||
|
||||
<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>com.codvision</groupId>
|
||||
<artifactId>cvbp-web-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.codvision</groupId>
|
||||
<artifactId>cvbp-auth-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.codvision</groupId>
|
||||
<artifactId>cvbp-web-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.codvision</groupId>
|
||||
<artifactId>cvbp-db-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-s3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- quartz定时器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.codvision</groupId>
|
||||
<artifactId>cvbp-log-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<properties>
|
||||
<profiles.active>dev</profiles.active>
|
||||
</properties>
|
||||
<activation>
|
||||
<!-- 默认环境 -->
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>prd</id>
|
||||
<properties>
|
||||
<profiles.active>prd</profiles.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classifier>exec</classifier>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<excludes>
|
||||
<exclude>static/**/*.woff</exclude>
|
||||
<exclude>static/**/*.woff2</exclude>
|
||||
<exclude>static/**/*.ttf</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>static/**/*.woff</include>
|
||||
<include>static/**/*.woff2</include>
|
||||
<include>static/**/*.ttf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<encoding>utf-8</encoding>
|
||||
<useDefaultDelimiters>true</useDefaultDelimiters>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base;
|
||||
|
||||
import com.codvision.webcore.util.WebUtil;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
/**
|
||||
* 基础能力中心启动入口
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class BaseApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(BaseApplication.class, args);
|
||||
WebUtil.printWebUrl(application.getEnvironment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.codvision.base.annotation;
|
||||
|
||||
|
||||
import com.codvision.base.config.excel.select.ExcelDynamicSelect;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface ExcelSelected {
|
||||
/**
|
||||
* 固定下拉内容
|
||||
*/
|
||||
String[] source() default {};
|
||||
|
||||
/**
|
||||
* 动态下拉内容
|
||||
*/
|
||||
Class<? extends ExcelDynamicSelect>[] sourceClass() default {};
|
||||
|
||||
/**
|
||||
* 设置下拉框的起始行,默认为第二行
|
||||
*/
|
||||
int firstRow() default 1;
|
||||
|
||||
/**
|
||||
* 设置下拉框的结束行,默认为最后一行
|
||||
*/
|
||||
int lastRow() default 0x10000;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.config;
|
||||
|
||||
import com.codvision.base.filter.LoginFilter;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
|
||||
/**
|
||||
* 文件存储配置
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = "com.codvision.base")
|
||||
public class BaseConfig {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<LoginFilter> staticResourceLoginFilter() {
|
||||
FilterRegistrationBean<LoginFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setName("loginCheckFilter");
|
||||
registration.setFilter(new LoginFilter());
|
||||
registration.addUrlPatterns("/backend/*");
|
||||
// 指定优先级
|
||||
registration.setOrder(-1);
|
||||
return registration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.config;
|
||||
|
||||
import com.baomidou.mybatisplus.generator.config.OutputFile;
|
||||
import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* velocity模板引擎扩展
|
||||
* <p>
|
||||
* 生成代码使用
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/5/21
|
||||
*/
|
||||
public class EnhanceVelocityTemplateEngine extends VelocityTemplateEngine {
|
||||
|
||||
@Override
|
||||
protected void outputCustomFile(@NotNull List<CustomFile> customFiles, @NotNull TableInfo tableInfo, @NotNull Map<String, Object> objectMap) {
|
||||
String entityName = tableInfo.getEntityName();
|
||||
String otherPath = this.getPathInfo(OutputFile.entity);
|
||||
customFiles.forEach(item -> {
|
||||
String fileName = String.format(otherPath + File.separator + "vo" + File.separator + entityName + "%s",
|
||||
item.getFileName());
|
||||
this.outputFile(new File(fileName), objectMap, item.getTemplatePath(), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.config;
|
||||
|
||||
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* swagger配置
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/4
|
||||
*/
|
||||
@Configuration("baseSwaggerConfig")
|
||||
@EnableSwagger2
|
||||
@EnableSwaggerBootstrapUI
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public Docket baseApiConfig() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
// 创建接口文档的具体信息
|
||||
.apiInfo(webApiInfo())
|
||||
// 创建选择器,控制哪些接口被加入文档
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.codvision.base"))
|
||||
// 指定@ApiOperation标注的接口被加入文档
|
||||
//.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
.build().groupName("基础能力中心");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建接口文档的具体信息,会显示在接口文档页面中
|
||||
*
|
||||
* @return ApiInfo
|
||||
*/
|
||||
private ApiInfo webApiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
// 文档标题
|
||||
.title("基础能力中心接口管理")
|
||||
// 文档描述
|
||||
.description("基础能力中心接口文档")
|
||||
// 版本
|
||||
.version("1.0")
|
||||
// 版权
|
||||
.license("Codvision")
|
||||
// 版权地址
|
||||
.licenseUrl("http://www.codvision.com")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.codvision.base.config.excel;
|
||||
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.codvision.authcore.bean.SysUserBean;
|
||||
import com.codvision.authcore.util.AuthUtil;
|
||||
import com.codvision.base.config.excel.custom.CustomErrorCellWriteHandler;
|
||||
import com.codvision.base.entity.SysFile;
|
||||
import com.codvision.base.service.ISysFileService;
|
||||
import com.codvision.base.support.TimestampStringConverter;
|
||||
import com.codvision.base.support.WebSocketServer;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static com.codvision.base.support.BaseConst.ZIP_FILE_PREFIX;
|
||||
import static com.codvision.base.support.BaseConst.ZIP_PATH;
|
||||
|
||||
/**
|
||||
* 动态表头导出对象
|
||||
*/
|
||||
@Slf4j
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractDynamicHeaderExoprtClass {
|
||||
|
||||
|
||||
private static final int DEFAULT_PAGE_SIZE = 1000;
|
||||
private ISysFileService sysFileService;
|
||||
private WebSocketServer socketServer;
|
||||
|
||||
public AbstractDynamicHeaderExoprtClass() {
|
||||
this.sysFileService = SpringUtil.getBean(ISysFileService.class);
|
||||
this.socketServer = SpringUtil.getBean(WebSocketServer.class);
|
||||
}
|
||||
|
||||
protected abstract List<List<Object>> getList(QueryPage queryPage, Map<String, Object> paraMap);
|
||||
|
||||
/**
|
||||
* 动态表头Excel导出
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param paraMap 查询数据库参数
|
||||
* @param head 表头
|
||||
* @param flagDatabase 是否为通过数据库mapper查询
|
||||
* @return
|
||||
*/
|
||||
public String excelExport(String fileName, Map<String, Object> paraMap, List<List<String>> head, Boolean flagDatabase) {
|
||||
SysUserBean user = AuthUtil.getCurrentUser();
|
||||
|
||||
String finalFileName = IdUtil.simpleUUID() + fileName;
|
||||
//此方法返回可用处理器的虚拟机的最大数量; 不小于1
|
||||
AtomicReference<Long> fileSize = new AtomicReference<>();
|
||||
int core = Runtime.getRuntime().availableProcessors();
|
||||
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(core, core * 2 + 1, 5, TimeUnit.SECONDS, new ArrayBlockingQueue<>(15));
|
||||
threadPoolExecutor.submit(() -> {
|
||||
int index = 1;
|
||||
List<Callable<List<List<Object>>>> tasks = new ArrayList<>();
|
||||
while (true) {
|
||||
QueryPage queryPage = new QueryPage<>(index, DEFAULT_PAGE_SIZE);
|
||||
List list = getList(queryPage, paraMap);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Callable<List<List<Object>>> task = () -> list;
|
||||
tasks.add(task);
|
||||
index++;
|
||||
if (!flagDatabase) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ZipOutputStream zipout = null;
|
||||
InputStream inputStream = null;
|
||||
File zip = null;
|
||||
try {
|
||||
File savePath = new File(ZIP_PATH);
|
||||
if (!savePath.exists()) {
|
||||
// 判断导出路径是否存在,不存在创建文件夹
|
||||
savePath.setWritable(true);
|
||||
savePath.setReadable(true);
|
||||
savePath.mkdirs();
|
||||
}
|
||||
//导出压缩文件的全路径(此地址改成服务器存放地址)
|
||||
String zipFilePath = ZIP_PATH + finalFileName + ".zip";
|
||||
String zipUploafPath = ZIP_FILE_PREFIX + finalFileName + ".zip";
|
||||
//导出zip
|
||||
zip = new File(zipFilePath);
|
||||
zipout = new ZipOutputStream(new FileOutputStream(zip));
|
||||
List<Future<List<List<Object>>>> futures = threadPoolExecutor.invokeAll(tasks);
|
||||
int num = 0;
|
||||
if (futures.size() > 0) {
|
||||
for (Future<List<List<Object>>> future : futures) {
|
||||
//sheetName页名称
|
||||
String sheetName = "sheetName";
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
|
||||
EasyExcel.write(outputStream).head(head)
|
||||
// timestamp转换器,easyexcel不支持转换timestamp
|
||||
.registerConverter(new TimestampStringConverter())
|
||||
.registerWriteHandler(new CustomErrorCellWriteHandler<>(future.get()))
|
||||
.sheet(sheetName).doWrite(future.get());
|
||||
|
||||
inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
|
||||
//excel文件写入zip
|
||||
ZipEntry zipEntry = new ZipEntry(fileName + "-" + num + ".xlsx");
|
||||
zipout.putNextEntry(zipEntry);
|
||||
int len;
|
||||
byte[] buf = new byte[1024];
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
zipout.write(buf, 0, len);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
//websocket通知客户端已完成下载,请去excel任务中心下载。需要在登录完成后,配置websocket连接
|
||||
log.info("success" + "==========================" + zipUploafPath);
|
||||
socketServer.sendInfo("EXPORT_SUCCESS", Math.toIntExact(user.getId()));
|
||||
sysFileService.updateIsValidByFileName(ZIP_FILE_PREFIX + finalFileName + ".zip");
|
||||
fileSize.set(zip.getTotalSpace());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
if (e instanceof RejectedExecutionException) {
|
||||
//线程数已达最大值,且队列数已满。无法接收新线程,拒绝新线程任务。
|
||||
log.info("线程数已达最大值,且队列数已满。无法接收新线程,拒绝新线程任务。");
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
zipout.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
//记录下载文件的记录
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setFileName(ZIP_FILE_PREFIX + finalFileName + ".zip");
|
||||
sysFile.setOriginal(fileName + ".zip");
|
||||
sysFile.setType("zip");
|
||||
sysFile.setFileSize(fileSize.get());
|
||||
sysFile.setSource(1);
|
||||
sysFile.setIsValid(0);
|
||||
//上传位置为ECS服务器
|
||||
sysFile.setPosition("2");
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
sysFile.setCreateUser(user.getName());
|
||||
}
|
||||
sysFileService.save(sysFile);
|
||||
return ZIP_FILE_PREFIX + finalFileName + ".zip";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.codvision.base.config.excel;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.codvision.authcore.bean.SysUserBean;
|
||||
import com.codvision.authcore.util.AuthUtil;
|
||||
import com.codvision.base.config.excel.custom.CustomErrorCellWriteHandler;
|
||||
import com.codvision.base.entity.SysFile;
|
||||
import com.codvision.base.service.ISysFileService;
|
||||
import com.codvision.base.support.WebSocketServer;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static com.codvision.base.support.BaseConst.ZIP_FILE_PREFIX;
|
||||
import static com.codvision.base.support.BaseConst.ZIP_PATH;
|
||||
|
||||
|
||||
/**
|
||||
* @Author huxb
|
||||
* @description: 通用导出对象
|
||||
* @create 2023/2/21 14:53
|
||||
*/
|
||||
@Slf4j
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractExportClass<T, E> {
|
||||
|
||||
private static final int DEFAULT_PAGE_SIZE = 1000;
|
||||
private ISysFileService sysFileService;
|
||||
private WebSocketServer socketServer;
|
||||
|
||||
public AbstractExportClass() {
|
||||
this.sysFileService = SpringUtil.getBean(ISysFileService.class);
|
||||
this.socketServer = SpringUtil.getBean(WebSocketServer.class);
|
||||
}
|
||||
|
||||
protected abstract List<T> getList(QueryPage<E> queryPage, Object queryBean);
|
||||
|
||||
public String excelUser(String fileName, Object queryBean, Class<T> c) {
|
||||
SysUserBean user = AuthUtil.getCurrentUser();
|
||||
|
||||
String finalFileName = IdUtil.simpleUUID() + fileName;
|
||||
//此方法返回可用处理器的虚拟机的最大数量; 不小于1
|
||||
AtomicReference<Long> fileSize = new AtomicReference<>();
|
||||
int core = Runtime.getRuntime().availableProcessors();
|
||||
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(core, core * 2 + 1, 5, TimeUnit.SECONDS, new ArrayBlockingQueue<>(15));
|
||||
threadPoolExecutor.submit(() -> {
|
||||
int index = 1;
|
||||
List<Callable<List<T>>> tasks = new ArrayList<>();
|
||||
while (true) {
|
||||
QueryPage<E> queryPage = new QueryPage<>(index, DEFAULT_PAGE_SIZE);
|
||||
List<T> list = getList(queryPage, queryBean);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Callable<List<T>> task = () -> list;
|
||||
tasks.add(task);
|
||||
index++;
|
||||
}
|
||||
|
||||
ZipOutputStream zipout = null;
|
||||
InputStream inputStream = null;
|
||||
File zip = null;
|
||||
try {
|
||||
File savePath = new File(ZIP_PATH);
|
||||
if (!savePath.exists()) {
|
||||
// 判断导出路径是否存在,不存在创建文件夹
|
||||
savePath.setWritable(true);
|
||||
savePath.setReadable(true);
|
||||
savePath.mkdirs();
|
||||
}
|
||||
//导出压缩文件的全路径(此地址改成服务器存放地址)
|
||||
String zipFilePath = ZIP_PATH + finalFileName + ".zip";
|
||||
String zipUploafPath = ZIP_FILE_PREFIX + finalFileName + ".zip";
|
||||
//导出zip
|
||||
zip = new File(zipFilePath);
|
||||
zipout = new ZipOutputStream(new FileOutputStream(zip));
|
||||
List<Future<List<T>>> futures = threadPoolExecutor.invokeAll(tasks);
|
||||
int num = 0;
|
||||
if (futures.size() > 0) {
|
||||
for (Future<List<T>> future : futures) {
|
||||
//sheetName页名称
|
||||
String sheetName = "sheetName";
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ExcelWriter writer = EasyExcel.write(outputStream, c).build();
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet(sheetName)
|
||||
.registerWriteHandler(new CustomErrorCellWriteHandler<T>(future.get()))
|
||||
.build();
|
||||
//导出excel
|
||||
writer.write(future.get(), writeSheet);
|
||||
writer.finish();
|
||||
inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
//excel文件写入zip
|
||||
ZipEntry zipEntry = new ZipEntry(fileName + "-" + num + ".xlsx");
|
||||
zipout.putNextEntry(zipEntry);
|
||||
int len;
|
||||
byte[] buf = new byte[1024];
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
zipout.write(buf, 0, len);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
//websocket通知客户端已完成下载,请去excel任务中心下载。需要在登录完成后,配置websocket连接
|
||||
log.info("success" + "==========================" + zipUploafPath);
|
||||
socketServer.sendInfo("EXPORT_SUCCESS", Math.toIntExact(user.getId()));
|
||||
sysFileService.updateIsValidByFileName(ZIP_FILE_PREFIX + finalFileName + ".zip");
|
||||
fileSize.set(zip.getTotalSpace());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
if (e instanceof RejectedExecutionException) {
|
||||
//线程数已达最大值,且队列数已满。无法接收新线程,拒绝新线程任务。
|
||||
log.info("线程数已达最大值,且队列数已满。无法接收新线程,拒绝新线程任务。");
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
zipout.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
//记录下载文件的记录
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setFileName(ZIP_FILE_PREFIX + finalFileName + ".zip");
|
||||
sysFile.setOriginal(fileName + ".zip");
|
||||
sysFile.setType("zip");
|
||||
sysFile.setFileSize(fileSize.get());
|
||||
sysFile.setSource(1);
|
||||
sysFile.setIsValid(0);
|
||||
//上传位置为ECS服务器
|
||||
sysFile.setPosition("2");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
sysFile.setCreateUser(user.getName());
|
||||
}
|
||||
sysFileService.save(sysFile);
|
||||
return ZIP_FILE_PREFIX + finalFileName + ".zip";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.codvision.base.config.excel;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.exception.ExcelDataConvertException;
|
||||
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||
import com.alibaba.excel.read.listener.ReadListener;
|
||||
import com.alibaba.excel.util.ConverterUtils;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.codvision.base.entity.ExcelCheck;
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import com.codvision.base.service.IExcelErrorRecordService;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author huxb
|
||||
* @description: excel导入通用读数据
|
||||
* 有个很重要的点 Listener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
||||
* @create 2023/2/22 11:07
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
@Slf4j
|
||||
public abstract class ExcelDataReadListener<T> implements ReadListener<T> {
|
||||
|
||||
/**
|
||||
* 数据批量入库阈值
|
||||
*/
|
||||
private static final int BATCH_COUNT = 100;
|
||||
|
||||
/**
|
||||
* 数据校验对象
|
||||
*/
|
||||
private final ExcelCheck<T> check = new ExcelCheck(BATCH_COUNT);
|
||||
|
||||
/**
|
||||
* 数据异常记录Mapper
|
||||
*/
|
||||
private final IExcelErrorRecordService service;
|
||||
|
||||
|
||||
private final Consumer<List<T>> consumer;
|
||||
|
||||
/**
|
||||
* 数据校验
|
||||
*
|
||||
* @param data
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected abstract void validator(T data, ExcelCheck<T> check, AnalysisContext context);
|
||||
|
||||
public ExcelDataReadListener(Consumer<List<T>> consumer) {
|
||||
this.service = SpringUtil.getBean(IExcelErrorRecordService.class);
|
||||
this.consumer = consumer;
|
||||
}
|
||||
|
||||
public boolean isHeadAbnormal() {
|
||||
return check.getHeadAbnormal();
|
||||
}
|
||||
|
||||
public boolean existErrorData() {
|
||||
return check.getExistErrorData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
|
||||
Map<Integer, String> head = new HashMap<>();
|
||||
Map<Integer, String> map = ConverterUtils.convertToStringMap(headMap, context);
|
||||
if (map.size() <= 0) {
|
||||
check.setHeadAbnormal(true);
|
||||
throw new BusinessException("文件格式错误,请检查导入模板");
|
||||
}
|
||||
try {
|
||||
head = getIndexNameMap((Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Set<Integer> keySet = head.keySet();
|
||||
for (Integer key : keySet) {
|
||||
if (StringUtils.isEmpty(map.get(key)) || !map.get(key).equals(head.get(key))) {
|
||||
check.setHeadAbnormal(true);
|
||||
throw new BusinessException("文件格式错误,请检查导入模板");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取每一行数据都会回调该方法
|
||||
*
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void invoke(T data, AnalysisContext context) {
|
||||
// 若一行数据均为空值,则过滤
|
||||
if (isLineNullValue(data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 数据校验
|
||||
validator(data, check, context);
|
||||
|
||||
// 判断是否达到阈值,进行数据入库,防止大量数据存储在内存中造成OOM
|
||||
if (check.getCacheList().size() >= BATCH_COUNT) {
|
||||
consumer.accept(check.getCacheList());
|
||||
check.setCacheList(ListUtils.newArrayListWithExpectedSize(BATCH_COUNT));
|
||||
}
|
||||
|
||||
if (check.getErrorList().size() >= BATCH_COUNT) {
|
||||
check.setExistErrorData(true);
|
||||
saveErrorInfo(check.getErrorList());
|
||||
check.setErrorList(ListUtils.newArrayListWithExpectedSize(BATCH_COUNT));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有行的读取都结束后触发
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 这里也要保存数据,因为最后一次的遍历可能不满100条的时候,不会触发invoke()方法中的数据入库逻辑,以便确保遗留的数据也存储到数据库
|
||||
if (CollectionUtils.isNotEmpty(check.getCacheList())) {
|
||||
consumer.accept(check.getCacheList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(check.getErrorList())) {
|
||||
check.setExistErrorData(true);
|
||||
saveErrorInfo(check.getErrorList());
|
||||
}
|
||||
log.info("所有数据解析完成!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 在转换异常 获取其他异常下会调用本接口。抛出异常则停止读取。如果这里不抛出异常则 继续读取下一行。
|
||||
*
|
||||
* @param exception
|
||||
* @param context
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void onException(Exception exception, AnalysisContext context) {
|
||||
log.error("解析失败,但是继续解析下一行:{}", exception.getMessage());
|
||||
if (exception instanceof ExcelDataConvertException) {
|
||||
ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception;
|
||||
log.error("第{}行,第{}列解析异常,数据为:{}", excelDataConvertException.getRowIndex(),
|
||||
excelDataConvertException.getColumnIndex(), excelDataConvertException.getCellData());
|
||||
}
|
||||
|
||||
if (exception instanceof BusinessException) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常校验信息入库
|
||||
*
|
||||
* @param errors
|
||||
*/
|
||||
public void saveErrorInfo(List<ExcelErrorRecord> errors) {
|
||||
if (CollectionUtils.isNotEmpty(errors)) {
|
||||
service.saveBatch(errors);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<Integer, String> getIndexNameMap(Class clazz) throws NoSuchFieldException {
|
||||
Map<Integer, String> result = new HashMap<>();
|
||||
Field field;
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
int n = 0;
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
field = clazz.getDeclaredField(fields[i].getName());
|
||||
field.setAccessible(true);
|
||||
ExcelProperty excelProperty = field.getAnnotation(ExcelProperty.class);
|
||||
if (excelProperty != null) {
|
||||
String[] values = excelProperty.value();
|
||||
StringBuilder value = new StringBuilder();
|
||||
for (String v : values) {
|
||||
value.append(v);
|
||||
}
|
||||
result.put(n++, value.toString());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isLineNullValue(T data) {
|
||||
if (data instanceof String) {
|
||||
return StringUtils.isBlank((String) data);
|
||||
}
|
||||
try {
|
||||
List<Field> fields = Arrays.stream(data.getClass().getDeclaredFields())
|
||||
.filter(f -> f.isAnnotationPresent(ExcelProperty.class))
|
||||
.collect(Collectors.toList());
|
||||
List<Boolean> lineNullList = new ArrayList<>(fields.size());
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
if (field.get(data) == null) {
|
||||
lineNullList.add(Boolean.TRUE);
|
||||
} else {
|
||||
lineNullList.add(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
return lineNullList.stream().allMatch(Boolean.TRUE::equals);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.codvision.base.config.excel.custom;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||
import com.alibaba.excel.util.BooleanUtils;
|
||||
import com.alibaba.excel.write.handler.CellWriteHandler;
|
||||
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自定义拦截器,数据异常项设置字体颜色(红色)和错误信息批注
|
||||
*
|
||||
* @author hxl
|
||||
*/
|
||||
public class CustomErrorCellWriteHandler<T> implements CellWriteHandler {
|
||||
|
||||
private final List<T> list;
|
||||
|
||||
public CustomErrorCellWriteHandler(List<T> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCellDispose(CellWriteHandlerContext context) {
|
||||
Cell cell = context.getCell();
|
||||
if (BooleanUtils.isNotTrue(context.getHead()) && cell.getRowIndex() >= 1) {
|
||||
T t = list.get(cell.getRowIndex() - 1);
|
||||
if (t instanceof ExcelErrorRecord) {
|
||||
ExcelErrorRecord record = (ExcelErrorRecord) t;
|
||||
if (StringUtils.isBlank(record.getErrorMsgJson())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据表头字段获取对应的错误信息
|
||||
Map<String, Object> errorMsgMap = jsonToMap(record.getErrorMsgJson());
|
||||
String commentStr = (String) errorMsgMap.get(context.getHeadData().getFieldName());
|
||||
if (StringUtils.isNotBlank(commentStr)) {
|
||||
// 设置标注
|
||||
Sheet sheet = context.getWriteSheetHolder().getSheet();
|
||||
Drawing<?> drawingPatriarch = sheet.createDrawingPatriarch();
|
||||
Comment comment = drawingPatriarch.createCellComment(
|
||||
new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRowIndex(),
|
||||
(short) cell.getColumnIndex() + 2, cell.getRowIndex() + 2));
|
||||
comment.setString(new XSSFRichTextString(commentStr));
|
||||
cell.setCellComment(comment);
|
||||
|
||||
// 设置字体颜色、加粗
|
||||
WriteCellData<?> cellData = context.getFirstCellData();
|
||||
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
|
||||
WriteFont cellWriteFont = new WriteFont();
|
||||
cellWriteFont.setBold(true);
|
||||
cellWriteFont.setColor(IndexedColors.RED.getIndex());
|
||||
writeCellStyle.setWriteFont(cellWriteFont);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> jsonToMap(String json) {
|
||||
Map<String, Object> resultMap = new HashMap<>(16);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(json);
|
||||
for (Map.Entry<String, Object> next : jsonObject.entrySet()) {
|
||||
resultMap.put(next.getKey(), next.getValue());
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.codvision.base.config.excel.select;
|
||||
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Data
|
||||
public class CustomSheetWriteHandler implements SheetWriteHandler {
|
||||
|
||||
private final Map<Integer, ExcelSelectedResolve> selectedMap;
|
||||
|
||||
@Override
|
||||
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
//设置空白单元格的格式为文本
|
||||
for (int i = 0; i < 100; i++) {
|
||||
// 设置为文本格式
|
||||
SXSSFSheet sxssfSheet = (SXSSFSheet) writeSheetHolder.getSheet();
|
||||
CellStyle cellStyle = writeWorkbookHolder.getCachedWorkbook().createCellStyle();
|
||||
// 49为文本格式
|
||||
cellStyle.setDataFormat((short) 49);
|
||||
// i为列,一整列设置为文本格式
|
||||
sxssfSheet.setDefaultColumnStyle(i, cellStyle);
|
||||
}
|
||||
|
||||
Sheet sheet = writeSheetHolder.getSheet();
|
||||
DataValidationHelper helper = sheet.getDataValidationHelper();
|
||||
// 获取工作簿
|
||||
// 创建sheet,突破下拉框255的限制
|
||||
// 获取一个workbook
|
||||
Workbook workbook = writeWorkbookHolder.getWorkbook();
|
||||
|
||||
//2.循环赋值(为了防止下拉框的行数与隐藏域的行数相对应,将隐藏域加到结束行之后)
|
||||
selectedMap.forEach((k, v) -> {
|
||||
// 定义sheet的名称
|
||||
String sheetName = "hidden" + k;
|
||||
// 1.创建一个隐藏的sheet 名称为 providerSheet
|
||||
Sheet providerSheet = workbook.createSheet(sheetName);
|
||||
|
||||
// 设置下拉列表的行: 首行,末行,首列,末列
|
||||
CellRangeAddressList rangeList = new CellRangeAddressList(v.getFirstRow(), v.getLastRow(), k, k);
|
||||
for (int i = 0, length = v.getSource().length; i < length; i++) {
|
||||
// i:表示你开始的行数 0表示你开始的列数
|
||||
Row row = providerSheet.getRow(i);
|
||||
if (row == null) {
|
||||
row = providerSheet.createRow(i);
|
||||
}
|
||||
row.createCell(k).setCellValue(v.getSource()[i]);
|
||||
}
|
||||
//4 $A$1:$A$N代表 以A列1行开始获取N行下拉数据
|
||||
String excelLine = getExcelLine(k);
|
||||
String refers = "=" + sheetName + "!$" + excelLine + "$1:$" + excelLine + "$" + (v.getSource().length);
|
||||
// 设置下拉列表的值
|
||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(refers);
|
||||
// 设置约束
|
||||
DataValidation validation = helper.createValidation(constraint, rangeList);
|
||||
// 阻止输入非下拉选项的值
|
||||
validation.setErrorStyle(DataValidation.ErrorStyle.STOP);
|
||||
validation.setShowErrorBox(true);
|
||||
validation.setSuppressDropDownArrow(true);
|
||||
validation.createErrorBox("提示", "请选择下拉选项中的内容");
|
||||
sheet.addValidationData(validation);
|
||||
//设置列为隐藏
|
||||
int hiddenIndex = workbook.getSheetIndex(sheetName);
|
||||
if (!workbook.isSheetHidden(hiddenIndex)) {
|
||||
workbook.setSheetHidden(hiddenIndex, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param num 列数
|
||||
* @return java.lang.String
|
||||
* @Description 返回excel列标A-Z-AA-ZZ
|
||||
*/
|
||||
public static String getExcelLine(int num) {
|
||||
String line = "";
|
||||
int first = num / 26;
|
||||
int second = num % 26;
|
||||
if (first > 0) {
|
||||
line = (char) ('A' + first - 1) + "";
|
||||
}
|
||||
line += (char) ('A' + second) + "";
|
||||
return line;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.codvision.base.config.excel.select;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
public interface ExcelDynamicSelect {
|
||||
|
||||
/**
|
||||
* 获取动态生成的下拉框可选数据
|
||||
* @return
|
||||
*/
|
||||
String[] getSource();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.codvision.base.config.excel.select;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.codvision.base.annotation.ExcelSelected;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class ExcelSelectedResolve {
|
||||
|
||||
/**
|
||||
* 下拉内容
|
||||
*/
|
||||
private String[] source;
|
||||
|
||||
/**
|
||||
* 设置下拉框的起始行,默认为第二行
|
||||
*/
|
||||
private int firstRow;
|
||||
|
||||
/**
|
||||
* 设置下拉框的结束行,默认为最后一行
|
||||
*/
|
||||
private int lastRow;
|
||||
|
||||
public String[] resolveSelectedSource(ExcelSelected excelSelected) {
|
||||
if (excelSelected == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取固定下拉框的内容
|
||||
String[] source = excelSelected.source();
|
||||
if (ArrayUtil.isNotEmpty(source)) {
|
||||
return source;
|
||||
}
|
||||
|
||||
// 获取动态下拉框的内容
|
||||
Class<? extends ExcelDynamicSelect>[] classes = excelSelected.sourceClass();
|
||||
if (classes.length > 0) {
|
||||
try {
|
||||
ExcelDynamicSelect excelDynamicSelect = classes[0].newInstance();
|
||||
String[] dynamicSelectSource = excelDynamicSelect.getSource();
|
||||
if (dynamicSelectSource != null && dynamicSelectSource.length > 0) {
|
||||
return dynamicSelectSource;
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
log.error("解析动态下拉框数据异常", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.codvision.base.config.quartz;
|
||||
|
||||
|
||||
import org.quartz.spi.TriggerFiredBundle;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author KX
|
||||
* @date 2023/3/6 11:45
|
||||
*/
|
||||
@Component
|
||||
public class JobFactory extends SpringBeanJobFactory {
|
||||
@Resource
|
||||
private AutowireCapableBeanFactory capableBeanFactory;
|
||||
|
||||
@Override
|
||||
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
|
||||
// 调用父类的方法
|
||||
Object jobInstance = super.createJobInstance(bundle);
|
||||
// 进行注入
|
||||
capableBeanFactory.autowireBean(jobInstance);
|
||||
return jobInstance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.codvision.base.config.quartz;
|
||||
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author KX
|
||||
* @date 2023/3/6 11:46
|
||||
*/
|
||||
@Configuration
|
||||
public class QuartzConfig {
|
||||
|
||||
@Resource
|
||||
private JobFactory jobFactory;
|
||||
|
||||
@Resource
|
||||
private DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean() {
|
||||
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
|
||||
try {
|
||||
schedulerFactoryBean.setJobFactory(jobFactory);
|
||||
// 任何作业是否应覆盖现有作业定义。
|
||||
schedulerFactoryBean.setOverwriteExistingJobs(true);
|
||||
// 设置调度器在应用程序启动后多长时间启动
|
||||
schedulerFactoryBean.setStartupDelay(3);
|
||||
schedulerFactoryBean.setQuartzProperties(quartzProperties());
|
||||
schedulerFactoryBean.setDataSource(dataSource);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return schedulerFactoryBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从配置文件中获取对应的配置
|
||||
*
|
||||
* @return 返回配置文件
|
||||
* @throws IOException 读取文件异常
|
||||
*/
|
||||
@Bean
|
||||
public Properties quartzProperties() throws IOException {
|
||||
PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
|
||||
propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties"));
|
||||
propertiesFactoryBean.afterPropertiesSet();
|
||||
return propertiesFactoryBean.getObject();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Scheduler scheduler() {
|
||||
return schedulerFactoryBean().getScheduler();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.controller.backend;
|
||||
|
||||
import cn.hutool.core.codec.Base64Decoder;
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.codvision.base.entity.BackendUser;
|
||||
import com.codvision.base.filter.LoginFilter;
|
||||
import com.codvision.base.service.IBackendUserService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import com.codvision.commoncore.utils.Md5Utils;
|
||||
import com.codvision.webcore.annotation.ApiSecret;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 框架后台管理登录
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
@ApiSecret(ignore = true)
|
||||
@RestController
|
||||
@RequestMapping("/backend/api/user")
|
||||
@Api(tags = "框架后台管理-认证模块")
|
||||
public class BackendUserController {
|
||||
|
||||
@Resource
|
||||
private IBackendUserService backendUserService;
|
||||
|
||||
@ApiOperation(value = "登录接口")
|
||||
@PostMapping(value = "/login")
|
||||
public ResponseEntity<BackendUser> getRegion(HttpServletRequest request,
|
||||
@ApiParam(value = "用户名", required = true) @RequestParam String username,
|
||||
@ApiParam(value = "密码", required = true) @RequestParam String password) {
|
||||
password = Base64Decoder.decodeStr(password);
|
||||
BackendUser backendUser = backendUserService.getOne(Wrappers.<BackendUser>lambdaQuery().eq(BackendUser::getUsername, username));
|
||||
if (ObjectUtils.isEmpty(backendUser) || !DigestUtil.bcryptCheck(password, backendUser.getPassword())) {
|
||||
throw new BusinessException("用户名或密码错误");
|
||||
}
|
||||
backendUser.setPassword(null);
|
||||
request.getSession().setAttribute(LoginFilter.LOGIN_SESSION_KEY, backendUser);
|
||||
return new ResponseEntity().ok().data(backendUser);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取基础用户信息")
|
||||
@GetMapping(value = "/getUserInfo")
|
||||
public ResponseEntity<BackendUser> getBaseUser(HttpServletRequest request) {
|
||||
BackendUser backendUser = (BackendUser) request.getSession().getAttribute(LoginFilter.LOGIN_SESSION_KEY);
|
||||
if (ObjectUtils.isEmpty(backendUser)) {
|
||||
throw new BusinessException("用户未登录");
|
||||
}
|
||||
return new ResponseEntity().ok().data(backendUser);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "退出登录")
|
||||
@GetMapping(value = "/logout")
|
||||
public ResponseEntity<String> logout(HttpServletRequest request) {
|
||||
request.getSession().invalidate();
|
||||
return new ResponseEntity().ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改密码接口")
|
||||
@PostMapping(value = "/updatePassword")
|
||||
public ResponseEntity<String> updatePassword(
|
||||
HttpServletRequest request,
|
||||
@ApiParam(value = "旧密码", required = true) @RequestParam String oldPassword,
|
||||
@ApiParam(value = "新密码", required = true) @RequestParam String newPassword,
|
||||
@ApiParam(value = "重复密码", required = true) @RequestParam String againPassword) {
|
||||
BackendUser backendUser = (BackendUser) request.getSession().getAttribute(LoginFilter.LOGIN_SESSION_KEY);
|
||||
if (ObjectUtils.isEmpty(backendUser)) {
|
||||
throw new BusinessException("用户未登录");
|
||||
}
|
||||
|
||||
if (!newPassword.equals(againPassword)) {
|
||||
throw new BusinessException("两次输入密码不一致");
|
||||
}
|
||||
|
||||
BackendUser curUser = backendUserService.getById(backendUser.getId());
|
||||
if (!DigestUtil.bcryptCheck(oldPassword, curUser.getPassword())) {
|
||||
throw new BusinessException("旧密码输入错误");
|
||||
}
|
||||
|
||||
curUser.setPassword(DigestUtil.bcrypt(newPassword));
|
||||
backendUserService.updateById(curUser);
|
||||
return new ResponseEntity().ok().message("修改成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.codvision.base.controller.backend;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.GeneratorConfig;
|
||||
import com.codvision.base.entity.vo.GeneratorConfigVO;
|
||||
import com.codvision.base.service.IGeneratorConfigService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.webcore.annotation.ApiSecret;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生成代码配置 管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-03
|
||||
*/
|
||||
@ApiSecret(ignore = true)
|
||||
@RestController
|
||||
@RequestMapping("/backend/api/generator")
|
||||
@Api(tags = "框架后台管理-生成代码模块")
|
||||
public class GeneratorConfigController {
|
||||
|
||||
@Autowired
|
||||
private IGeneratorConfigService generatorConfigService;
|
||||
|
||||
@ApiOperation(value = "获取生成代码配置详情", notes = "获取生成代码配置详情接口")
|
||||
@PostMapping("/getDetail")
|
||||
public ResponseEntity<GeneratorConfigVO> getById(@ApiParam(value = "生成代码配置ID", required = true) @RequestParam Long id) {
|
||||
GeneratorConfigVO vo = generatorConfigService.getDetail(id);
|
||||
return new ResponseEntity<GeneratorConfigVO>().ok().data(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取生成代码配置分页列表", notes = "获取生成代码配置分页列表接口")
|
||||
@PostMapping("/getPageList")
|
||||
public ResponseEntity<IPage<GeneratorConfigVO>> getPageList(@RequestBody QueryPage<GeneratorConfig> queryPage) {
|
||||
IPage<GeneratorConfigVO> pageResult = generatorConfigService.getPageResult(queryPage);
|
||||
return new ResponseEntity<IPage<GeneratorConfigVO>>().ok().data(pageResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增生成代码配置", notes = "新增生成代码配置接口")
|
||||
@PostMapping("/save")
|
||||
public ResponseEntity<String> saveGeneratorConfig(@Valid @RequestBody GeneratorConfig generatorConfig) {
|
||||
generatorConfigService.save(generatorConfig);
|
||||
return new ResponseEntity<String>().ok().message("添加成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除生成代码配置", notes = "删除生成代码配置接口")
|
||||
@PostMapping("/delete")
|
||||
public ResponseEntity<String> deleteById(@ApiParam(value = "生成代码配置ID", required = true) @RequestParam Long id) {
|
||||
generatorConfigService.removeById(id);
|
||||
return new ResponseEntity<String>().ok().message("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除生成代码配置", notes = "批量删除生成代码配置接口")
|
||||
@PostMapping("/deleteBatch")
|
||||
public ResponseEntity<String> deleteBatch(@ApiParam(value = "生成代码配置ID", required = true) @RequestBody List<Long> ids) {
|
||||
generatorConfigService.removeBatchByIds(ids);
|
||||
return new ResponseEntity<String>().ok().message("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑生成代码配置", notes = "编辑接生成代码配置接口")
|
||||
@PostMapping("/update")
|
||||
public ResponseEntity<String> updateGeneratorConfig(@RequestBody GeneratorConfig generatorConfig) {
|
||||
generatorConfigService.updateById(generatorConfig);
|
||||
return new ResponseEntity<String>().ok().message("编辑成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取生成代码配置所有列表", notes = "获取生成代码配置所有列表接口")
|
||||
@PostMapping("/listAll")
|
||||
public ResponseEntity<List<GeneratorConfigVO>> listAll(@RequestBody GeneratorConfig queryBean) {
|
||||
List<GeneratorConfigVO> list = generatorConfigService.listAll(queryBean);
|
||||
return new ResponseEntity<List<GeneratorConfigVO>>().ok().data(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "生成代码", notes = "生成代码接口")
|
||||
@PostMapping("/generate")
|
||||
public ResponseEntity<String> generate(
|
||||
@ApiParam(value = "生成代码配置ID", required = true) @RequestParam Long id) {
|
||||
generatorConfigService.generateCode(id);
|
||||
return new ResponseEntity<String>().ok().message("代码生成成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import com.codvision.base.service.IExcelErrorRecordService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.webcore.annotation.ApiSecret;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* Excel导入异常信息记录管理
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-20
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/excelErrorRecord")
|
||||
@Api(tags = "平台管理端-Excel导入异常信息记录")
|
||||
public class ManagerExcelErrorRecordController {
|
||||
|
||||
@Resource
|
||||
private IExcelErrorRecordService service;
|
||||
|
||||
@PostMapping("/findAll")
|
||||
@ApiOperation("通用查询")
|
||||
public ResponseEntity<IPage<ExcelErrorRecord>> findAll(@RequestParam(value = "reqNo") String reqNo,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
ResponseEntity<IPage<ExcelErrorRecord>> responseEntity = new ResponseEntity<>();
|
||||
|
||||
LambdaQueryWrapper<ExcelErrorRecord> wrapper = Wrappers.<ExcelErrorRecord>lambdaQuery().eq(ExcelErrorRecord::getReqNo, reqNo);
|
||||
IPage<ExcelErrorRecord> pageResult = service.page(new QueryPage<ExcelErrorRecord>(page, size).getPage(), wrapper);
|
||||
|
||||
return responseEntity.ok().data(pageResult);
|
||||
}
|
||||
|
||||
@ApiSecret(ignore = true)
|
||||
@ApiOperation("异常数据导出")
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> excelExport(@RequestParam(value = "reqNo") String reqNo) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
|
||||
service.excelExport(reqNo);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.base.entity.LocalIconLibrary;
|
||||
import com.codvision.base.entity.vo.LocalIconLibraryVO;
|
||||
import com.codvision.base.service.ILocalIconLibraryService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 本地图标 管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/localIconLibrary")
|
||||
@Api(tags = "平台管理端-本地图标管理模块")
|
||||
public class ManagerLocalIconLibraryController {
|
||||
|
||||
@Autowired
|
||||
private ILocalIconLibraryService localIconLibraryService;
|
||||
|
||||
@ApiOperation(value = "获取本地图标分页列表", notes = "获取本地图标分页列表接口")
|
||||
@PostMapping("/findAll")
|
||||
@RequiresPermissions("local_icon_library_list")
|
||||
public ResponseEntity<IPage<LocalIconLibraryVO>> findAll(@RequestParam(required = false) String keyword,
|
||||
@RequestParam(required = false) Integer type,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
LocalIconLibrary queryBean = new LocalIconLibrary();
|
||||
queryBean.setIconName(keyword);
|
||||
queryBean.setType(type);
|
||||
IPage<LocalIconLibraryVO> pageResult = localIconLibraryService.getPageResult(new QueryPage<>(queryBean, page, size));
|
||||
return new ResponseEntity<IPage<LocalIconLibraryVO>>().ok().data(pageResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增本地图标", notes = "新增本地图标接口")
|
||||
@PostMapping("/add")
|
||||
@RequiresPermissions("local_icon_library_add")
|
||||
public ResponseEntity<String> addLocalIconLibrary(@Valid @RequestBody LocalIconLibrary localIconLibrary) {
|
||||
localIconLibraryService.save(localIconLibrary);
|
||||
return new ResponseEntity<String>().ok().message("添加成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑本地图标", notes = "编辑本地图标接口")
|
||||
@PostMapping("/update")
|
||||
@RequiresPermissions("local_icon_library_edit")
|
||||
public ResponseEntity<String> updateLocalIconLibrary(@RequestBody LocalIconLibrary localIconLibrary) {
|
||||
localIconLibraryService.updateById(localIconLibrary);
|
||||
return new ResponseEntity<String>().ok().message("编辑成功");
|
||||
}
|
||||
|
||||
@PostMapping("/batchDel")
|
||||
@ApiOperation(value = "批量删除", notes = "批量删除接口")
|
||||
@RequiresPermissions("local_icon_library_del")
|
||||
public ResponseEntity<String> batchDel(@RequestBody List<Integer> idList) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
if (CollectionUtils.isEmpty(idList)) {
|
||||
throw new BusinessException(30002);
|
||||
}
|
||||
localIconLibraryService.removeBatchByIds(idList);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.base.entity.QuartzJob;
|
||||
import com.codvision.base.service.IQuartzJobService;
|
||||
import com.codvision.base.support.QuartzJobManager;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* quartz任务管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-20
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/quartzJob")
|
||||
@Api(tags = "平台管理端-quartz任务管理模块")
|
||||
public class ManagerQuartzJobController {
|
||||
|
||||
@Resource
|
||||
private IQuartzJobService quartzJobService;
|
||||
|
||||
@Resource
|
||||
private QuartzJobManager quartzJobManager;
|
||||
|
||||
@ApiOperation(value = "获取quartz任务管理分页列表", notes = "获取quartz任务管理分页列表接口")
|
||||
@PostMapping("/getJobList")
|
||||
@RequiresPermissions("tool_quartz_list")
|
||||
public ResponseEntity<IPage<QuartzJob>> getPageList(@ApiParam(value = "任务名称") @RequestParam(value = "jobName", required = false) String jobName,
|
||||
@ApiParam(value = "任务分组") @RequestParam(value = "jobGroup", required = false) String jobGroup,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
QuartzJob queryBean = new QuartzJob();
|
||||
queryBean.setJobName(jobName);
|
||||
queryBean.setJobGroup(jobGroup);
|
||||
IPage<QuartzJob> pageResult = quartzJobService.getPageResult(new QueryPage<>(queryBean, page, size));
|
||||
return new ResponseEntity<IPage<QuartzJob>>().ok().data(pageResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增定时任务", notes = "新增定时任务接口")
|
||||
@PostMapping("/addJob")
|
||||
@RequiresPermissions("tool_quartz_add")
|
||||
public ResponseEntity<QuartzJob> addJob(@Valid @RequestBody QuartzJob quartzJob) {
|
||||
QuartzJob result = quartzJobService.addQuartzJob(quartzJob);
|
||||
|
||||
return new ResponseEntity<QuartzJob>().ok().data(result).message("添加成功");
|
||||
}
|
||||
|
||||
@PostMapping("/updateJob")
|
||||
@ApiOperation("更新定时任务")
|
||||
@RequiresPermissions("tool_quartz_edit")
|
||||
public ResponseEntity<QuartzJob> updateJob(@ApiParam("定时任务信息") @RequestBody QuartzJob quartzJob) {
|
||||
ResponseEntity<QuartzJob> responseEntity = new ResponseEntity<>();
|
||||
try {
|
||||
responseEntity.setData(quartzJobService.updateJob(quartzJob));
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(1000, e.getMessage());
|
||||
}
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/triggerJob")
|
||||
@ApiOperation("触发/执行定时任务")
|
||||
@RequiresPermissions("tool_quartz_list")
|
||||
public ResponseEntity<Boolean> triggerJob(@ApiParam(value = "任务名称", required = true) @RequestParam(value = "jobName") String jobName,
|
||||
@ApiParam(value = "任务分组", required = true) @RequestParam(value = "jobGroup") String jobGroup) {
|
||||
ResponseEntity<Boolean> responseEntity = new ResponseEntity<>();
|
||||
quartzJobManager.triggerJob(jobName, jobGroup);
|
||||
responseEntity.setData(true);
|
||||
return responseEntity;
|
||||
}
|
||||
|
||||
@PostMapping("/pauseJob")
|
||||
@ApiOperation("停止任务")
|
||||
@RequiresPermissions("tool_quartz_list")
|
||||
public ResponseEntity<Boolean> pauseJob(@ApiParam(value = "任务名称", required = true) @RequestParam(value = "jobName") String jobName,
|
||||
@ApiParam(value = "任务分组", required = true) @RequestParam(value = "jobGroup") String jobGroup) {
|
||||
ResponseEntity<Boolean> responseEntity = new ResponseEntity<>();
|
||||
quartzJobManager.pauseJob(jobName, jobGroup);
|
||||
responseEntity.setData(true);
|
||||
return responseEntity;
|
||||
}
|
||||
|
||||
@PostMapping("/resumeJob")
|
||||
@ApiOperation("恢复任务")
|
||||
@RequiresPermissions("tool_quartz_list")
|
||||
public ResponseEntity<Boolean> resumeJob(@ApiParam(value = "任务名称", required = true) @RequestParam(value = "jobName") String jobName,
|
||||
@ApiParam(value = "任务分组", required = true) @RequestParam(value = "jobGroup") String jobGroup) {
|
||||
ResponseEntity<Boolean> responseEntity = new ResponseEntity<>();
|
||||
quartzJobManager.resumeJob(jobName, jobGroup);
|
||||
responseEntity.setData(true);
|
||||
return responseEntity;
|
||||
}
|
||||
|
||||
@PostMapping("/batchDeleteJob")
|
||||
@ApiOperation("删除任务")
|
||||
@RequiresPermissions("tool_quartz_del")
|
||||
public ResponseEntity<Boolean> batchDeleteJob(@ApiParam(value = "任务信息", required = true) @RequestBody List<QuartzJob> quartzJobs) {
|
||||
ResponseEntity<Boolean> responseEntity = new ResponseEntity<>();
|
||||
quartzJobService.batchDeleteJob(quartzJobs);
|
||||
responseEntity.setData(true);
|
||||
return responseEntity;
|
||||
}
|
||||
|
||||
@PostMapping("/getAllMethod")
|
||||
@ApiOperation("获取定时类中所有方法")
|
||||
@RequiresPermissions("tool_quartz_add")
|
||||
public ResponseEntity<List<String>> getAllMethod(@ApiParam(value = "类名称", required = true) @RequestParam(value = "className") String className) {
|
||||
ResponseEntity<List<String>> responseEntity = new ResponseEntity<>();
|
||||
try {
|
||||
responseEntity.setData(quartzJobService.getAllMethod(className));
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
responseEntity.setCode(10000).setMessage("获取执行类失败!");
|
||||
}
|
||||
return responseEntity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import com.codvision.base.entity.Region;
|
||||
import com.codvision.base.entity.vo.RegionVO;
|
||||
import com.codvision.base.service.IRegionService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 行政区域 管理模块
|
||||
*
|
||||
* @author zz
|
||||
* @date 2023-08-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/region" )
|
||||
@Api(tags = "地址信息接口" )
|
||||
public class ManagerRegionController {
|
||||
|
||||
@Autowired
|
||||
private IRegionService regionService;
|
||||
|
||||
@ApiOperation(value = "点地图获取地址信息" )
|
||||
@GetMapping(value = "/region" )
|
||||
public ResponseEntity<Map<String, Object>> getRegion(@ApiParam(value = "城市code" , required = true) @RequestParam String cityCode, @ApiParam(value = "镇名称" , required = true) @RequestParam String townName) {
|
||||
return new ResponseEntity().data(regionService.getRegion(cityCode, townName));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/name" )
|
||||
@ApiOperation(value = "根据名字获取地区地址id" )
|
||||
public ResponseEntity<String> getItemByLastName(String lastName) {
|
||||
return new ResponseEntity().data(regionService.getItemByLastName(lastName));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/item/getItem" )
|
||||
@ApiOperation(value = "通过id获取子地区" )
|
||||
public ResponseEntity<List<Region>> getItem(@ApiParam(value = "地区ID" , required = true) @RequestParam Long id) {
|
||||
return new ResponseEntity().data(regionService.getItem(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/allCity" )
|
||||
@ApiOperation(value = "获取所有的省-市" )
|
||||
public ResponseEntity<List<RegionVO>> getAllCity() {
|
||||
return new ResponseEntity().data(regionService.getAllCity());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.base.entity.SysConfig;
|
||||
import com.codvision.base.service.ISysConfigService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 系统配置 管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/sysConfig")
|
||||
@Api(tags = "平台管理端-系统配置模块")
|
||||
public class ManagerSysConfigController {
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@ApiOperation(value = "获取系统配置所有列表", notes = "获取系统配置所有列表接口")
|
||||
@PostMapping("/findAll")
|
||||
public ResponseEntity<Map<String, List<SysConfig>>> findAll(
|
||||
@ApiParam(value = "大类") @RequestParam(value = "largeCategory", required = false) String largeCategory) {
|
||||
Map<String, List<SysConfig>> map = configService.getListByLargeCategory(largeCategory);
|
||||
return new ResponseEntity<Map<String, List<SysConfig>>>().ok().data(map);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取系统配置详情", notes = "获取系统配置详情接口")
|
||||
@PostMapping("/detail")
|
||||
public ResponseEntity<SysConfig> getByKey(@ApiParam(value = "关键字k", required = true) @RequestParam String k) {
|
||||
SysConfig sysConfig = configService.getByKey(k);
|
||||
return new ResponseEntity<SysConfig>().ok().data(sysConfig);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增系统配置", notes = "新增系统配置接口")
|
||||
@PostMapping("/add")
|
||||
@RequiresPermissions("sys_config_add")
|
||||
public ResponseEntity<String> addConfig(@Valid @RequestBody SysConfig sysConfig) {
|
||||
configService.save(sysConfig);
|
||||
return new ResponseEntity<String>().ok().message("添加成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除系统配置", notes = "删除系统配置接口")
|
||||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys_config_del")
|
||||
public ResponseEntity<String> deleteById(@ApiParam(value = "系统配置ID", required = true) @RequestParam List<Long> ids) {
|
||||
configService.removeBatchByIds(ids);
|
||||
return new ResponseEntity<String>().ok().message("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新系统配置", notes = "编辑接系统配置接口")
|
||||
@PostMapping("/update")
|
||||
@RequiresPermissions("sys_config_edit")
|
||||
public ResponseEntity<String> updateConfig(@ApiParam(value = "系统配置列表", required = true) @RequestBody List<SysConfig> sysConfigs) {
|
||||
configService.updateAll(sysConfigs);
|
||||
return new ResponseEntity<String>().ok().message("编辑成功");
|
||||
}
|
||||
|
||||
@PostMapping("/getListByKeys")
|
||||
@ApiOperation(value = "根据k值集合获取配置列表", notes = "根据k值集合获取配置列表接口")
|
||||
public ResponseEntity<List<SysConfig>> getListByKeys(@ApiParam(value = "签名", required = true) @RequestParam(value = "sign") String sign,
|
||||
@ApiParam(value = "时间戳") @RequestParam(value = "timestamp") Long timestamp,
|
||||
@RequestParam String keys) {
|
||||
ResponseEntity<List<SysConfig>> responseEntity = new ResponseEntity<>();
|
||||
|
||||
String nSign = SecureUtil.md5("FJ99A0Nf3vg4dJ3dwS65eis6KYzQ4KeL" + timestamp);
|
||||
if (!sign.equals(nSign)) {
|
||||
throw new BusinessException(10000, "签名sign校验失败");
|
||||
}
|
||||
|
||||
return responseEntity.data(configService.getListByKeys(Arrays.asList(keys.split(","))));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取所有系统配置的大类集合", notes = "获取所有系统配置的大类集合接口")
|
||||
@PostMapping("/getLargeCategory")
|
||||
public ResponseEntity<Set<String>> getLargeCategory() {
|
||||
ResponseEntity<Set<String>> responseEntity = new ResponseEntity<>();
|
||||
Set<String> set = configService.list()
|
||||
.stream().map(SysConfig::getLargeCategory).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
return responseEntity.data(set);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.base.entity.SysDict;
|
||||
import com.codvision.base.entity.SysDictItem;
|
||||
import com.codvision.base.entity.vo.SysDictItemVO;
|
||||
import com.codvision.base.entity.vo.SysDictVO;
|
||||
import com.codvision.base.service.ISysDictItemService;
|
||||
import com.codvision.base.service.ISysDictService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 系统字典 管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-09
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "平台管理端-系统字典管理")
|
||||
@RequestMapping("/v1/manager/sysDict")
|
||||
public class ManagerSysDictController {
|
||||
|
||||
@Autowired
|
||||
private ISysDictService sysDictService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictItemService sysDictItemService;
|
||||
|
||||
@PostMapping("/findAll")
|
||||
@ApiOperation(value = "字典列表", notes = "字典列表接口")
|
||||
@RequiresPermissions("sys_dict_list")
|
||||
public ResponseEntity<IPage<SysDictVO>> findAll(
|
||||
@ApiParam(value = "关键字(dictType,description)") @RequestParam(value = "keyword", required = false) String keyword,
|
||||
@ApiParam(value = "是否系统内置(0:否, 1:是)") @RequestParam(required = false) Integer systemFlag,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
ResponseEntity<IPage<SysDictVO>> responseEntity = new ResponseEntity<>();
|
||||
|
||||
SysDict queryBean = new SysDict();
|
||||
queryBean.setKeyword(keyword);
|
||||
queryBean.setSystemFlag(systemFlag);
|
||||
QueryPage<SysDict> queryPage = new QueryPage<>(queryBean, page, size);
|
||||
|
||||
IPage<SysDictVO> pageResult = sysDictService.getPageResult(queryPage);
|
||||
return responseEntity.data(pageResult);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/addDict")
|
||||
@ApiOperation(value = "添加字典", notes = "添加字典接口")
|
||||
@RequiresPermissions("sys_dict_add")
|
||||
public ResponseEntity<String> addDict(@Valid @RequestBody SysDict sysDict) {
|
||||
sysDictService.addDict(sysDict);
|
||||
return new ResponseEntity<String>().ok();
|
||||
}
|
||||
|
||||
@PostMapping("/updateDict")
|
||||
@ApiOperation(value = "更新字典", notes = "更新字典接口")
|
||||
@RequiresPermissions("sys_dict_edit")
|
||||
public ResponseEntity<String> updateDict(@RequestBody SysDict sysDict) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
if (null == sysDict.getId()) {
|
||||
throw new BusinessException(30002);
|
||||
}
|
||||
sysDictService.updateDict(sysDict);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/removeDict")
|
||||
@ApiOperation(value = "删除字典", notes = "删除字典接口")
|
||||
@RequiresPermissions("sys_dict_del")
|
||||
public ResponseEntity<String> removeDict(@RequestParam(value = "id") Integer id) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
sysDictService.removeDict(id);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/getItemList")
|
||||
@ApiOperation(value = "字典项列表", notes = "字典项列表接口")
|
||||
@RequiresPermissions("sys_dict_item_list")
|
||||
public ResponseEntity<IPage<SysDictItemVO>> getListByDictId(@RequestParam(required = false) Integer dictId,
|
||||
@RequestParam(required = false) String label,
|
||||
@RequestParam(required = false) String itemValue,
|
||||
@RequestParam(required = false) String dictType,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
SysDictItem queryBean = new SysDictItem();
|
||||
queryBean.setDictId(dictId);
|
||||
queryBean.setLabel(label);
|
||||
queryBean.setItemValue(itemValue);
|
||||
queryBean.setDictType(dictType);
|
||||
|
||||
QueryPage<SysDictItem> queryPage = new QueryPage<>(queryBean, page, size);
|
||||
IPage<SysDictItemVO> pageResult = sysDictItemService.getPageResult(queryPage);
|
||||
|
||||
return new ResponseEntity<IPage<SysDictItemVO>>().ok().data(pageResult);
|
||||
}
|
||||
|
||||
@PostMapping("/addDictItem")
|
||||
@ApiOperation(value = "添加字典项", notes = "添加字典项接口")
|
||||
@RequiresPermissions("sys_dict_item_add")
|
||||
public ResponseEntity<SysDictItem> addDictItem(@Validated @RequestBody SysDictItem sysDictItem) {
|
||||
return new ResponseEntity<SysDictItem>().data(sysDictItemService.addDictItem(sysDictItem));
|
||||
}
|
||||
|
||||
@PostMapping("/updateDictItem")
|
||||
@ApiOperation(value = "更新字典项", notes = "更新字典项接口")
|
||||
@RequiresPermissions("sys_dict_item_edit")
|
||||
public ResponseEntity<SysDictItem> updateDictItem(@RequestBody SysDictItem sysDictItem) {
|
||||
ResponseEntity<SysDictItem> responseEntity = new ResponseEntity<>();
|
||||
if (null == sysDictItem.getId()) {
|
||||
throw new BusinessException(30002);
|
||||
}
|
||||
|
||||
return responseEntity.data(sysDictItemService.updateDictItem(sysDictItem));
|
||||
}
|
||||
|
||||
@PostMapping("/removeDictItem")
|
||||
@ApiOperation(value = "删除字典项", notes = "删除字典项接口")
|
||||
@RequiresPermissions("sys_dict_item_del")
|
||||
public ResponseEntity<String> removeDictItem(@RequestParam(value = "id") Integer id) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
sysDictItemService.removeDictItem(id);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.authcore.bean.SysUserBean;
|
||||
import com.codvision.authcore.util.AuthUtil;
|
||||
import com.codvision.base.entity.FileUploadResult;
|
||||
import com.codvision.base.entity.SysFile;
|
||||
import com.codvision.base.enums.StorageType;
|
||||
import com.codvision.base.service.ISysFileService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.logcore.annotation.MyLog;
|
||||
import com.codvision.webcore.annotation.ApiSecret;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/sysFile")
|
||||
@Api(tags = "平台管理端-文件管理模块")
|
||||
public class ManagerSysFileController {
|
||||
|
||||
@Resource
|
||||
private ISysFileService sysFileService;
|
||||
|
||||
@PostMapping("/findAll")
|
||||
@ApiOperation(value = "分页查询文件列表", notes = "分页查询文件列表接口")
|
||||
@RequiresPermissions("sys_file_list")
|
||||
public ResponseEntity<IPage<SysFile>> findAll(@ApiParam(value = "关键字") @RequestParam(required = false) String keyword,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size,
|
||||
@ApiParam(value = "来源:0文件上传模块,1其他模块") @RequestParam(value = "source", required = false, defaultValue = "-1") Integer source) {
|
||||
ResponseEntity<IPage<SysFile>> response = new ResponseEntity<>();
|
||||
|
||||
|
||||
LambdaQueryWrapper<SysFile> queryWrapper = Wrappers.lambdaQuery();
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
queryWrapper.like(SysFile::getFileName, keyword);
|
||||
}
|
||||
if (source != -1) {
|
||||
queryWrapper.eq(SysFile::getSource, source);
|
||||
}
|
||||
SysUserBean sysUser = AuthUtil.getCurrentUser();
|
||||
if (ObjectUtil.isNotEmpty(sysUser)) {
|
||||
queryWrapper.eq(StrUtil.isNotBlank(sysUser.getName()), SysFile::getCreateUser, sysUser.getName());
|
||||
}
|
||||
queryWrapper.orderByDesc(SysFile::getCreateTime);
|
||||
|
||||
IPage<SysFile> pageResult = sysFileService.page(new QueryPage<SysFile>(page, size).getPage(), queryWrapper);
|
||||
return response.ok().data(pageResult);
|
||||
}
|
||||
|
||||
|
||||
@MyLog("删除文件")
|
||||
@ApiOperation(value = "通过id删除文件管理", notes = "通过id删除文件管理")
|
||||
@DeleteMapping("/batchDel")
|
||||
@RequiresPermissions("sys_file_del")
|
||||
public ResponseEntity<String> removeById(@RequestBody List<Integer> ids) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
sysFileService.deleteFile(ids);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@MyLog("上传文件")
|
||||
@ApiSecret(ignore = true)
|
||||
@ApiOperation(value = "文件上传接口", notes = "统一文件上传接口")
|
||||
@PostMapping("/upload")
|
||||
public ResponseEntity<FileUploadResult> fileUpload(@RequestPart("file") MultipartFile file) {
|
||||
FileUploadResult fileUploadResult = sysFileService.uploadFile(file, null);
|
||||
return new ResponseEntity<>(fileUploadResult).ok();
|
||||
}
|
||||
|
||||
@MyLog("上传oss文件")
|
||||
@ApiSecret(ignore = true)
|
||||
@PostMapping(value = "/oss/upload")
|
||||
@ApiOperation(value = "oss上传文件,默认type=1 为压缩图片,2为非图片文件", notes = "上传文件")
|
||||
@RequiresPermissions("sys_file_oss_upload")
|
||||
public ResponseEntity<FileUploadResult> upload(@RequestPart("file") MultipartFile file) throws IOException {
|
||||
FileUploadResult fileUploadResult = sysFileService.uploadFile(file, StorageType.oss);
|
||||
return new ResponseEntity<>(fileUploadResult).ok();
|
||||
}
|
||||
|
||||
@MyLog("上传本地文件")
|
||||
@ApiSecret(ignore = true)
|
||||
@ApiOperation("本地上传")
|
||||
@PostMapping("/local/upload")
|
||||
@RequiresPermissions("sys_file_local_upload")
|
||||
public ResponseEntity<FileUploadResult> uploadLocal(@RequestPart("file") MultipartFile file) {
|
||||
FileUploadResult fileUploadResult = sysFileService.uploadFile(file, StorageType.local);
|
||||
return new ResponseEntity<>(fileUploadResult).ok();
|
||||
}
|
||||
|
||||
@ApiSecret(ignore = true)
|
||||
@ApiOperation(value = "获取oss文件", notes = "获取oss文件接口")
|
||||
@GetMapping("/{bucket}/{fileName}")
|
||||
@RequiresPermissions("sys_file_oss_one")
|
||||
public void file(@PathVariable String bucket, @PathVariable String fileName, HttpServletResponse response) {
|
||||
sysFileService.getFile(bucket, fileName, response);
|
||||
}
|
||||
|
||||
@ApiSecret(ignore = true)
|
||||
@ApiOperation(value = "下载文件接口", notes = "统一获取文件接口")
|
||||
@GetMapping("/download/{bucket}/{fileName}")
|
||||
public void download(@PathVariable String bucket,
|
||||
@PathVariable String fileName,
|
||||
HttpServletResponse response) {
|
||||
sysFileService.download(bucket, fileName, response);
|
||||
}
|
||||
|
||||
@ApiSecret(ignore = true)
|
||||
@ApiOperation(value = "预览文件接口", notes = "统一预览文件接口")
|
||||
@GetMapping("/preview/{bucket}/{fileName}")
|
||||
public void preview(@PathVariable String bucket,
|
||||
@PathVariable String fileName,
|
||||
HttpServletResponse response) {
|
||||
sysFileService.preview(bucket, fileName, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.authcore.bean.SysUserBean;
|
||||
import com.codvision.authcore.util.AuthUtil;
|
||||
import com.codvision.base.entity.SysNotice;
|
||||
import com.codvision.base.entity.SysNoticeUserMapper;
|
||||
import com.codvision.base.entity.dto.SysNoticeDTO;
|
||||
import com.codvision.base.entity.vo.SysNoticeVO;
|
||||
import com.codvision.base.enums.NoticeReadStatusEnum;
|
||||
import com.codvision.base.service.ISysNoticeService;
|
||||
import com.codvision.base.service.ISysNoticeUserMapperService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.webapi.api.SysUserApi;
|
||||
import com.codvision.webapi.bean.RemoteSysUser;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 系统通知 管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-12-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/sysNotice")
|
||||
@Api(tags = "平台管理端-系统通知模块")
|
||||
public class ManagerSysNoticeController {
|
||||
|
||||
@Resource
|
||||
private ISysNoticeService sysNoticeService;
|
||||
|
||||
@Resource
|
||||
private SysUserApi sysUserApi;
|
||||
|
||||
@Resource
|
||||
private ISysNoticeUserMapperService sysNoticeUserMapperService;
|
||||
|
||||
@ApiOperation(value = "获取系统通知详情", notes = "获取系统通知详情接口")
|
||||
@PostMapping("/detail")
|
||||
@RequiresPermissions("sys_notice_detail")
|
||||
public ResponseEntity<SysNoticeVO> getDetail(@ApiParam(value = "系统通知ID", required = true) @RequestParam(value = "id") Integer id) {
|
||||
SysNoticeVO vo = sysNoticeService.getDetail(id);
|
||||
return new ResponseEntity<SysNoticeVO>().ok().data(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取系统通知分页列表", notes = "获取系统通知分页列表接口")
|
||||
@PostMapping("/findAll")
|
||||
@RequiresPermissions("sys_notice_list")
|
||||
public ResponseEntity<IPage<SysNoticeVO>> findAll(@RequestParam(required = false) String keyword,
|
||||
@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
SysNotice queryBean = new SysNotice();
|
||||
queryBean.setTitle(keyword);
|
||||
queryBean.setType(type);
|
||||
IPage<SysNoticeVO> pageResult = sysNoticeService.getPageResult(new QueryPage<>(queryBean, page, size));
|
||||
return new ResponseEntity<IPage<SysNoticeVO>>().ok().data(pageResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增系统通知", notes = "新增系统通知接口")
|
||||
@PostMapping("/add")
|
||||
@RequiresPermissions("sys_notice_add")
|
||||
public ResponseEntity<String> saveSysNotice(@Valid @RequestBody SysNoticeDTO sysNoticeDTO) {
|
||||
SysUserBean sysUserBean = AuthUtil.getCurrentUser();
|
||||
sysNoticeDTO.setCreateUid(Math.toIntExact(sysUserBean.getId()));
|
||||
sysNoticeDTO.setCreateBy(sysUserBean.getName());
|
||||
sysNoticeService.saveSysNotice(sysNoticeDTO);
|
||||
return new ResponseEntity<String>().ok().message("添加成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除系统通知", notes = "删除系统通知接口")
|
||||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys_notice_del")
|
||||
public ResponseEntity<String> deleteByIds(@RequestBody List<Integer> ids) {
|
||||
sysNoticeService.deleteSysNotices(ids);
|
||||
return new ResponseEntity<String>().ok().message("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑系统通知", notes = "编辑系统通知接口")
|
||||
@PostMapping("/edit")
|
||||
@RequiresPermissions("sys_notice_edit")
|
||||
public ResponseEntity<String> editSysNotice(@RequestBody SysNotice sysNotice) {
|
||||
sysNoticeService.updateById(sysNotice);
|
||||
return new ResponseEntity<String>().ok().message("编辑成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知发送")
|
||||
@PostMapping(value = "/send")
|
||||
@RequiresPermissions("sys_notice_send")
|
||||
public ResponseEntity<String> send(@RequestBody SysNoticeDTO sysNoticeDTO) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
sysNoticeService.send(sysNoticeDTO);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知撤回")
|
||||
@PostMapping(value = "/revoke")
|
||||
@RequiresPermissions("sys_notice_revoke")
|
||||
public ResponseEntity<String> revoke(@RequestBody SysNoticeDTO sysNoticeDTO) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
sysNoticeService.revoke(sysNoticeDTO);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据通知id,查询已发送人员列表")
|
||||
@PostMapping(value = "/userList")
|
||||
@RequiresPermissions("sys_notice_user_list")
|
||||
public ResponseEntity<IPage<RemoteSysUser>> getNoticeUserList(@ApiParam(value = "主键id") @RequestParam(value = "id") Integer id,
|
||||
@ApiParam(value = "关键字") @RequestParam(required = false) String keyword,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
ResponseEntity<IPage<RemoteSysUser>> response = new ResponseEntity<>();
|
||||
List<SysNoticeUserMapper> list = sysNoticeUserMapperService.list(Wrappers.<SysNoticeUserMapper>lambdaQuery()
|
||||
.eq(SysNoticeUserMapper::getNoticeId, id));
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
IPage<RemoteSysUser> pageResult = sysUserApi.pageUserList(keyword, null, null,
|
||||
list.stream().map(SysNoticeUserMapper::getUserId).collect(Collectors.toList()), page, size);
|
||||
response.data(pageResult);
|
||||
}
|
||||
|
||||
return response.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "已读通知调用")
|
||||
@PostMapping(value = "/updateNoticeUserStatus")
|
||||
@RequiresPermissions("sys_notice_read")
|
||||
public ResponseEntity<String> updateNoticeUserStatus(@ApiParam(value = "通知id") @RequestParam(value = "noticeId") Integer noticeId) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
SysUserBean sysUser = AuthUtil.getCurrentUser();
|
||||
sysNoticeUserMapperService.update(Wrappers.<SysNoticeUserMapper>lambdaUpdate()
|
||||
.eq(SysNoticeUserMapper::getNoticeId, noticeId).
|
||||
eq(SysNoticeUserMapper::getUserId, sysUser.getId())
|
||||
.set(SysNoticeUserMapper::getStatus, NoticeReadStatusEnum.READ.getStatus()));
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("全部标记已读")
|
||||
@PostMapping(value = "/markAllRead")
|
||||
public ResponseEntity<String> markAllRead(@RequestParam(value = "type") Integer type) {
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>();
|
||||
SysUserBean sysUser = AuthUtil.getCurrentUser();
|
||||
sysNoticeUserMapperService.markAllRead(Math.toIntExact(sysUser.getId()), type);
|
||||
return responseEntity.ok();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getListByUid")
|
||||
@ApiOperation("获取当前登录用户的通知消息列表")
|
||||
@RequiresPermissions("sys_notice_list_uid")
|
||||
public ResponseEntity<IPage<SysNoticeVO>> getListByUid(@RequestParam(value = "type") Integer type,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
ResponseEntity<IPage<SysNoticeVO>> responseEntity = new ResponseEntity<>();
|
||||
|
||||
SysUserBean sysUser = AuthUtil.getCurrentUser();
|
||||
QueryPage<SysNotice> queryPage = new QueryPage<>(page, size);
|
||||
IPage<SysNoticeVO> pageResult = sysNoticeService.getListByUidAndType(queryPage.getPage(), Math.toIntExact(sysUser.getId()), type);
|
||||
return responseEntity.data(pageResult).ok();
|
||||
}
|
||||
|
||||
@PostMapping("/flagUnReadNotice")
|
||||
@ApiOperation("未读消息列表(登陆触发)")
|
||||
public ResponseEntity<Boolean> flagUnReadNotice() {
|
||||
ResponseEntity<Boolean> responseEntity = new ResponseEntity<>();
|
||||
SysUserBean sysUser = AuthUtil.getCurrentUser();
|
||||
return responseEntity.ok().data(sysNoticeService.flagUnReadNotice(Math.toIntExact(sysUser.getId())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.codvision.base.controller.manager;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.codvision.authcore.annotation.RequiresPermissions;
|
||||
import com.codvision.base.entity.SysTag;
|
||||
import com.codvision.base.entity.vo.SysTagVO;
|
||||
import com.codvision.base.service.ISysTagService;
|
||||
import com.codvision.commoncore.common.ResponseEntity;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统标签 管理模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023-11-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/v1/manager/sysTag")
|
||||
@Api(tags = "平台管理端-系统标签模块")
|
||||
public class ManagerSysTagController {
|
||||
|
||||
@Autowired
|
||||
private ISysTagService sysTagService;
|
||||
|
||||
@ApiOperation(value = "获取系统标签详情", notes = "获取系统标签详情接口")
|
||||
@PostMapping("/details")
|
||||
@RequiresPermissions("sys_tag_list")
|
||||
public ResponseEntity<SysTagVO> getById(@ApiParam(value = "系统标签ID", required = true) @RequestParam Integer tagId) {
|
||||
SysTagVO vo = sysTagService.getDetail(tagId);
|
||||
return new ResponseEntity<SysTagVO>().ok().data(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取系统标签分页列表", notes = "获取系统标签分页列表接口")
|
||||
@PostMapping("/findAll")
|
||||
@RequiresPermissions("sys_tag_list")
|
||||
public ResponseEntity<IPage<SysTagVO>> getPageList(@ApiParam("标签名称") @RequestParam(required = false) String tagName,
|
||||
@ApiParam("标签所属模块:字典项表中的item_value") @RequestParam(required = false) String dictItemValue,
|
||||
@ApiParam("标签父id") @RequestParam(required = false) Integer parentId,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "10") int size) {
|
||||
SysTag queryBean = new SysTag();
|
||||
queryBean.setTagName(tagName);
|
||||
queryBean.setDictItemValue(dictItemValue);
|
||||
queryBean.setParentId(parentId);
|
||||
QueryPage<SysTag> queryPage = new QueryPage<>(queryBean, page, size);
|
||||
|
||||
IPage<SysTagVO> pageResult = sysTagService.getPageResult(queryPage);
|
||||
return new ResponseEntity<IPage<SysTagVO>>().ok().data(pageResult);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加系统标签", notes = "添加系统标签接口")
|
||||
@PostMapping("/addTag")
|
||||
@RequiresPermissions("sys_tag_add")
|
||||
public ResponseEntity<String> saveSysTag(@Valid @RequestBody SysTag sysTag) {
|
||||
sysTagService.save(sysTag);
|
||||
return new ResponseEntity<String>().ok().message("添加成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除系统标签", notes = "删除系统标签接口")
|
||||
@PostMapping("/batchRemoveTag")
|
||||
@RequiresPermissions("sys_tag_del")
|
||||
public ResponseEntity<String> batchRemoveTag(@ApiParam(value = "系统标签ID", required = true) @RequestBody List<Integer> tagIds) {
|
||||
for (Integer tagId : tagIds) {
|
||||
sysTagService.remove(Wrappers.<SysTag>lambdaQuery().like(SysTag::getIdPath, tagId));
|
||||
}
|
||||
return new ResponseEntity<String>().ok().message("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新系统标签", notes = "更新系统标签接口")
|
||||
@PostMapping("/updateTag")
|
||||
@RequiresPermissions("sys_tag_edit")
|
||||
public ResponseEntity<String> updateSysTag(@RequestBody SysTag sysTag) {
|
||||
sysTagService.updateById(sysTag);
|
||||
return new ResponseEntity<String>().ok().message("更新成功");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
* controller层
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/18
|
||||
*/
|
||||
package com.codvision.base.controller;
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 框架后台管理用户
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("tbl_backend_user")
|
||||
@ApiModel(value = "BackendUser", description = "框架后台管理用户")
|
||||
public class BackendUser implements Serializable {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "唯一标识", hidden = true)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(DigestUtil.bcrypt("Jcpt!@2023"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity;
|
||||
|
||||
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Data
|
||||
public class ExcelCheck<T> {
|
||||
|
||||
/**
|
||||
* 无异常的数据
|
||||
*/
|
||||
private List<T> cacheList;
|
||||
/**
|
||||
* 异常的数据
|
||||
*/
|
||||
private List<ExcelErrorRecord> errorList;
|
||||
/**
|
||||
* 表头格式是否异常
|
||||
*/
|
||||
private Boolean headAbnormal;
|
||||
/**
|
||||
* 是否存在异常的数据
|
||||
*/
|
||||
private Boolean existErrorData;
|
||||
|
||||
public ExcelCheck(int batchCount) {
|
||||
this.headAbnormal = false;
|
||||
this.existErrorData = false;
|
||||
this.cacheList = ListUtils.newArrayListWithExpectedSize(batchCount);
|
||||
this.errorList = ListUtils.newArrayListWithExpectedSize(batchCount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "ExcelErrorRecord", description = "excel错误记录")
|
||||
@TableName(value = "tbl_excel_error_record")
|
||||
public class ExcelErrorRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2117104779018206291L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("请求序列号")
|
||||
private String reqNo;
|
||||
|
||||
@ApiModelProperty("行号")
|
||||
private Integer rowIndex;
|
||||
|
||||
@ApiModelProperty("原始数据信息")
|
||||
private String originalJsonValue;
|
||||
|
||||
@ApiModelProperty("错误数据信息")
|
||||
private String errorMsgJson;
|
||||
|
||||
@ApiModelProperty("目标对象")
|
||||
private String targetObject;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文件上传结果
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "FileUploadResult", description = "文件上传结果")
|
||||
public class FileUploadResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7105904522823694056L;
|
||||
|
||||
@ApiModelProperty("文件名称")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty("下载地址")
|
||||
private String downloadUrl;
|
||||
|
||||
@ApiModelProperty("预览地址")
|
||||
private String previewUrl;
|
||||
|
||||
@ApiModelProperty("缩略图地址")
|
||||
private String compressUrl;
|
||||
|
||||
@ApiModelProperty("文件空间名称")
|
||||
private String bucketName;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.codvision.commoncore.enums.SqlOperator;
|
||||
import com.codvision.webcore.annotation.QueryCondition;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生成代码配置
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_generator_config")
|
||||
@ApiModel(value = "GeneratorConfig", description = "生成代码配置")
|
||||
public class GeneratorConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("配置名称")
|
||||
@QueryCondition(condition = SqlOperator.LIKE)
|
||||
private String configName;
|
||||
|
||||
@ApiModelProperty("作者名")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty("生成目录")
|
||||
private String exportPath;
|
||||
|
||||
@ApiModelProperty("包名")
|
||||
private String packageName;
|
||||
|
||||
@ApiModelProperty("表前缀名")
|
||||
private String tablePrefixName;
|
||||
|
||||
@ApiModelProperty("表名列表")
|
||||
private String tables;
|
||||
|
||||
@ApiModelProperty("是否继承实体")
|
||||
private Boolean superEntity;
|
||||
|
||||
@ApiModelProperty("是否覆盖原文件")
|
||||
private Boolean fileOverride;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.codvision.commoncore.enums.SqlOperator;
|
||||
import com.codvision.webcore.annotation.QueryCondition;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 本地图标
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_local_icon_library")
|
||||
@ApiModel(value = "LocalIconLibrary", description = "本地图标")
|
||||
public class LocalIconLibrary implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("图标类型")
|
||||
@QueryCondition(condition = SqlOperator.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("图标名称")
|
||||
@QueryCondition(condition = SqlOperator.LIKE)
|
||||
private String iconName;
|
||||
|
||||
@ApiModelProperty("图标链接")
|
||||
private String iconUrl;
|
||||
|
||||
@ApiModelProperty("图标备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* qrtz任务详情
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
@TableName("qrtz_job_details")
|
||||
@ApiModel(value = "QuartzJob", description = "qrtz任务详情")
|
||||
public class QuartzJob implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String schedName;
|
||||
|
||||
@ApiModelProperty("任务名称")
|
||||
private String jobName;
|
||||
|
||||
@ApiModelProperty("任务分组(以:定时任务_)")
|
||||
private String jobGroup;
|
||||
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty("执行类(固定值:com.codvision.serverboot.job.QuartzJob)")
|
||||
private String jobClassName;
|
||||
|
||||
private Boolean isDurable;
|
||||
|
||||
private Boolean isNonconcurrent;
|
||||
|
||||
private Boolean isUpdateData;
|
||||
|
||||
private Boolean requestsRecovery;
|
||||
|
||||
private byte[] jobData;
|
||||
|
||||
@ApiModelProperty("执行方法")
|
||||
@TableField(exist = false)
|
||||
private String jobMethodName;
|
||||
|
||||
@ApiModelProperty("执行时间")
|
||||
@TableField(exist = false)
|
||||
private String cronExpression;
|
||||
|
||||
@ApiModelProperty("任务状态")
|
||||
@TableField(exist = false)
|
||||
private String triggerState;
|
||||
|
||||
@ApiModelProperty("旧任务名称-用于修改")
|
||||
@TableField(exist = false)
|
||||
private String oldJobName;
|
||||
|
||||
@ApiModelProperty("旧任务分组-用于修改")
|
||||
@TableField(exist = false)
|
||||
private String oldJobGroup;
|
||||
|
||||
@ApiModelProperty("任务分组(以:定时任务_)")
|
||||
@TableField(exist = false)
|
||||
private String jobsetMessage;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.codvision.webcore.bean.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区域
|
||||
* </p>
|
||||
*
|
||||
* @author zz
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_region")
|
||||
@ApiModel(value = "Region", description = "行政区域")
|
||||
@KeySequence(value = "tbl_region_id_seq")
|
||||
public class Region extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("区域编码")
|
||||
private String adCode;
|
||||
|
||||
@ApiModelProperty("区域中心点经纬度")
|
||||
private String center;
|
||||
|
||||
@ApiModelProperty("城市代码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty("行政区划级别")
|
||||
private String level;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("父ID")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty("行政地区路径")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer orderNum;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件存储配置
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-08-14
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_storage_config")
|
||||
@ApiModel(value = "StorageConfig", description = "文件存储配置")
|
||||
public class StorageConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "唯一标识", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("参数键")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty("参数值")
|
||||
private String value;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统配置
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-09
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_config")
|
||||
@ApiModel(value = "SysConfig", description = "系统配置")
|
||||
public class SysConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("系统配置ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("参数键")
|
||||
private String k;
|
||||
|
||||
@ApiModelProperty("参数值")
|
||||
private String v;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("参数名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("大类")
|
||||
private String largeCategory;
|
||||
|
||||
@ApiModelProperty("小类")
|
||||
private String subclass;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Short orderby;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "SysDict", description = "字典信息")
|
||||
@TableName(value = "tbl_sys_dict")
|
||||
public class SysDict implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@NotBlank(message = "请填写字典类型")
|
||||
@ApiModelProperty("字典类型")
|
||||
private String dictType;
|
||||
|
||||
@NotBlank(message = "请添加字典描述")
|
||||
@ApiModelProperty("字典描述")
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "请选择是否系统内置")
|
||||
@ApiModelProperty("是否系统内置(0:否, 1:是)")
|
||||
private Integer systemFlag;
|
||||
|
||||
@ApiModelProperty("删除标记,1:已删除,0:正常")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty("逻辑删除辅助字段")
|
||||
private Integer delKey;
|
||||
|
||||
@ApiModelProperty("关键字,查询用")
|
||||
@TableField(exist = false)
|
||||
private String keyword;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author hxl
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "SysDictItem", description = "字典项")
|
||||
@TableName(value = "tbl_sys_dict_item")
|
||||
public class SysDictItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@NotNull(message = "字典ID不能为空")
|
||||
@ApiModelProperty("字典ID")
|
||||
private Integer dictId;
|
||||
|
||||
@ApiModelProperty("数据值")
|
||||
private String itemValue;
|
||||
|
||||
@ApiModelProperty("标签名")
|
||||
private String label;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty("排序值,默认升序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@ApiModelProperty("备注信息")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("删除标记,1:已删除,0:正常")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty("逻辑删除辅助字段")
|
||||
private Integer delKey;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName(value = "tbl_sys_file")
|
||||
@ApiModel(value = "SysFile", description = "系统文件")
|
||||
public class SysFile implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3504343125557629647L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "上传时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer delFlag;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String original;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String updateUser;
|
||||
|
||||
@ApiModelProperty(value = "文件名")
|
||||
private String fileName;
|
||||
|
||||
@ApiModelProperty(value = "空间名")
|
||||
private String bucketName;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createUser;
|
||||
|
||||
@ApiModelProperty(value = "文件类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty(value = "文件存储位置:1.文件服务器,2.ECS服务器")
|
||||
private String position;
|
||||
|
||||
@ApiModelProperty(value = "来源:0文件上传模块,1其他模块")
|
||||
private Integer source;
|
||||
|
||||
@ApiModelProperty("文件是否有效,默认1-有效,0-无效")
|
||||
private Integer isValid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统通知
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_sys_notice")
|
||||
@ApiModel(value = "SysNotice", description = "系统通知")
|
||||
public class SysNotice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("通知标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("通知内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("标签id")
|
||||
private Short tagId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("状态:0待发送,1已发送")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("可见范围:0部分公开,1全部可见")
|
||||
private Integer scope;
|
||||
|
||||
@ApiModelProperty("类型:0通知,1公告")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("封面照片")
|
||||
private String pic;
|
||||
|
||||
@ApiModelProperty("创建人用户id")
|
||||
private Integer createUid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_sys_notice_user_mapper")
|
||||
@ApiModel(value = "SysNoticeUserMapper", description = "")
|
||||
public class SysNoticeUserMapper implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("通知ID")
|
||||
private Integer noticeId;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("0未读,1已读")
|
||||
private Short status;
|
||||
|
||||
@ApiModelProperty("是否撤回,0否,1是")
|
||||
private Short flagDel;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.codvision.base.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.codvision.commoncore.enums.SqlOperator;
|
||||
import com.codvision.webcore.annotation.QueryCondition;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统标签
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-17
|
||||
*/
|
||||
@Data
|
||||
@TableName("tbl_sys_tag")
|
||||
@ApiModel(value = "SysTag", description = "系统标签")
|
||||
public class SysTag implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("标签名称")
|
||||
@QueryCondition(condition = SqlOperator.LIKE)
|
||||
private String tagName;
|
||||
|
||||
@ApiModelProperty("标签所属模块(存字典项表中的item_value)")
|
||||
@QueryCondition(condition = SqlOperator.EQ)
|
||||
private String dictItemValue;
|
||||
|
||||
@ApiModelProperty("排序字段")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("删除标记,1:已删除,0:正常")
|
||||
private Short delFlag;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
private Integer delKey;
|
||||
|
||||
@ApiModelProperty("标签描述")
|
||||
private String tagDescription;
|
||||
|
||||
@ApiModelProperty("父id")
|
||||
@QueryCondition(condition = SqlOperator.EQ)
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty("级别")
|
||||
private Short level;
|
||||
|
||||
@ApiModelProperty("标签名称路径")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("标签id路径")
|
||||
private String idPath;
|
||||
|
||||
@ApiModelProperty("标签颜色")
|
||||
private String color;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.codvision.base.entity.dto;
|
||||
|
||||
import com.codvision.base.entity.SysNotice;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author huxb
|
||||
* @description:
|
||||
* @create 2023/2/13 11:41
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "SysNoticeDTO", description = "系统通知信息")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeDTO extends SysNotice {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("用户id列表")
|
||||
private List<Integer> uidList;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 框架后台管理用户
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "BaseUserVO", description = "框架后台管理用户")
|
||||
public class BackendUserVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* excel错误记录信息
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "ExcelErrorRecordVO", description = "excel错误记录信息")
|
||||
public class ExcelErrorRecordVO extends ExcelErrorRecord {
|
||||
|
||||
private static final long serialVersionUID = -3662175896651362798L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生成代码配置展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "GeneratorConfigVO", description = "生成代码配置展示信息")
|
||||
public class GeneratorConfigVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("主键")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("配置名称")
|
||||
private String configName;
|
||||
|
||||
@ApiModelProperty("作者名")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty("生成目录")
|
||||
private String exportPath;
|
||||
|
||||
@ApiModelProperty("包名")
|
||||
private String packageName;
|
||||
|
||||
@ApiModelProperty("表前缀名")
|
||||
private String tablePrefixName;
|
||||
|
||||
@ApiModelProperty("表名列表")
|
||||
private String tables;
|
||||
|
||||
@ApiModelProperty("是否继承实体")
|
||||
private Boolean superEntity;
|
||||
|
||||
@ApiModelProperty("是否覆盖原文件")
|
||||
private Boolean fileOverride;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 本地图标展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "LocalIconLibraryVO", description = "本地图标展示信息")
|
||||
public class LocalIconLibraryVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("图标类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("图标名称")
|
||||
private String iconName;
|
||||
|
||||
@ApiModelProperty("图标链接")
|
||||
private String iconUrl;
|
||||
|
||||
@ApiModelProperty("图标备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.base.entity.Region;
|
||||
import com.codvision.commoncore.utils.BeanUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区域展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author zz
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ApiModel(value = "RegionVO", description = "行政区域展示信息")
|
||||
public class RegionVO extends Region {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 子信息
|
||||
*/
|
||||
private List<RegionVO> children;
|
||||
|
||||
public RegionVO(Region region) {
|
||||
BeanUtil.copyProperties(region, this);
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.webcore.bean.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件存储配置展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-08-14
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "StorageConfigVO", description = "文件存储配置展示信息")
|
||||
public class StorageConfigVO extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("参数键")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty("参数值")
|
||||
private String value;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统配置展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-09
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "SysConfigVO", description = "系统配置展示信息")
|
||||
public class SysConfigVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("系统配置ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("参数键")
|
||||
private String k;
|
||||
|
||||
@ApiModelProperty("参数值")
|
||||
private String v;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("参数名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("大类")
|
||||
private String largeCategory;
|
||||
|
||||
@ApiModelProperty("小类")
|
||||
private String subclass;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Short orderby;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.base.entity.SysDictItem;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典项
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "SysDictItemVO", description = "字典项")
|
||||
public class SysDictItemVO extends SysDictItem {
|
||||
|
||||
private static final long serialVersionUID = -1782146065074159887L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.base.entity.SysDict;
|
||||
import com.codvision.base.entity.SysDictItem;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统字典
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "SysDictVO", description = "系统字典")
|
||||
public class SysDictVO extends SysDict {
|
||||
|
||||
private static final long serialVersionUID = -4380860345232380609L;
|
||||
|
||||
@ApiModelProperty(value = "字典项列表")
|
||||
private List<SysDictItem> dictItemList;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.base.entity.SysFile;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 系统文件
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "SysFileVO", description = "系统文件")
|
||||
public class SysFileVO extends SysFile {
|
||||
|
||||
private static final long serialVersionUID = 2496493171817994242L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "SysNoticeUserMapperVO", description = "展示信息")
|
||||
public class SysNoticeUserMapperVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("通知ID")
|
||||
@TableId(value = "notice_id", type = IdType.AUTO)
|
||||
private Integer noticeId;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
@TableId(value = "user_id", type = IdType.AUTO)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("0未读,1已读")
|
||||
private Short status;
|
||||
|
||||
@ApiModelProperty("是否撤回,0否,1是")
|
||||
private Short flagDel;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.codvision.authcore.bean.SysUserBean;
|
||||
import com.codvision.base.entity.SysNotice;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统通知展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "SysNoticeVO", description = "系统通知展示信息")
|
||||
public class SysNoticeVO extends SysNotice {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "状态:0未读,1已读")
|
||||
private Integer readStatus;
|
||||
|
||||
@ApiModelProperty("标签名称")
|
||||
private String tagName;
|
||||
|
||||
@ApiModelProperty("系统用户")
|
||||
private List<SysUserBean> userList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.codvision.base.entity.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统标签展示信息
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-17
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel(value = "SysTagVO", description = "系统标签展示信息")
|
||||
public class SysTagVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("标签名称")
|
||||
private String tagName;
|
||||
|
||||
@ApiModelProperty("标签所属模块(存字典项表中的item_value)")
|
||||
private String dictItemValue;
|
||||
|
||||
@ApiModelProperty("排序字段")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("删除标记,1:已删除,0:正常")
|
||||
private Short delFlag;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
private Integer delKey;
|
||||
|
||||
@ApiModelProperty("标签描述")
|
||||
private String tagDescription;
|
||||
|
||||
@ApiModelProperty("父id")
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty("级别")
|
||||
private Short level;
|
||||
|
||||
@ApiModelProperty("标签名称路径")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("标签id路径")
|
||||
private String idPath;
|
||||
|
||||
@ApiModelProperty("标签颜色")
|
||||
private String color;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum DelFlag {
|
||||
|
||||
DELETED(1),
|
||||
|
||||
NO_DELETED(0);
|
||||
|
||||
private final Integer flag;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 字典类型
|
||||
*
|
||||
* @author hxl
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DictTypeEnum {
|
||||
SYSTEM(1, "系统内置"),
|
||||
BIZ(0, "业务类");
|
||||
|
||||
private final Integer type;
|
||||
private final String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author huxb
|
||||
* @description:
|
||||
* @create 2023/3/13 16:16
|
||||
*/
|
||||
@Getter
|
||||
public enum MimeTypeEnum {
|
||||
AAC("acc", "AAC音频", "audio/aac"),
|
||||
|
||||
ABW("abw", "AbiWord文件", "application/x-abiword"),
|
||||
|
||||
ARC("arc", "存档文件", "application/x-freearc"),
|
||||
|
||||
AVI("avi", "音频视频交错格式", "video/x-msvideo"),
|
||||
|
||||
AZW("azw", "亚马逊Kindle电子书格式", "application/vnd.amazon.ebook"),
|
||||
|
||||
BIN("bin", "任何类型的二进制数据", "application/octet-stream"),
|
||||
|
||||
BMP("bmp", "Windows OS / 2位图图形", "image/bmp"),
|
||||
|
||||
BZ("bz", "BZip存档", "application/x-bzip"),
|
||||
|
||||
BZ2("bz2", "BZip2存档", "application/x-bzip2"),
|
||||
|
||||
CSH("csh", "C-Shell脚本", "application/x-csh"),
|
||||
|
||||
CSS("css", "级联样式表(CSS)", "text/css"),
|
||||
|
||||
CSV("csv", "逗号分隔值(CSV)", "text/csv"),
|
||||
|
||||
DOC("doc", "微软Word文件", "application/msword"),
|
||||
|
||||
DOCX("docx", "Microsoft Word(OpenXML)", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
|
||||
|
||||
EOT("eot", "MS Embedded OpenType字体", "application/vnd.ms-fontobject"),
|
||||
|
||||
EPUB("epub", "电子出版物(EPUB)", "application/epub+zip"),
|
||||
|
||||
GZ("gz", "GZip压缩档案", "application/gzip"),
|
||||
|
||||
GIF("gif", "图形交换格式(GIF)", "image/gif"),
|
||||
|
||||
HTM("htm", "超文本标记语言(HTML)", "text/html"),
|
||||
|
||||
HTML("html", "超文本标记语言(HTML)", "text/html"),
|
||||
|
||||
ICO("ico", "图标格式", "image/vnd.microsoft.icon"),
|
||||
|
||||
ICS("ics", "iCalendar格式", "text/calendar"),
|
||||
|
||||
JAR("jar", "Java存档", "application/java-archive"),
|
||||
|
||||
JPEG("jpeg", "JPEG图像", "image/jpeg"),
|
||||
|
||||
JPG("jpg", "JPEG图像", "image/jpeg"),
|
||||
|
||||
JS("js", "JavaScript", "text/javascript"),
|
||||
|
||||
JSON("json", "JSON格式", "application/json"),
|
||||
|
||||
JSONLD("jsonld", "JSON-LD格式", "application/ld+json"),
|
||||
|
||||
MID("mid", "乐器数字接口(MIDI)", "audio/midi"),
|
||||
|
||||
MIDI("midi", "乐器数字接口(MIDI)", "audio/midi"),
|
||||
|
||||
MJS("mjs", "JavaScript模块", "text/javascript"),
|
||||
|
||||
MP3("mp3", "MP3音频", "audio/mpeg"),
|
||||
|
||||
MP4("mp4", "MP4视频", "video/mp4"),
|
||||
|
||||
MPEG("mpeg", "MPEG视频", "video/mpeg"),
|
||||
|
||||
MPKG("mpkg", "苹果安装程序包", "application/vnd.apple.installer+xml"),
|
||||
|
||||
ODP("odp", "OpenDocument演示文稿文档", "application/vnd.oasis.opendocument.presentation"),
|
||||
|
||||
ODS("ods", "OpenDocument电子表格文档", "application/vnd.oasis.opendocument.spreadsheet"),
|
||||
|
||||
ODT("odt", "OpenDocument文字文件", "application/vnd.oasis.opendocument.text"),
|
||||
|
||||
OGA("oga", "OGG音讯", "audio/ogg"),
|
||||
|
||||
OGV("ogv", "OGG视频", "video/ogg"),
|
||||
|
||||
OGX("ogx", "OGG", "application/ogg"),
|
||||
|
||||
OPUS("opus", "OPUS音频", "audio/opus"),
|
||||
|
||||
OTF("otf", "otf字体", "font/otf"),
|
||||
|
||||
PNG("png", "便携式网络图形", "image/png"),
|
||||
|
||||
PDF("pdf", "Adobe 可移植文档格式(PDF)", "application/pdf"),
|
||||
|
||||
PHP("php", "php", "application/x-httpd-php"),
|
||||
|
||||
PPT("ppt", "Microsoft PowerPoint", "application/vnd.ms-powerpoint"),
|
||||
|
||||
PPTX("pptx", "Microsoft PowerPoint(OpenXML)", "application/vnd.openxmlformats-officedocument.presentationml.presentation"),
|
||||
|
||||
RAR("rar", "RAR档案", "application/vnd.rar"),
|
||||
|
||||
RTF("rtf", "富文本格式", "application/rtf"),
|
||||
|
||||
SH("sh", "Bourne Shell脚本", "application/x-sh"),
|
||||
|
||||
SVG("svg", "可缩放矢量图形(SVG)", "image/svg+xml"),
|
||||
|
||||
SWF("swf", "小型Web格式(SWF)或Adobe Flash文档", "application/x-shockwave-flash"),
|
||||
|
||||
TAR("tar", "磁带存档(TAR)", "application/x-tar"),
|
||||
|
||||
TIF("tif", "标记图像文件格式(TIFF)", "image/tiff"),
|
||||
|
||||
TIFF("tiff", "标记图像文件格式(TIFF)", "image/tiff"),
|
||||
|
||||
TS("ts", "MPEG传输流", "video/mp2t"),
|
||||
|
||||
TTF("ttf", "ttf字体", "font/ttf"),
|
||||
|
||||
TXT("txt", "文本(通常为ASCII或ISO 8859- n", "text/plain"),
|
||||
|
||||
VSD("vsd", "微软Visio", "application/vnd.visio"),
|
||||
|
||||
WAV("wav", "波形音频格式", "audio/wav"),
|
||||
|
||||
WEBA("weba", "WEBM音频", "audio/webm"),
|
||||
|
||||
WEBM("webm", "WEBM视频", "video/webm"),
|
||||
|
||||
WEBP("webp", "WEBP图像", "image/webp"),
|
||||
|
||||
WOFF("woff", "Web开放字体格式(WOFF)", "font/woff"),
|
||||
|
||||
WOFF2("woff2", "Web开放字体格式(WOFF)", "font/woff2"),
|
||||
|
||||
XHTML("xhtml", "XHTML", "application/xhtml+xml"),
|
||||
|
||||
XLS("xls", "微软Excel", "application/vnd.ms-excel"),
|
||||
|
||||
XLSX("xlsx", "微软Excel(OpenXML)", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
|
||||
|
||||
XML("xml", "XML", "application/xml"),
|
||||
|
||||
XUL("xul", "XUL", "application/vnd.mozilla.xul+xml"),
|
||||
|
||||
ZIP("zip", "ZIP", "application/zip"),
|
||||
|
||||
MIME_3GP("3gp", "3GPP audio/video container", "video/3gpp"),
|
||||
|
||||
MIME_3GP_WITHOUT_VIDEO("3gp", "3GPP audio/video container doesn't contain video", "audio/3gpp2"),
|
||||
|
||||
MIME_3G2("3g2", "3GPP2 audio/video container", "video/3gpp2"),
|
||||
|
||||
MIME_3G2_WITHOUT_VIDEO("3g2", "3GPP2 audio/video container doesn't contain video", "audio/3gpp2"),
|
||||
|
||||
MIME_7Z("7z", "7-zip存档", "application/x-7z-compressed");
|
||||
|
||||
//扩展名
|
||||
private final String extension;
|
||||
//说明
|
||||
private final String explain;
|
||||
//contentType/mime类型
|
||||
private final String mimeType;
|
||||
|
||||
/**
|
||||
* @param extension 上传的文件扩展名
|
||||
* @param explain 类型说明
|
||||
* @param mimeType Mime对应的类型
|
||||
*/
|
||||
MimeTypeEnum(String extension, String explain, String mimeType) {
|
||||
this.extension = extension;
|
||||
this.explain = explain;
|
||||
this.mimeType = mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过扩展名获取枚举类型
|
||||
*
|
||||
* @param extension 扩展名
|
||||
* @return 枚举类
|
||||
*/
|
||||
public static MimeTypeEnum getByExtension(String extension) {
|
||||
if (StrUtil.isBlank(extension)) {
|
||||
return null;
|
||||
}
|
||||
for (MimeTypeEnum typesEnum : MimeTypeEnum.values()) {
|
||||
if (extension.equalsIgnoreCase(typesEnum.getExtension())) {
|
||||
return typesEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content-Type常用对照
|
||||
* 根据后缀获取Mime
|
||||
*
|
||||
* @param fileType 扩展名
|
||||
* @return mime类型
|
||||
*/
|
||||
public static String getContentType(String fileType) {
|
||||
MimeTypeEnum mimeTypeEnum = MimeTypeEnum.getByExtension(fileType);
|
||||
if (mimeTypeEnum != null) {
|
||||
return mimeTypeEnum.getMimeType();
|
||||
}
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 系统通知读取状态
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/12/1
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoticeReadStatusEnum {
|
||||
|
||||
/**
|
||||
* 未读
|
||||
*/
|
||||
UNREAD(0),
|
||||
/**
|
||||
* 已读
|
||||
*/
|
||||
READ(1);
|
||||
|
||||
private final int status;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 系统通知范围
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/12/1
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoticeScopeEnum {
|
||||
|
||||
/**
|
||||
* 部分公开
|
||||
*/
|
||||
PART_PUBLIC(0),
|
||||
/**
|
||||
* 全部可见
|
||||
*/
|
||||
ALL_VISIBLE(1);
|
||||
|
||||
private final int scope;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 通知状态
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/12/1
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoticeStatusEnum {
|
||||
|
||||
/**
|
||||
* 待发送
|
||||
*/
|
||||
NO_SEND(0),
|
||||
/**
|
||||
* 已发送
|
||||
*/
|
||||
SEND(1);
|
||||
|
||||
private final int status;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.enums;
|
||||
|
||||
/**
|
||||
* 文件存储常量类
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
public class StorageConstants {
|
||||
|
||||
/**
|
||||
* 上传基础目录
|
||||
*/
|
||||
public static final String UPLOAD_PATH = "/data/files/";
|
||||
|
||||
/**
|
||||
* 上传文件目录前缀
|
||||
*/
|
||||
public static final String UPLOAD_FILE_PREFIX = "/files/";
|
||||
|
||||
/**
|
||||
* 图片类型文件
|
||||
*/
|
||||
public static final String FILE_IMAGE_TYPE = "image";
|
||||
|
||||
/**
|
||||
* 文件下载路径
|
||||
*/
|
||||
public static final String FILE_DOWNLOAD_PATH = "/v1/manager/sysFile/download/%s/%s";
|
||||
|
||||
/**
|
||||
* 文件预览路径
|
||||
*/
|
||||
public static final String FILE_PREVIEW_PATH = "/v1/manager/sysFile/preview/%s/%s";
|
||||
|
||||
/**
|
||||
* 文件下载路径前缀
|
||||
*/
|
||||
public static final String FILE_DOWNLOAD_PATH_PREFIX = "/v1/manager/sysFile/download/";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.enums;
|
||||
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 文件存储类型
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StorageType {
|
||||
|
||||
/**
|
||||
* 本地
|
||||
*/
|
||||
local("0", "2"),
|
||||
/**
|
||||
* 阿里oss
|
||||
*/
|
||||
oss("1", "1"),
|
||||
/**
|
||||
* minio
|
||||
*/
|
||||
minio("2", "1");
|
||||
|
||||
private final String type;
|
||||
|
||||
private final String position;
|
||||
|
||||
public static StorageType resolve(String type) {
|
||||
for (StorageType value : values()) {
|
||||
if (value.type.equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
throw new BusinessException(String.format("文件存储类型不存在%s", type));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.filter;
|
||||
|
||||
import com.codvision.base.entity.BackendUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 静态资源登录校验
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
@Slf4j
|
||||
public class LoginFilter implements Filter {
|
||||
|
||||
// 路径匹配器,支持通配符
|
||||
public static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();
|
||||
|
||||
// 登录session key
|
||||
public static final String LOGIN_SESSION_KEY = "backendUser";
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest,
|
||||
ServletResponse servletResponse,
|
||||
FilterChain filterChain) throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
// 1.获取请求的URI
|
||||
String requestURI = request.getRequestURI();
|
||||
log.info("拦截到请求{}", requestURI);
|
||||
|
||||
String[] urls = new String[]{
|
||||
"/backend/page/login.html",
|
||||
"/backend/css/**",
|
||||
"/backend/images/**",
|
||||
"/backend/js/**",
|
||||
"/backend/lib/**",
|
||||
"/backend/api/user/login"
|
||||
};
|
||||
|
||||
if (checkAndPass(urls, requestURI)) {
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
HttpSession session = request.getSession();
|
||||
BackendUser baseUser = (BackendUser) session.getAttribute(LOGIN_SESSION_KEY);
|
||||
if (ObjectUtils.isEmpty(baseUser)) {
|
||||
response.sendRedirect("/backend/page/login.html");
|
||||
}
|
||||
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 路径匹配,判断是否需要放行
|
||||
*
|
||||
* @param urls 匹配地址
|
||||
* @param url 请求地址
|
||||
* @return
|
||||
*/
|
||||
public boolean checkAndPass(String[] urls, String url) {
|
||||
for (String item : urls) {
|
||||
if (PATH_MATCHER.match(item, url)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.BackendUser;
|
||||
|
||||
/**
|
||||
* 基础平台框架配置-用户信息
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
public interface BackendUserMapper extends BaseMapper<BackendUser> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
|
||||
/**
|
||||
* excel错误记录 数据层
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface ExcelErrorRecordMapper extends BaseMapper<ExcelErrorRecord> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.codvision.base.entity.GeneratorConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生成代码配置 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface GeneratorConfigMapper extends BaseMapper<GeneratorConfig> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.codvision.base.entity.LocalIconLibrary;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 本地图标 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
public interface LocalIconLibraryMapper extends BaseMapper<LocalIconLibrary> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.QuartzJob;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* qrtz任务详情 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
public interface QuartzJobMapper extends BaseMapper<QuartzJob> {
|
||||
|
||||
/**
|
||||
* 获取qrtz任务列表
|
||||
*
|
||||
* @param jobName 任务名称
|
||||
* @param jobGroup 任务分组(以:定时任务_)
|
||||
* @return qrtz任务列表
|
||||
*/
|
||||
List<QuartzJob> getQuartzJobList(IPage page, @Param("jobName") String jobName, @Param("jobGroup") String jobGroup);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.Region;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区域 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zz
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
public interface RegionMapper extends BaseMapper<Region> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.SysConfig;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统配置 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-09
|
||||
*/
|
||||
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.SysDictItem;
|
||||
|
||||
/**
|
||||
* 字典项 数据层
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.SysDict;
|
||||
|
||||
/**
|
||||
* 字典 数据层
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.SysFile;
|
||||
|
||||
/**
|
||||
* 系统文件 数据层
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface SysFileMapper extends BaseMapper<SysFile> {
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysNotice;
|
||||
import com.codvision.base.entity.vo.SysNoticeVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统通知 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
||||
|
||||
/**
|
||||
* 分页查询系统通知列表
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param sysNotice 查询参数
|
||||
* @return 系统通知列表
|
||||
*/
|
||||
List<SysNoticeVO> getSysNoticeList(IPage page, @Param("sysNotice") SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 根据用户id、类型分页查询
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @param type 消息类型
|
||||
* @return 通知分页列表
|
||||
*/
|
||||
List<SysNoticeVO> getListByUidAndType(IPage page, @Param("uid") Integer uid, @Param("type") Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 判断用户是否有未读的消息
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @return true or false
|
||||
*/
|
||||
Boolean flagUnReadNotice(@Param("uid") Integer uid);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.SysNoticeUserMapper;
|
||||
import com.codvision.base.entity.vo.SysNoticeVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
public interface SysNoticeUserMapperMapper extends BaseMapper<SysNoticeUserMapper> {
|
||||
|
||||
/**
|
||||
* 添加通知发送记录
|
||||
*
|
||||
* @param id 通知id
|
||||
* @param uid 用户id
|
||||
*/
|
||||
void addNoticeUserMapper(@Param("id") Integer id, @Param("uid") Integer uid);
|
||||
|
||||
/**
|
||||
* 查询通知详情
|
||||
*
|
||||
* @param id 通知id
|
||||
* @return 通知详情
|
||||
*/
|
||||
SysNoticeVO getDetail(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 全部标记为已读
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @param type 类型
|
||||
*/
|
||||
void markAllRead(@Param("uid") Integer uid, @Param("type") Integer type);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.codvision.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.codvision.base.entity.SysTag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统标签 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-17
|
||||
*/
|
||||
public interface SysTagMapper extends BaseMapper<SysTag> {
|
||||
|
||||
/**
|
||||
* 批量获取标签列表
|
||||
* @param tagIds 标签ID
|
||||
* @return 标签列表
|
||||
*/
|
||||
List<SysTag> getTagByIds(String tagIds);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 文件存储模块
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/8/14
|
||||
*/
|
||||
package com.codvision.base;
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.codvision.base.entity.BackendUser;
|
||||
import com.codvision.base.entity.vo.BackendUserVO;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
/**
|
||||
* 基础平台框架配置-用户信息接口
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
public interface IBackendUserService extends IBaseService<BackendUser, BackendUserVO> {
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import com.codvision.base.entity.vo.ExcelErrorRecordVO;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* excel错误记录 服务实现类
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public interface IExcelErrorRecordService extends IBaseService<ExcelErrorRecord, ExcelErrorRecordVO> {
|
||||
|
||||
/**
|
||||
* 导出错误记录
|
||||
*
|
||||
* @param reqNo 序列号
|
||||
*/
|
||||
void excelExport(String reqNo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.GeneratorConfig;
|
||||
import com.codvision.base.entity.vo.GeneratorConfigVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生成代码配置 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
public interface IGeneratorConfigService extends IBaseService<GeneratorConfig, GeneratorConfigVO> {
|
||||
|
||||
/**
|
||||
* 获取生成代码配置详情
|
||||
*
|
||||
* @param id
|
||||
* @return 生成代码配置
|
||||
*/
|
||||
GeneratorConfigVO getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询生成代码配置
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<GeneratorConfigVO> getPageResult(QueryPage<GeneratorConfig> queryPage);
|
||||
|
||||
/**
|
||||
* 根据条件查询生成代码配置
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 生成代码配置列表
|
||||
*/
|
||||
List<GeneratorConfigVO> listAll(GeneratorConfig queryBean);
|
||||
|
||||
/**
|
||||
* 根据配置生成代码
|
||||
*
|
||||
* @param id 配置id
|
||||
*/
|
||||
void generateCode(Long id);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.LocalIconLibrary;
|
||||
import com.codvision.base.entity.vo.LocalIconLibraryVO;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 本地图标 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
public interface ILocalIconLibraryService extends IBaseService<LocalIconLibrary, LocalIconLibraryVO> {
|
||||
|
||||
/**
|
||||
* 获取本地图标详情
|
||||
*
|
||||
* @param id
|
||||
* @return 本地图标
|
||||
*/
|
||||
LocalIconLibraryVO getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询本地图标
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<LocalIconLibraryVO> getPageResult(QueryPage<LocalIconLibrary> queryPage);
|
||||
|
||||
/**
|
||||
* 根据条件查询本地图标
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 本地图标列表
|
||||
*/
|
||||
List<LocalIconLibraryVO> listAll(LocalIconLibrary queryBean);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.codvision.base.entity.QuartzJob;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* qrtz任务详情 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
public interface IQuartzJobService extends IService<QuartzJob> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<QuartzJob> getPageResult(QueryPage<QuartzJob> queryPage);
|
||||
|
||||
|
||||
/**
|
||||
* 新增qrtz定时任务
|
||||
*
|
||||
* @param quartzJob 任务信息
|
||||
* @return 新增后的任务信息
|
||||
*/
|
||||
QuartzJob addQuartzJob(QuartzJob quartzJob);
|
||||
|
||||
/**
|
||||
* 更新quartz定时任务
|
||||
*
|
||||
* @param quartzJob 任务信息
|
||||
* @return 修改后的任务信息
|
||||
*/
|
||||
QuartzJob updateJob(QuartzJob quartzJob);
|
||||
|
||||
/**
|
||||
* 根据条件批量删除
|
||||
*
|
||||
* @param quartzJobs 删除条件
|
||||
*/
|
||||
void batchDeleteJob(List<QuartzJob> quartzJobs);
|
||||
|
||||
/**
|
||||
* 获取执行类的所有方法
|
||||
*
|
||||
* @param className 类名
|
||||
* @return 方法名
|
||||
*/
|
||||
List<String> getAllMethod(String className);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.codvision.base.entity.Region;
|
||||
import com.codvision.base.entity. vo.RegionVO;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区域 服务接口
|
||||
* </p>
|
||||
*
|
||||
* @author zz
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
public interface IRegionService extends IBaseService<Region, RegionVO> {
|
||||
|
||||
|
||||
/**
|
||||
* 同步行政数据
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
@CacheEvict
|
||||
void synchronizationData(String url);
|
||||
|
||||
/**
|
||||
* 获取地区列表
|
||||
*
|
||||
* @param id 地区ID
|
||||
* @return 地区列表
|
||||
*/
|
||||
|
||||
List<Region> getItem(Long id);
|
||||
|
||||
/**
|
||||
* 根据最后一级名称获取改所有上级地区id
|
||||
*
|
||||
* @param lastName 最后一级名称
|
||||
* @return 全部地区id
|
||||
*/
|
||||
String getItemByLastName(String lastName);
|
||||
|
||||
/**
|
||||
* 获取地址
|
||||
*
|
||||
* @param cityCode 城市编码
|
||||
* @param townName 镇名称
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getRegion(String cityCode, String townName);
|
||||
|
||||
/**
|
||||
* 获取所有的城市
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<RegionVO> getAllCity();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysConfig;
|
||||
import com.codvision.base.entity.vo.SysConfigVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统配置 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-09
|
||||
*/
|
||||
public interface ISysConfigService extends IBaseService<SysConfig, SysConfigVO> {
|
||||
|
||||
/**
|
||||
* 获取系统配置详情
|
||||
*
|
||||
* @param id
|
||||
* @return 系统配置
|
||||
*/
|
||||
SysConfigVO getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询系统配置
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysConfigVO> getPageResult(QueryPage<SysConfig> queryPage);
|
||||
|
||||
/**
|
||||
* 根据条件查询系统配置
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 系统配置列表
|
||||
*/
|
||||
List<SysConfigVO> listAll(SysConfig queryBean);
|
||||
|
||||
/**
|
||||
* 根据配置名获取系统配置
|
||||
*
|
||||
* @param key 配置名
|
||||
* @return 系统配置
|
||||
*/
|
||||
SysConfig getByKey(String key);
|
||||
|
||||
/**
|
||||
* 根据配置名获取系统配置值
|
||||
*
|
||||
* @param key 配置名
|
||||
* @return 系统配置值
|
||||
*/
|
||||
String getValueByKey(String key);
|
||||
|
||||
/**
|
||||
* 根据配置名获取系统配置值
|
||||
*
|
||||
* @param key 配置名
|
||||
* @return 系统配置值
|
||||
*/
|
||||
String getValueThrowException(String key);
|
||||
|
||||
/**
|
||||
* 根据分类获取系统配置列表
|
||||
*
|
||||
* @param largeCategory 系统分类
|
||||
* @return 系统配置列表
|
||||
*/
|
||||
Map<String, List<SysConfig>> getListByLargeCategory(String largeCategory);
|
||||
|
||||
/**
|
||||
* 更新系统配置
|
||||
*
|
||||
* @param sysConfigs 系统配置
|
||||
*/
|
||||
void updateAll(List<SysConfig> sysConfigs);
|
||||
|
||||
/**
|
||||
* 根据系统配置名列表获取系统配置
|
||||
*
|
||||
* @param keys 配置名列表
|
||||
* @return
|
||||
*/
|
||||
List<SysConfig> getListByKeys(List<String> keys);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysDictItem;
|
||||
import com.codvision.base.entity.vo.SysDictItemVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典项 服务类
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface ISysDictItemService extends IBaseService<SysDictItem, SysDictItemVO> {
|
||||
|
||||
/**
|
||||
* 根据条件查询字典项列表
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 字典项列表
|
||||
*/
|
||||
List<SysDictItem> getItemList(SysDictItem queryBean);
|
||||
|
||||
/**
|
||||
* 获取字典项分页列表
|
||||
*
|
||||
* @param queryPage 分页条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysDictItemVO> getPageResult(QueryPage<SysDictItem> queryPage);
|
||||
|
||||
/**
|
||||
* 添加字典项
|
||||
*
|
||||
* @param sysDictItem 字典项
|
||||
* @return 字典项
|
||||
*/
|
||||
SysDictItem addDictItem(SysDictItem sysDictItem);
|
||||
|
||||
/**
|
||||
* 更新字典项
|
||||
*
|
||||
* @param sysDictItem 字典项
|
||||
* @return 字典项
|
||||
*/
|
||||
SysDictItem updateDictItem(SysDictItem sysDictItem);
|
||||
|
||||
/**
|
||||
* 删除字典项
|
||||
*
|
||||
* @param id id
|
||||
*/
|
||||
void removeDictItem(Integer id);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysDict;
|
||||
import com.codvision.base.entity.vo.SysDictVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
/**
|
||||
* 字典 服务类
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface ISysDictService extends IBaseService<SysDict, SysDictVO> {
|
||||
|
||||
/**
|
||||
* 分页查询系统字典列表
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysDictVO> getPageResult(QueryPage<SysDict> queryPage);
|
||||
|
||||
/**
|
||||
* 添加字典
|
||||
*
|
||||
* @param sysDict 字典信息
|
||||
*/
|
||||
void addDict(SysDict sysDict);
|
||||
|
||||
/**
|
||||
* 更新字典
|
||||
*
|
||||
* @param sysDict 字典信息
|
||||
*/
|
||||
void updateDict(SysDict sysDict);
|
||||
|
||||
/**
|
||||
* 删除字典接口
|
||||
*
|
||||
* @param id 字典id
|
||||
*/
|
||||
void removeDict(Integer id);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.codvision.base.entity.FileUploadResult;
|
||||
import com.codvision.base.entity.SysFile;
|
||||
import com.codvision.base.entity.vo.SysFileVO;
|
||||
import com.codvision.base.enums.StorageType;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统文件 服务类
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
public interface ISysFileService extends IBaseService<SysFile, SysFileVO> {
|
||||
|
||||
/**
|
||||
* 更新文件为有效状态
|
||||
*
|
||||
* @param fileName 文件名
|
||||
*/
|
||||
void updateIsValidByFileName(String fileName);
|
||||
|
||||
/**
|
||||
* 通过id删除文件管理
|
||||
*
|
||||
* @param ids 文件id
|
||||
*/
|
||||
void deleteFile(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param storageType 文件存储类型
|
||||
* @return 上传结果
|
||||
*/
|
||||
FileUploadResult uploadFile(MultipartFile file, StorageType storageType);
|
||||
|
||||
/**
|
||||
* 读取oss文件
|
||||
*
|
||||
* @param bucket 桶名
|
||||
* @param fileName 文件名
|
||||
* @param response 响应
|
||||
*/
|
||||
void getFile(String bucket, String fileName, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @param bucket 空间名称
|
||||
* @param fileName 文件名
|
||||
* @param response 输出流
|
||||
*/
|
||||
void download(String bucket, String fileName, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 预览文件
|
||||
*
|
||||
* @param bucket 空间名称
|
||||
* @param fileName 文件名称
|
||||
* @param response 输出流
|
||||
*/
|
||||
void preview(String bucket, String fileName, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 根据文件路径获取文件流
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @return 文件流
|
||||
*/
|
||||
InputStream getFileStream(String filePath);
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysNotice;
|
||||
import com.codvision.base.entity.dto.SysNoticeDTO;
|
||||
import com.codvision.base.entity.vo.SysNoticeVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统通知 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
public interface ISysNoticeService extends IBaseService<SysNotice, SysNoticeVO> {
|
||||
|
||||
/**
|
||||
* 获取系统通知详情
|
||||
*
|
||||
* @param id
|
||||
* @return 系统通知
|
||||
*/
|
||||
SysNoticeVO getDetail(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询系统通知
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysNoticeVO> getPageResult(QueryPage<SysNotice> queryPage);
|
||||
|
||||
/**
|
||||
* 根据条件查询系统通知
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 系统通知列表
|
||||
*/
|
||||
List<SysNoticeVO> listAll(SysNotice queryBean);
|
||||
|
||||
/**
|
||||
* 新增保存系统通知
|
||||
*
|
||||
* @param sysNoticeDTO 通知信息
|
||||
*/
|
||||
void saveSysNotice(SysNoticeDTO sysNoticeDTO);
|
||||
|
||||
/**
|
||||
* 根据系统通知id列表删除系统通知
|
||||
*
|
||||
* @param ids 系统通知id列表
|
||||
*/
|
||||
void deleteSysNotices(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 发送通知
|
||||
*
|
||||
* @param sysNoticeDTO 系统通知
|
||||
*/
|
||||
void send(SysNoticeDTO sysNoticeDTO);
|
||||
|
||||
/**
|
||||
* 撤回通知
|
||||
*
|
||||
* @param sysNoticeDTO
|
||||
*/
|
||||
void revoke(SysNoticeDTO sysNoticeDTO);
|
||||
|
||||
/**
|
||||
* 根据用户id、类型分页查询
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @param type 消息类型
|
||||
* @return 通知分页列表
|
||||
*/
|
||||
IPage<SysNoticeVO> getListByUidAndType(IPage<SysNotice> page, Integer uid, Integer type);
|
||||
|
||||
/**
|
||||
* 判断用户是否有未读的消息
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @return 是or否
|
||||
*/
|
||||
Boolean flagUnReadNotice(Integer uid);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysNoticeUserMapper;
|
||||
import com.codvision.base.entity.vo.SysNoticeUserMapperVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-12-01
|
||||
*/
|
||||
public interface ISysNoticeUserMapperService extends IBaseService<SysNoticeUserMapper, SysNoticeUserMapperVO> {
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SysNoticeUserMapperVO getDetail(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysNoticeUserMapperVO> getPageResult(QueryPage<SysNoticeUserMapper> queryPage);
|
||||
|
||||
/**
|
||||
* 根据条件查询
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 列表
|
||||
*/
|
||||
List<SysNoticeUserMapperVO> listAll(SysNoticeUserMapper queryBean);
|
||||
|
||||
/**
|
||||
* 全部标记为已读
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @param type 消息类型
|
||||
*/
|
||||
void markAllRead(Integer uid, Integer type);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.codvision.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.SysTag;
|
||||
import com.codvision.base.entity.vo.SysTagVO;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统标签 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-17
|
||||
*/
|
||||
public interface ISysTagService extends IBaseService<SysTag, SysTagVO> {
|
||||
|
||||
/**
|
||||
* 获取系统标签详情
|
||||
*
|
||||
* @param id
|
||||
* @return 系统标签
|
||||
*/
|
||||
SysTagVO getDetail(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询系统标签
|
||||
*
|
||||
* @param queryPage 分页参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
IPage<SysTagVO> getPageResult(QueryPage<SysTag> queryPage);
|
||||
|
||||
/**
|
||||
* 根据条件查询系统标签
|
||||
*
|
||||
* @param queryBean 查询条件
|
||||
* @return 系统标签列表
|
||||
*/
|
||||
List<SysTagVO> listAll(SysTag queryBean);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service.impl;
|
||||
|
||||
import com.codvision.base.entity.BackendUser;
|
||||
import com.codvision.base.entity.vo.BackendUserVO;
|
||||
import com.codvision.base.mapper.BackendUserMapper;
|
||||
import com.codvision.base.service.IBackendUserService;
|
||||
import com.codvision.webcore.service.impl.BaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 基础平台框架配置-用户信息接口实现
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/2
|
||||
*/
|
||||
@Service
|
||||
public class BackendUserServiceImpl extends BaseServiceImpl<BackendUserMapper, BackendUser, BackendUserVO> implements IBackendUserService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2023 codvision.com All Rights Reserved.
|
||||
*/
|
||||
|
||||
package com.codvision.base.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.codvision.base.config.excel.AbstractExportClass;
|
||||
import com.codvision.base.entity.ExcelErrorRecord;
|
||||
import com.codvision.base.entity.vo.ExcelErrorRecordVO;
|
||||
import com.codvision.base.mapper.ExcelErrorRecordMapper;
|
||||
import com.codvision.base.service.IExcelErrorRecordService;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.impl.BaseServiceImpl;
|
||||
import com.google.common.base.Preconditions;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* excel错误记录 服务实现类
|
||||
*
|
||||
* @author lingee
|
||||
* @date 2023/11/16
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ExcelErrorRecordServiceImpl extends BaseServiceImpl<ExcelErrorRecordMapper, ExcelErrorRecord, ExcelErrorRecordVO>
|
||||
implements IExcelErrorRecordService {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void excelExport(String reqNo) {
|
||||
ExcelErrorRecord errorRecord = this.getOne(Wrappers.<ExcelErrorRecord>lambdaQuery().eq(ExcelErrorRecord::getReqNo, reqNo).last("limit 1"));
|
||||
Preconditions.checkArgument(errorRecord != null,30001);
|
||||
|
||||
Class<?> clazz = Class.forName(errorRecord.getTargetObject());
|
||||
new AbstractExportClass() {
|
||||
@Override
|
||||
protected List getList(QueryPage queryPage, Object queryBean) {
|
||||
List dataList = new ArrayList<>();
|
||||
|
||||
List<ExcelErrorRecord> errorRecords = list(Wrappers.<ExcelErrorRecord>lambdaQuery().eq(ExcelErrorRecord::getReqNo, reqNo));
|
||||
if (CollectionUtils.isNotEmpty(errorRecords)) {
|
||||
for (ExcelErrorRecord errorRecord : errorRecords) {
|
||||
Object o = JSONUtil.toBean(errorRecord.getOriginalJsonValue(), clazz);
|
||||
BeanUtil.copyProperties(errorRecord, o);
|
||||
dataList.add(o);
|
||||
}
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
}.excelUser("异常数据信息表", null, clazz);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.codvision.base.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
||||
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
|
||||
import com.baomidou.mybatisplus.generator.config.OutputFile;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.codvision.base.config.EnhanceVelocityTemplateEngine;
|
||||
import com.codvision.base.entity.GeneratorConfig;
|
||||
import com.codvision.base.entity.vo.GeneratorConfigVO;
|
||||
import com.codvision.base.mapper.GeneratorConfigMapper;
|
||||
import com.codvision.base.service.IGeneratorConfigService;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import com.codvision.webcore.bean.BasicEntity;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.service.IBaseService;
|
||||
import com.codvision.webcore.service.impl.BaseServiceImpl;
|
||||
import com.codvision.webcore.util.PageUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生成代码配置 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-03
|
||||
*/
|
||||
@Service
|
||||
public class GeneratorConfigServiceImpl extends BaseServiceImpl<GeneratorConfigMapper, GeneratorConfig, GeneratorConfigVO>
|
||||
implements IGeneratorConfigService {
|
||||
|
||||
@Autowired
|
||||
private DataSourceProperties dataSourceProperties;
|
||||
|
||||
private DataSourceConfig.Builder datasourceBuilder;
|
||||
|
||||
@PostConstruct
|
||||
private void initBuilder() {
|
||||
datasourceBuilder = new DataSourceConfig.Builder(
|
||||
dataSourceProperties.getUrl(),
|
||||
dataSourceProperties.getUsername(),
|
||||
dataSourceProperties.getPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratorConfigVO getDetail(Long id) {
|
||||
GeneratorConfigVO vo = new GeneratorConfigVO();
|
||||
GeneratorConfig po = this.getById(id);
|
||||
if (null != po) {
|
||||
BeanUtil.copyProperties(po, vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<GeneratorConfigVO> getPageResult(QueryPage<GeneratorConfig> queryPage) {
|
||||
QueryWrapper<GeneratorConfig> queryWrapper = queryPage.getWrapper();
|
||||
IPage<GeneratorConfigVO> pageResult = this.getBasePage(queryPage.getPage(), queryWrapper);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GeneratorConfigVO> listAll(GeneratorConfig queryBean) {
|
||||
QueryWrapper<GeneratorConfig> wrapper = PageUtil.initWrapper(queryBean);
|
||||
List<GeneratorConfig> list = this.list(wrapper);
|
||||
return BeanUtil.copyToList(list, GeneratorConfigVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateCode(Long id) {
|
||||
GeneratorConfig po = this.getById(id);
|
||||
if (ObjectUtils.isEmpty(po)) {
|
||||
throw new BusinessException("生成代码配置不存在" );
|
||||
}
|
||||
|
||||
String outputDir = po.getExportPath();
|
||||
if (outputDir.lastIndexOf(File.separator) != outputDir.length() - 1) {
|
||||
outputDir += File.separator;
|
||||
}
|
||||
final String finalOutputDir = outputDir;
|
||||
FastAutoGenerator.create(datasourceBuilder)
|
||||
// 全局配置
|
||||
.globalConfig((scanner, builder) -> {
|
||||
builder.author(po.getAuthor());
|
||||
builder.outputDir(finalOutputDir + "/src/main/java" );
|
||||
builder.disableOpenDir();
|
||||
builder.enableSwagger();
|
||||
builder.dateType(DateType.ONLY_DATE);
|
||||
})
|
||||
// 包配置
|
||||
.packageConfig((scanner, builder) -> {
|
||||
builder.parent(po.getPackageName());
|
||||
builder.controller("controller.manager" );
|
||||
builder.pathInfo(Collections.singletonMap(OutputFile.xml, finalOutputDir + "/src/main/resources/mapper" ));
|
||||
})
|
||||
// 策略配置
|
||||
.strategyConfig((scanner, builder) -> {
|
||||
builder.addInclude(getTables(po.getTables()))
|
||||
.controllerBuilder().enableRestStyle().enableHyphenStyle()
|
||||
.formatFileName("Manager%sController" )
|
||||
.entityBuilder()
|
||||
.enableLombok()
|
||||
// .superClass(BaseEntity.class)
|
||||
// .addSuperEntityColumns("id", "create_by", "create_by_name", "create_time", "update_by",
|
||||
// "update_by_name", "update_time", "delete_flag")
|
||||
// .addTableFills(new Property("createTime", FieldFill.INSERT),
|
||||
// new Property("createByName", FieldFill.INSERT),
|
||||
// new Property("createBy", FieldFill.INSERT),
|
||||
// new Property("updateBy", FieldFill.UPDATE),
|
||||
// new Property("updateByName", FieldFill.UPDATE),
|
||||
// new Property("updateTime", FieldFill.INSERT_UPDATE),
|
||||
// new Property("deleteFlag", FieldFill.INSERT))
|
||||
.idType(IdType.AUTO)
|
||||
.serviceBuilder()
|
||||
.superServiceClass(IBaseService.class)
|
||||
.superServiceImplClass(BaseServiceImpl.class)
|
||||
.mapperBuilder()
|
||||
.enableBaseResultMap();
|
||||
if (StringUtils.isNotBlank(po.getTablePrefixName())) {
|
||||
builder.addTablePrefix(po.getTablePrefixName());
|
||||
}
|
||||
if (po.getSuperEntity()) {
|
||||
builder.entityBuilder()
|
||||
.superClass(BasicEntity.class)
|
||||
.addSuperEntityColumns("id" , "create_time" , "update_time" , "del_flag" );
|
||||
}
|
||||
if (po.getFileOverride()) {
|
||||
builder.entityBuilder().enableFileOverride();
|
||||
builder.serviceBuilder().enableFileOverride();
|
||||
builder.controllerBuilder().enableFileOverride();
|
||||
builder.mapperBuilder().enableFileOverride();
|
||||
}
|
||||
builder.build();
|
||||
})
|
||||
// 模板引擎配置,默认 Velocity 可选模板引擎 Beetl 或 Freemarker
|
||||
.templateConfig((scanner, builder) -> {
|
||||
builder.controller("/template/controller.java.vm" );
|
||||
builder.entity("/template/entity.java.vm" );
|
||||
builder.service("/template/service.java.vm" );
|
||||
builder.serviceImpl("/template/serviceImpl.java.vm" );
|
||||
})
|
||||
.injectionConfig((scanner, builder) -> {
|
||||
builder.customFile(Collections.singletonMap("VO.java" , "template/vo.java.vm" ));
|
||||
})
|
||||
.templateEngine(new EnhanceVelocityTemplateEngine())
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(GeneratorConfig generatorConfig) {
|
||||
Assert.notNull(generatorConfig, "生成代码配置不能为空" );
|
||||
getBaseMapper().insert(generatorConfig);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(GeneratorConfig generatorConfig) {
|
||||
Assert.notNull(generatorConfig, "生成代码配置不能为空" );
|
||||
Assert.notNull(generatorConfig.getId(), "生成代码配置id不能为空" );
|
||||
getBaseMapper().updateById(generatorConfig);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
GeneratorConfig generatorConfig = getById(id);
|
||||
Assert.notNull(generatorConfig, "生成代码配置不存在" );
|
||||
getBaseMapper().deleteById(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 处理 all 情况
|
||||
|
||||
/**
|
||||
* 分隔表名
|
||||
*
|
||||
* @param tables 表名
|
||||
* @return
|
||||
*/
|
||||
private static List<String> getTables(String tables) {
|
||||
return "all".equals(tables) ? Collections.emptyList() : Arrays.asList(tables.split("," ));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.codvision.base.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.codvision.base.entity.LocalIconLibrary;
|
||||
import com.codvision.base.entity.vo.LocalIconLibraryVO;
|
||||
import com.codvision.base.mapper.LocalIconLibraryMapper;
|
||||
import com.codvision.base.service.ILocalIconLibraryService;
|
||||
import com.codvision.webcore.service.impl.BaseServiceImpl;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.util.PageUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 本地图标 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
public class LocalIconLibraryServiceImpl extends BaseServiceImpl<LocalIconLibraryMapper, LocalIconLibrary, LocalIconLibraryVO> implements ILocalIconLibraryService {
|
||||
|
||||
@Override
|
||||
public LocalIconLibraryVO getDetail(Long id) {
|
||||
LocalIconLibraryVO vo = new LocalIconLibraryVO();
|
||||
LocalIconLibrary po = this.getById(id);
|
||||
if (null != po) {
|
||||
BeanUtil.copyProperties(po, vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<LocalIconLibraryVO> getPageResult(QueryPage<LocalIconLibrary> queryPage) {
|
||||
QueryWrapper<LocalIconLibrary> queryWrapper = queryPage.getWrapper();
|
||||
IPage<LocalIconLibraryVO> pageResult = this.getBasePage(queryPage.getPage(), queryWrapper);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalIconLibraryVO> listAll(LocalIconLibrary queryBean) {
|
||||
QueryWrapper<LocalIconLibrary> wrapper = PageUtil.initWrapper(queryBean);
|
||||
List<LocalIconLibrary> list = this.list(wrapper);
|
||||
return BeanUtil.copyToList(list, LocalIconLibraryVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(LocalIconLibrary localIconLibrary) {
|
||||
Assert.notNull(localIconLibrary, "本地图标不能为空");
|
||||
getBaseMapper().insert(localIconLibrary);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(LocalIconLibrary localIconLibrary) {
|
||||
Assert.notNull(localIconLibrary, "本地图标不能为空");
|
||||
Assert.notNull(localIconLibrary.getId(), "本地图标id不能为空");
|
||||
getBaseMapper().updateById(localIconLibrary);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
LocalIconLibrary localIconLibrary = getById(id);
|
||||
Assert.notNull(localIconLibrary, "本地图标不存在");
|
||||
getBaseMapper().deleteById(id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.codvision.base.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.codvision.base.entity.QuartzJob;
|
||||
import com.codvision.base.mapper.QuartzJobMapper;
|
||||
import com.codvision.base.service.IQuartzJobService;
|
||||
import com.codvision.base.support.QuartzJobManager;
|
||||
import com.codvision.commoncore.exception.BusinessException;
|
||||
import com.codvision.webcore.bean.QueryPage;
|
||||
import com.codvision.webcore.util.PageUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* qrtz任务详情 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lingee
|
||||
* @since 2023-11-20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob> implements IQuartzJobService {
|
||||
|
||||
@Resource
|
||||
private Scheduler scheduler;
|
||||
|
||||
@Resource
|
||||
private QuartzJobManager quartzJobManager;
|
||||
|
||||
@Override
|
||||
public IPage<QuartzJob> getPageResult(QueryPage<QuartzJob> queryPage) {
|
||||
IPage<QuartzJob> page = queryPage.getPage();
|
||||
QuartzJob queryBean = queryPage.getCondition();
|
||||
List<QuartzJob> list = this.getBaseMapper().getQuartzJobList(page, queryBean.getJobName(), queryBean.getJobGroup());
|
||||
try {
|
||||
for (QuartzJob vo : list) {
|
||||
JobKey key = new JobKey(vo.getJobName(), vo.getJobGroup());
|
||||
// 获取定时存储参数(方法名)
|
||||
JobDetail jobDetail = scheduler.getJobDetail(key);
|
||||
if (ObjectUtil.isNotEmpty(jobDetail)) {
|
||||
vo.setJobMethodName(jobDetail.getJobDataMap().getString("jobMethodName"));
|
||||
}
|
||||
}
|
||||
} catch (SchedulerException e) {
|
||||
throw new BusinessException(10000, "获取定时任务列表错误");
|
||||
}
|
||||
|
||||
return PageUtil.convertPage(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuartzJob addQuartzJob(QuartzJob quartzJob) {
|
||||
boolean flagJob = quartzJobManager.flagJob(quartzJob.getJobName(), quartzJob.getJobGroup());
|
||||
if (flagJob) {
|
||||
throw new BusinessException("该任务组中已存在该名称任务!");
|
||||
}
|
||||
Class<?> jobClass;
|
||||
try {
|
||||
jobClass = Class.forName(quartzJob.getJobClassName());
|
||||
jobClass.getMethod(quartzJob.getJobMethodName());
|
||||
|
||||
jobClass.newInstance();
|
||||
Map<String, Object> map = new HashMap<>(16);
|
||||
map.put("jobMethodName", quartzJob.getJobMethodName());
|
||||
// 加入定时任务
|
||||
quartzJobManager.addJob(jobClass, quartzJob.getJobName(), quartzJob.getJobGroup(), quartzJob.getDescription(), quartzJob.getCronExpression(), map);
|
||||
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new BusinessException("定时任务类中未找到该方法!");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new BusinessException("定时任务类中未找到该类!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
throw new BusinessException("加入定时任务失败!");
|
||||
}
|
||||
return quartzJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuartzJob updateJob(QuartzJob quartzJob) {
|
||||
// 删除对应定时任务
|
||||
quartzJobManager.deleteJob(quartzJob.getOldJobName(), quartzJob.getOldJobGroup());
|
||||
return addQuartzJob(quartzJob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchDeleteJob(List<QuartzJob> quartzJobs) {
|
||||
quartzJobs.forEach(quartzJob -> quartzJobManager.deleteJob(quartzJob.getJobName(), quartzJob.getJobGroup()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllMethod(String className) {
|
||||
Class<?> jobClass;
|
||||
try {
|
||||
jobClass = Class.forName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new BusinessException(10000, "获取执行类失败!");
|
||||
}
|
||||
List<String> list = new ArrayList<>();
|
||||
// 获取执行类中所有的方法不包括父类和接口
|
||||
for (Method method : jobClass.getDeclaredMethods()) {
|
||||
if (!"execute".equals(method.getName())) {
|
||||
// 过滤掉定时任务执行方法
|
||||
list.add(method.getName());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
package com.codvision.base.service.impl;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.codvision.base.entity.Region;
|
||||
import com.codvision.base.entity.vo.RegionVO;
|
||||
import com.codvision.base.mapper.RegionMapper;
|
||||
import com.codvision.base.service.IRegionService;
|
||||
import com.codvision.commoncore.utils.HttpClientUtils;
|
||||
import com.codvision.webcore.service.impl.BaseServiceImpl;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zz
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RegionServiceImpl extends BaseServiceImpl<RegionMapper, Region, RegionVO> implements IRegionService {
|
||||
|
||||
/**
|
||||
* 同步请求地址
|
||||
*/
|
||||
private final String syncUrl = "https://restapi.amap.com/v3/config/district?subdistrict=4&key=e456d77800e2084a326f7b777278f89d";
|
||||
|
||||
// @Autowired
|
||||
// private Cache cache;
|
||||
|
||||
@Override
|
||||
public void synchronizationData(String url) {
|
||||
try {
|
||||
|
||||
//清空数据
|
||||
QueryWrapper<Region> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.ne("id", "-1");
|
||||
this.remove(queryWrapper);
|
||||
|
||||
//读取数据
|
||||
String jsonString = HttpClientUtils.doGet(CharSequenceUtil.isEmpty(url) ? syncUrl : url, null);
|
||||
|
||||
//构造存储数据库的对象集合
|
||||
List<Region> regions = this.initData(jsonString);
|
||||
for (int i = 0; i < (regions.size() / 100 + (regions.size() % 100 == 0 ? 0 : 1)); i++) {
|
||||
int endPoint = Math.min((100 + (i * 100)), regions.size());
|
||||
this.saveBatch(regions.subList(i * 100, endPoint));
|
||||
}
|
||||
//删除缓存
|
||||
// cache.vagueDel("{regions}");
|
||||
} catch (Exception e) {
|
||||
log.error("同步行政数据错误", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据最后一级名称获取改所有上级地区id
|
||||
*
|
||||
* @param lastName 最后一级名称
|
||||
* @return 全部地区id
|
||||
*/
|
||||
@Override
|
||||
public String getItemByLastName(String lastName) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
LambdaQueryWrapper<Region> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Region::getName, lastName);
|
||||
Region region = this.getOne(lambdaQueryWrapper, false);
|
||||
if (region != null) {
|
||||
sql.append(region.getPath()).append(",").append(region.getId());
|
||||
return sql.toString().replace(",0,", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Region> getItem(Long id) {
|
||||
LambdaQueryWrapper<Region> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Region::getParentId, id);
|
||||
List<Region> regions = this.list(lambdaQueryWrapper);
|
||||
regions.sort(Comparator.comparing(Region::getOrderNum));
|
||||
return regions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRegion(String cityCode, String townName) {
|
||||
//获取地址信息
|
||||
Region region = this.getOne(new QueryWrapper<Region>()
|
||||
.eq("city_code", cityCode)
|
||||
.eq("name", townName), false);
|
||||
if (region != null) {
|
||||
//获取它的层级关系
|
||||
String path = region.getPath();
|
||||
String[] result = path.split("/");
|
||||
//因为有无用数据 所以先删除前两个
|
||||
result = ArrayUtils.remove(result, 0);
|
||||
result = ArrayUtils.remove(result, 0);
|
||||
//地址id
|
||||
StringBuilder regionIds = new StringBuilder();
|
||||
//地址名称
|
||||
StringBuilder regionNames = new StringBuilder();
|
||||
//循环构建新的数据
|
||||
for (String regionId : result) {
|
||||
Region reg = this.baseMapper.selectById(regionId);
|
||||
if (reg != null) {
|
||||
regionIds.append(regionId).append(",");
|
||||
regionNames.append(reg.getName()).append(",");
|
||||
}
|
||||
}
|
||||
regionIds.append(region.getId());
|
||||
regionNames.append(region.getName());
|
||||
//构建返回数据
|
||||
Map<String, Object> obj = new HashMap<>(2);
|
||||
obj.put("id", regionIds.toString());
|
||||
obj.put("name", regionNames.toString());
|
||||
return obj;
|
||||
}
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionVO> getAllCity() {
|
||||
LambdaQueryWrapper<Region> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//查询所有省市
|
||||
lambdaQueryWrapper.in(Region::getLevel, "city", "province");
|
||||
return regionTree(this.list(lambdaQueryWrapper));
|
||||
}
|
||||
|
||||
private List<RegionVO> regionTree(List<Region> regions) {
|
||||
List<RegionVO> regionVOS = new ArrayList<>();
|
||||
regions.stream().filter(region -> ("province").equals(region.getLevel())).forEach(item -> regionVOS.add(new RegionVO(item)));
|
||||
regions.stream().filter(region -> ("city").equals(region.getLevel())).forEach(item -> {
|
||||
for (RegionVO region : regionVOS) {
|
||||
if (region.getId().equals(item.getParentId())) {
|
||||
region.getChildren().add(new RegionVO(item));
|
||||
}
|
||||
}
|
||||
});
|
||||
return regionVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造数据模型
|
||||
*
|
||||
* @param jsonString
|
||||
* @throws Exception
|
||||
*/
|
||||
private List<Region> initData(String jsonString) {
|
||||
|
||||
//最终数据承载对象
|
||||
List<Region> regions = new ArrayList<>();
|
||||
JSONObject jsonObject = JSONUtil.parseObj(jsonString);
|
||||
//获取到国家及下面所有的信息 开始循环插入,这里可以写成递归调用,但是不如这样方便查看、理解
|
||||
JSONArray countryAll = jsonObject.getJSONArray("districts");
|
||||
for (int i = 0; i < countryAll.size(); i++) {
|
||||
JSONObject contry = countryAll.getJSONObject(i);
|
||||
Long id1 = 0L;
|
||||
JSONArray provinceAll = contry.getJSONArray("districts");
|
||||
for (int j = 0; j < provinceAll.size(); j++) {
|
||||
JSONObject province = provinceAll.getJSONObject(j);
|
||||
String citycode1 = province.getStr("citycode");
|
||||
String adcode1 = province.getStr("adcode");
|
||||
String name1 = province.getStr("name");
|
||||
String center1 = province.getStr("center");
|
||||
String level1 = province.getStr("level");
|
||||
//插入省
|
||||
Long id2 = insert(regions, id1, citycode1, adcode1, name1, center1, level1, j, id1);
|
||||
JSONArray cityAll = province.getJSONArray("districts");
|
||||
|
||||
for (int z = 0; z < cityAll.size(); z++) {
|
||||
JSONObject city = cityAll.getJSONObject(z);
|
||||
String citycode2 = city.getStr("citycode");
|
||||
String adcode2 = city.getStr("adcode");
|
||||
String name2 = city.getStr("name");
|
||||
String center2 = city.getStr("center");
|
||||
String level2 = city.getStr("level");
|
||||
//插入市
|
||||
Long id3 = insert(regions, id2, citycode2, adcode2, name2, center2, level2, z, id1, id2);
|
||||
JSONArray districtAll = city.getJSONArray("districts");
|
||||
for (int w = 0; w < districtAll.size(); w++) {
|
||||
JSONObject district = districtAll.getJSONObject(w);
|
||||
String citycode3 = district.getStr("citycode");
|
||||
String adcode3 = district.getStr("adcode");
|
||||
String name3 = district.getStr("name");
|
||||
String center3 = district.getStr("center");
|
||||
String level3 = district.getStr("level");
|
||||
//插入区县
|
||||
Long id4 = insert(regions, id3, citycode3, adcode3, name3, center3, level3, w, id1, id2, id3);
|
||||
//有需要可以继续向下遍历
|
||||
JSONArray streetAll = district.getJSONArray("districts");
|
||||
for (int r = 0; r < streetAll.size(); r++) {
|
||||
JSONObject street = streetAll.getJSONObject(r);
|
||||
String citycode4 = street.getStr("citycode");
|
||||
String adcode4 = street.getStr("adcode");
|
||||
String name4 = street.getStr("name");
|
||||
String center4 = street.getStr("center");
|
||||
String level4 = street.getStr("level");
|
||||
//插入区县
|
||||
insert(regions, id4, citycode4, adcode4, name4, center4, level4, r, id1, id2, id3, id4);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共的插入方法
|
||||
*
|
||||
* @param parentId 父id
|
||||
* @param cityCode 城市编码
|
||||
* @param adCode 区域编码 街道没有独有的adcode,均继承父类(区县)的adcode
|
||||
* @param name 城市名称 (行政区名称)
|
||||
* @param center 地理坐标
|
||||
* @param level country:国家
|
||||
* province:省份(直辖市会在province和city显示)
|
||||
* city:市(直辖市会在province和city显示)
|
||||
* district:区县
|
||||
* street:街道
|
||||
* @param ids 地区id集合
|
||||
* @return
|
||||
*/
|
||||
public Long insert(List<Region> regions, Long parentId, String cityCode, String adCode, String name, String center, String level, Integer order, Long... ids) {
|
||||
// \"citycode\": [],\n" +
|
||||
// " \"adcode\": \"100000\",\n" +
|
||||
// " \"name\": \"中华人民共和国\",\n" +
|
||||
// " \"center\": \"116.3683244,39.915085\",\n" +
|
||||
// " \"level\": \"country\",\n" +
|
||||
Region record = new Region();
|
||||
if (!("[]").equals(adCode)) {
|
||||
record.setAdCode(adCode);
|
||||
}
|
||||
if (!("[]").equals(cityCode)) {
|
||||
record.setCityCode(cityCode);
|
||||
}
|
||||
record.setCenter(center);
|
||||
record.setLevel(level);
|
||||
record.setName(name);
|
||||
record.setParentId(parentId);
|
||||
record.setOrderNum(order);
|
||||
//record.setId(String.valueOf(SnowFlake.getId()));
|
||||
StringBuilder megName = new StringBuilder(",");
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
megName.append(ids[i]);
|
||||
if (i < ids.length - 1) {
|
||||
megName.append(",");
|
||||
}
|
||||
}
|
||||
record.setPath(megName.toString());
|
||||
regions.add(record);
|
||||
return record.getId();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user