Compare commits
367 Commits
3639983d59
...
895f2f9caa
| Author | SHA1 | Date |
|---|---|---|
|
|
895f2f9caa | |
|
|
ffc78462c8 | |
|
|
480f5a1456 | |
|
|
402e60b65f | |
|
|
a04b6047f1 | |
|
|
e01b5a2cf8 | |
|
|
750d21d8f9 | |
|
|
a4aba1fdfc | |
|
|
963428a157 | |
|
|
e720411d24 | |
|
|
0fe0d53d76 | |
|
|
dbba7ea178 | |
|
|
3dc82bdea3 | |
|
|
71b8297312 | |
|
|
94a8c8ec43 | |
|
|
9b5bab91be | |
|
|
e210b2f1fe | |
|
|
42ff118157 | |
|
|
43001fca86 | |
|
|
80c3638631 | |
|
|
c0c07202a2 | |
|
|
ec77d371c1 | |
|
|
fe656f9beb | |
|
|
d8fec2ca0b | |
|
|
14dec7319e | |
|
|
851c7e0d47 | |
|
|
77cf01c372 | |
|
|
01ff53aa83 | |
|
|
be18f0eed6 | |
|
|
791fe905cc | |
|
|
997bef0b3b | |
|
|
be45a0700b | |
|
|
0b74ec12fd | |
|
|
3fe8c1498f | |
|
|
16a256ced8 | |
|
|
1fec7792ff | |
|
|
98baf35bb1 | |
|
|
881e5bf5c9 | |
|
|
832ed737bf | |
|
|
34c51c775e | |
|
|
a6cb01bfdb | |
|
|
2d43880a51 | |
|
|
284dea6a98 | |
|
|
344666b50b | |
|
|
51caef89ef | |
|
|
98dd3e1938 | |
|
|
183ac999cb | |
|
|
0749e8e543 | |
|
|
f48c02967d | |
|
|
7944c5bfc9 | |
|
|
330d0a4310 | |
|
|
b13f41f8ed | |
|
|
48ca408ef3 | |
|
|
6c31cd0c42 | |
|
|
0dc0c1d658 | |
|
|
1174a74211 | |
|
|
efcf899114 | |
|
|
e27c3d9c65 | |
|
|
73b99308be | |
|
|
a0bbdaddc8 | |
|
|
ea62e1ecb7 | |
|
|
89821b83f5 | |
|
|
419d3f0a9e | |
|
|
4d145eaaea | |
|
|
50040f2216 | |
|
|
a7c19b1c93 | |
|
|
d9525bc13b | |
|
|
dda88c8aad | |
|
|
d2a1a34328 | |
|
|
f7275abe20 | |
|
|
d466e8fa16 | |
|
|
1aae819f4e | |
|
|
7139f5350c | |
|
|
08310e1606 | |
|
|
b634a4396f | |
|
|
2f1d15240e | |
|
|
7e4e8df1f4 | |
|
|
560b7b30c7 | |
|
|
e1e6e9f466 | |
|
|
cb4cfe1618 | |
|
|
2c7b0eea0a | |
|
|
df763a94c9 | |
|
|
c983fda287 | |
|
|
98d8b621b3 | |
|
|
56a49fb271 | |
|
|
750eba800e | |
|
|
70111a98fe | |
|
|
98e7023c5c | |
|
|
044c9f1b42 | |
|
|
67fb0f2b39 | |
|
|
efb9d4f055 | |
|
|
a22b20aab7 | |
|
|
821f4adfc1 | |
|
|
346b971481 | |
|
|
83abbd18f1 | |
|
|
36e57222f9 | |
|
|
692af9163c | |
|
|
0712a1d912 | |
|
|
49283d068f | |
|
|
acd011e69f | |
|
|
0a75c9c773 | |
|
|
815bf60b65 | |
|
|
c525e30372 | |
|
|
d1dead8802 | |
|
|
86cda0a547 | |
|
|
b5da2e3082 | |
|
|
1860c2f41b | |
|
|
fd81961ddb | |
|
|
1be0488bd6 | |
|
|
d247fda266 | |
|
|
8043e8055d | |
|
|
cbbcdad382 | |
|
|
251908b8b0 | |
|
|
095efe428a | |
|
|
e11157ec41 | |
|
|
c695c3b404 | |
|
|
8dab45c624 | |
|
|
98ed6eafdb | |
|
|
081bbbd629 | |
|
|
862eb216e5 | |
|
|
46d68f8d4b | |
|
|
b0fe94d2ee | |
|
|
97f68690b2 | |
|
|
218a2af06e | |
|
|
2e1de849b2 | |
|
|
9b177b5c1d | |
|
|
059a417001 | |
|
|
2a0886c7ce | |
|
|
4217b9dc66 | |
|
|
e951153a9f | |
|
|
87cfbb4d0e | |
|
|
b8476c2398 | |
|
|
dc7498806e | |
|
|
d123811617 | |
|
|
9f48a4db76 | |
|
|
bf080e393d | |
|
|
1a42ca6a55 | |
|
|
48ad417e94 | |
|
|
0c84a91bc8 | |
|
|
2735a5296a | |
|
|
75100a33db | |
|
|
f5c9dec963 | |
|
|
42377da9f8 | |
|
|
ae25a60b1c | |
|
|
46107e53ef | |
|
|
ac8277f959 | |
|
|
dbeccc65df | |
|
|
0fd2804517 | |
|
|
567f6e53e8 | |
|
|
c539c88c7c | |
|
|
2e5f36a9c9 | |
|
|
c323e12cf8 | |
|
|
9bca629336 | |
|
|
46771e9a90 | |
|
|
3b721dd3c9 | |
|
|
47c4a16fb7 | |
|
|
75913cdc1b | |
|
|
f22aad8b27 | |
|
|
6ca5b5cec5 | |
|
|
18a56f111e | |
|
|
5390bd1e40 | |
|
|
5b2817d66e | |
|
|
6a48585380 | |
|
|
849f96cf20 | |
|
|
9da19d7e4e | |
|
|
9b2698d919 | |
|
|
14a862e025 | |
|
|
038747d236 | |
|
|
21ee580fc7 | |
|
|
a5766b31d3 | |
|
|
7e96ca171e | |
|
|
5d4e70206b | |
|
|
280b4e691e | |
|
|
e004eed373 | |
|
|
3c3bc2074a | |
|
|
97227974e4 | |
|
|
ff32992c8d | |
|
|
228a8d5142 | |
|
|
efe6c79713 | |
|
|
7aa4613b96 | |
|
|
6c0632242d | |
|
|
ad2f822dca | |
|
|
e2d64cbce7 | |
|
|
54a6901dbb | |
|
|
21d282c882 | |
|
|
dd8f900bec | |
|
|
5fd43452de | |
|
|
d9ffa2438d | |
|
|
bea84f57c2 | |
|
|
8e07e4dd8a | |
|
|
d5a6459734 | |
|
|
e26819824a | |
|
|
52ed7f3a53 | |
|
|
b961c267c8 | |
|
|
d299e347e4 | |
|
|
1f0bff89ca | |
|
|
617d005e0d | |
|
|
dca641d664 | |
|
|
19ed3f1b1b | |
|
|
9ac1b9fdf5 | |
|
|
06844c7557 | |
|
|
56b5838177 | |
|
|
b840c659a0 | |
|
|
1b71543cb6 | |
|
|
6697cbdfcb | |
|
|
d2b391a2ea | |
|
|
2e4f7eb099 | |
|
|
d58d783979 | |
|
|
1d37a302be | |
|
|
8213bbf18c | |
|
|
10ca9cd403 | |
|
|
ab8786be7f | |
|
|
4be8e338dd | |
|
|
830b0b484f | |
|
|
efb061c5ad | |
|
|
1df178b74d | |
|
|
aea1427eaa | |
|
|
fc56722ce5 | |
|
|
e119cf7d05 | |
|
|
ff2d3c3e7b | |
|
|
b311ba2c11 | |
|
|
83ff46efc3 | |
|
|
eac95e140f | |
|
|
5fa31e6a0f | |
|
|
8556f5ae4a | |
|
|
10439890d5 | |
|
|
959433bbe7 | |
|
|
7f9d2cf3bf | |
|
|
e41ef76803 | |
|
|
53f61ba8f8 | |
|
|
f05803432f | |
|
|
8e3f27eeaf | |
|
|
f51f76fa6d | |
|
|
2924849d2f | |
|
|
0c5aab655a | |
|
|
1d3f0e267e | |
|
|
314c93efb9 | |
|
|
fd4ea6c77f | |
|
|
964011b8d9 | |
|
|
6110687938 | |
|
|
d48a592e85 | |
|
|
2549ca5db4 | |
|
|
8f5486df67 | |
|
|
a148bc463a | |
|
|
d549cc6b73 | |
|
|
a55bb0eb18 | |
|
|
82acc597e6 | |
|
|
6c569dbccf | |
|
|
3bfbebf460 | |
|
|
b2063c6219 | |
|
|
52e58019fc | |
|
|
7a76d94581 | |
|
|
a1fa5a9225 | |
|
|
63c2e3c250 | |
|
|
5a3874a748 | |
|
|
3e6471079d | |
|
|
5f0c7ce861 | |
|
|
5d8fca9ee1 | |
|
|
080d369e42 | |
|
|
a750c3cb62 | |
|
|
77fdd99e69 | |
|
|
3d908e23b6 | |
|
|
4d201505dc | |
|
|
dc7d061be2 | |
|
|
543d253ac4 | |
|
|
4bd12e3761 | |
|
|
12e45cf7d1 | |
|
|
2ea2a156ca | |
|
|
b578b91b0d | |
|
|
e91fb07dff | |
|
|
4052d9b0ea | |
|
|
34fdf667ec | |
|
|
d44de8d924 | |
|
|
bd59d91776 | |
|
|
69fa79bf59 | |
|
|
b911212ef2 | |
|
|
68724883a7 | |
|
|
b8142c5ff2 | |
|
|
965831ae6b | |
|
|
5cb52e3252 | |
|
|
e506ef262a | |
|
|
60269d0409 | |
|
|
f468e0f680 | |
|
|
96edc80df9 | |
|
|
833a0877b7 | |
|
|
8ba1de209b | |
|
|
4f51521354 | |
|
|
9c6ababd34 | |
|
|
dd85e18e76 | |
|
|
2bd7795002 | |
|
|
347ae33c71 | |
|
|
5eb98d6f78 | |
|
|
38fcdcb859 | |
|
|
cbec04ba89 | |
|
|
e685dbff5b | |
|
|
ef19d92abf | |
|
|
9b6b837840 | |
|
|
545188be69 | |
|
|
58e4c4397d | |
|
|
cbcc133c2f | |
|
|
26954302de | |
|
|
2eb38794c4 | |
|
|
c389f40848 | |
|
|
456db7f1ef | |
|
|
0e4e320b94 | |
|
|
384c54a842 | |
|
|
25ca8ba06c | |
|
|
ebf09cfe1f | |
|
|
a6fa3f0d59 | |
|
|
5af549321b | |
|
|
bb6058be9c | |
|
|
4819e534eb | |
|
|
3057b9cf7c | |
|
|
e47e4bd3e8 | |
|
|
55bc397f9e | |
|
|
a6b809e051 | |
|
|
46d798a019 | |
|
|
5e9caede22 | |
|
|
74445e99c2 | |
|
|
b099734668 | |
|
|
5e118c9d10 | |
|
|
cd07bb989c | |
|
|
ac415f13b4 | |
|
|
2c6189cc6e | |
|
|
9ee75303cc | |
|
|
c3d570a3f3 | |
|
|
3d562bdc5a | |
|
|
cfa56f3913 | |
|
|
6c1e024d51 | |
|
|
f9a9fee343 | |
|
|
5b8dfe9577 | |
|
|
3c8d8b165e | |
|
|
c6758de47a | |
|
|
cf5a078473 | |
|
|
feb6fa89da | |
|
|
ca77c4a91c | |
|
|
893fbb5597 | |
|
|
805b25686e | |
|
|
99f645566d | |
|
|
971376ca7c | |
|
|
50e8af4a39 | |
|
|
02fa119bcb | |
|
|
4294808f98 | |
|
|
ff9b219ef3 | |
|
|
c8babeb041 | |
|
|
961bfb2baa | |
|
|
40ce933356 | |
|
|
b048fc6f02 | |
|
|
1ab139ce48 | |
|
|
5d773f7ef3 | |
|
|
b08e515b11 | |
|
|
bac3da7d8f | |
|
|
409afa710b | |
|
|
f999b63793 | |
|
|
6a5ad927c2 | |
|
|
f59031bd5c | |
|
|
e097e6e1aa | |
|
|
9fae4c420d | |
|
|
53e61b11d4 | |
|
|
7450f41a9d | |
|
|
9a2a99e073 | |
|
|
192672ab2c | |
|
|
9603bff042 | |
|
|
34708604de | |
|
|
b2a63e4f18 | |
|
|
a91397ebbf | |
|
|
799fb336c1 |
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.electromagnetic.data</groupId>
|
||||
<artifactId>electromagnetic-data-new</artifactId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>electrmangnetic-backup</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.electromagnetic.data</groupId>
|
||||
<artifactId>electromagnetic-common</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<!-- 可选:添加 JAXB 实现库(如 jaxb-impl) -->
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>electromagnetic-backup</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.12</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<configuration>
|
||||
<mainClass>com.electromagnetic.industry.software.backup.MainApp</mainClass>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.electromagnetic.industry.software.backup;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class MainApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MainApp.class, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.electromagnetic.industry.software.backup.controller;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.electromagnetic.industry.software.backup.pojo.BackupPro;
|
||||
import com.electromagnetic.industry.software.backup.service.FileService;
|
||||
import com.electromagnetic.industry.software.common.pojo.BackupFileResLog;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/file/backup")
|
||||
@Slf4j
|
||||
public class FileController {
|
||||
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
@Resource
|
||||
private BackupPro backupPro;
|
||||
|
||||
@RequestMapping("/upload")
|
||||
public ElectromagneticResult<?> upload(@RequestParam("file") MultipartFile file) {
|
||||
BackupFileResLog backupFileResLog = BackupFileResLog.builder().backupStartTime(new Date()).fileName(file.getOriginalFilename()).backupSuccess(true).build();
|
||||
try {
|
||||
fileService.upload(file);
|
||||
} catch (Exception e) {
|
||||
String details = ExceptionUtil.stacktraceToString(e);
|
||||
backupFileResLog.setBackupSuccess(false);
|
||||
backupFileResLog.setFailInfoDetail(details);
|
||||
log.error("备份文件失败,原因--->{}", e.getMessage(), e);
|
||||
}
|
||||
JSONConfig jsonConfig = JSONConfig.create();
|
||||
jsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
backupFileResLog.setBackupEndTime(new Date());
|
||||
StringBuffer info = new StringBuffer()
|
||||
.append("\n")
|
||||
.append("#")
|
||||
.append("\n")
|
||||
.append(JSONUtil.toJsonStr(backupFileResLog, jsonConfig));
|
||||
FileUtil.appendUtf8String(info.toString(), backupPro.getLogPath());
|
||||
return ElectromagneticResultUtil.success(JSONUtil.toJsonStr(backupFileResLog, jsonConfig));
|
||||
}
|
||||
|
||||
// @RequestMapping("/remove")
|
||||
// public ElectromagneticResult<?> remove(@RequestParam("id") String id) {
|
||||
// try {
|
||||
// fileService.remove(id);
|
||||
// } catch (Exception e) {
|
||||
// log.error("删除文件失败, id-->{},原因-->{}", id, e.getMessage(), e);
|
||||
// ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||
// }
|
||||
// return ElectromagneticResultUtil.success(true);
|
||||
// }
|
||||
|
||||
@RequestMapping("/download")
|
||||
public ResponseEntity<InputStreamResource> download(@RequestParam("id") String id) throws Exception {
|
||||
return fileService.download(id);
|
||||
}
|
||||
|
||||
@RequestMapping("/backupSql")
|
||||
public ElectromagneticResult<?> backupSql(@RequestParam("file") MultipartFile file) {
|
||||
BackupFileResLog backupFileResLog = BackupFileResLog.builder().backupStartTime(new Date()).fileName(file.getOriginalFilename()).backupSuccess(true).build();
|
||||
try {
|
||||
fileService.backupSql(file);
|
||||
} catch (Exception e) {
|
||||
String details = ExceptionUtil.stacktraceToString(e);
|
||||
backupFileResLog.setBackupSuccess(false);
|
||||
backupFileResLog.setFailInfoDetail(details);
|
||||
log.error("备份sql文件失败,原因--->{}", e.getMessage(), e);
|
||||
}
|
||||
JSONConfig jsonConfig = JSONConfig.create();
|
||||
jsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
backupFileResLog.setBackupEndTime(new Date());
|
||||
StringBuffer info = new StringBuffer()
|
||||
.append("\n")
|
||||
.append("#")
|
||||
.append("\n")
|
||||
.append(JSONUtil.toJsonStr(backupFileResLog, jsonConfig));
|
||||
FileUtil.appendUtf8String(info.toString(), backupPro.getLogPath());
|
||||
return ElectromagneticResultUtil.success(JSONUtil.toJsonStr(backupFileResLog, jsonConfig));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.electromagnetic.industry.software.backup.pojo;
|
||||
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "ele.backup")
|
||||
public class BackupPro {
|
||||
|
||||
private String saveFolder;
|
||||
|
||||
private String logPath;
|
||||
|
||||
private String winPrefix;
|
||||
|
||||
public String getSaveFolder() {
|
||||
return EleCommonUtil.isWinOs() ? winPrefix + saveFolder : saveFolder;
|
||||
}
|
||||
|
||||
public String getLogPath() {
|
||||
return EleCommonUtil.isWinOs() ? winPrefix + logPath : logPath;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.electromagnetic.industry.software.backup.service;
|
||||
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface FileService {
|
||||
|
||||
void upload(MultipartFile file) throws IOException;
|
||||
|
||||
// void remove(String id);
|
||||
|
||||
ResponseEntity<InputStreamResource> download(String id) throws Exception;
|
||||
|
||||
void backupSql(MultipartFile file) throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package com.electromagnetic.industry.software.backup.serviceimp;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ZipUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.electromagnetic.industry.software.backup.pojo.BackupPro;
|
||||
import com.electromagnetic.industry.software.backup.service.FileService;
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.FILE_SEC_PASSWD;
|
||||
|
||||
@Service
|
||||
public class FileServiceImpl implements FileService {
|
||||
|
||||
@Resource
|
||||
private BackupPro backupPro;
|
||||
|
||||
@Override
|
||||
public void upload(MultipartFile file) throws IOException {
|
||||
String name = FileUtil.mainName(file.getOriginalFilename());
|
||||
String destPath = getFileSysPathById(name);
|
||||
if (!FileUtil.exist(destPath)) {
|
||||
FileUtil.writeFromStream(file.getInputStream(), destPath);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void remove(String id) {
|
||||
// String destPath = getFileSysPathById(id);
|
||||
// FileUtil.del(destPath);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ResponseEntity<InputStreamResource> download(String id) throws Exception {
|
||||
String destPath = getFileSysPathById(id);
|
||||
FileSystemResource fileSystemResource = new FileSystemResource(destPath);
|
||||
return ResponseEntity
|
||||
.ok()
|
||||
.contentLength(fileSystemResource.contentLength())
|
||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||
.body(new InputStreamResource(fileSystemResource.getInputStream()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backupSql(MultipartFile file) throws IOException {
|
||||
String destPath = backupPro.getSaveFolder() + File.separator + "sqls" + File.separator + file.getOriginalFilename();
|
||||
if (!FileUtil.exist(destPath)) {
|
||||
FileUtil.writeFromStream(file.getInputStream(), destPath);
|
||||
}
|
||||
int index = destPath.lastIndexOf(".");
|
||||
String zipPath = destPath.substring(0, index) + ".zip";
|
||||
ZipUtil.zip(destPath, zipPath);
|
||||
EleCommonUtil.encryptFile(zipPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
||||
FileUtil.del(destPath);
|
||||
}
|
||||
|
||||
private String getFileSysPathById(String fileName) {
|
||||
String saveFolder = backupPro.getSaveFolder();
|
||||
return saveFolder + File.separator + "prj_files" + File.separator + fileName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
ele:
|
||||
backup:
|
||||
saveFolder: "/szsd/data/backup/"
|
||||
logPath: "/szsd/data/backup.log"
|
||||
winPrefix: "D:/tmp"
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 500MB
|
||||
max-request-size: 500MB
|
||||
|
||||
server:
|
||||
port: 12491
|
||||
|
|
@ -6,56 +6,77 @@
|
|||
<parent>
|
||||
<groupId>com.electromagnetic.data</groupId>
|
||||
<artifactId>electromagnetic-data-new</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>electrmangnetic</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.4.1.Final</mapstruct.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.22</version>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-model-ollama</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-vector-store-mariadb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-pdf-document-reader</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>co.elastic.clients</groupId>
|
||||
<artifactId>elasticsearch-java</artifactId>
|
||||
<version>8.13.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.31</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.7.0</version>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.electromagnetic.data</groupId>
|
||||
<artifactId>electromagnetic-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -69,15 +90,13 @@
|
|||
</exclusions>
|
||||
<version>5.1.2</version>
|
||||
</dependency>
|
||||
<!--引入druid数据源-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.1.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
|
|
@ -102,7 +121,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.12</version>
|
||||
<version>3.4.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<configuration>
|
||||
|
|
@ -117,5 +136,4 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
package com.electromagnetic.industry.software.manage;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@MapperScan("com.electromagnetic.industry.software.manage.mapper")
|
||||
public class Application {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.electromagnetic.industry.software.manage.ai;
|
||||
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.QueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.serviceimpl.ChatService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChatTaskThread1 implements Callable<Flux<String>> {
|
||||
|
||||
private ChatService chatService;
|
||||
private QueryDTO queryDTO;
|
||||
|
||||
@Override
|
||||
public Flux<String> call() throws Exception {
|
||||
return chatService.chatStreamStr(queryDTO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.electromagnetic.industry.software.manage.ai;
|
||||
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.QueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.serviceimpl.ChatService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.ai.chat.model.ChatResponse;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChatTaskThread2 implements Callable<Flux<ChatResponse>> {
|
||||
|
||||
private ChatService chatService;
|
||||
private QueryDTO queryDTO;
|
||||
|
||||
@Override
|
||||
public Flux<ChatResponse> call() throws Exception {
|
||||
return chatService.chatStreamResponse(queryDTO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.electromagnetic.industry.software.manage.ai;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public final class ThreadUtil {
|
||||
|
||||
private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(1,
|
||||
1,
|
||||
3,
|
||||
TimeUnit.SECONDS,
|
||||
new LinkedBlockingDeque<>(100),
|
||||
Executors.defaultThreadFactory(),
|
||||
new ThreadPoolExecutor.DiscardOldestPolicy());
|
||||
|
||||
public static ExecutorService getThreadPool() {
|
||||
return THREAD_POOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.electromagnetic.industry.software.manage.aop;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class AopUtil {
|
||||
|
||||
public static String getReqArgs(Object[] args, String[] argNames) {
|
||||
String paramInfo = "";
|
||||
if (args != null && args.length > 0) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
try {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String name = argNames[i];
|
||||
Object value = args[i];
|
||||
if (value instanceof ServletRequest) {
|
||||
log.info("参数中有request");
|
||||
map.put(name, "request");
|
||||
} else if (value instanceof ServletResponse) {
|
||||
log.info("参数中有response");
|
||||
map.put(name, "response");
|
||||
} else if (value instanceof MultipartFile file) {
|
||||
Map<String, Object> pars = new HashMap<>();
|
||||
pars.put("fileName", file.getOriginalFilename());
|
||||
pars.put("fileSize", file.getSize());
|
||||
map.put("file", pars);
|
||||
} else {
|
||||
map.put(name, value);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("切面异常--->{}", e.getMessage(), e);
|
||||
} finally {
|
||||
paramInfo = JSONUtil.toJsonStr(map);
|
||||
}
|
||||
}
|
||||
return paramInfo;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
package com.electromagnetic.industry.software.manage.aop;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.RequiredPermission;
|
||||
import com.electromagnetic.industry.software.common.cons.ElectromagneticConstants;
|
||||
import com.electromagnetic.industry.software.common.enums.FilePermission;
|
||||
import com.electromagnetic.industry.software.common.exception.PermissionDeniedException;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.config.ElePropertyConfig;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
|
|
@ -25,11 +25,15 @@ public class FilePermissionCheckAspect {
|
|||
PermissionService permissionService;
|
||||
@Resource
|
||||
EdFileInfoService edFileInfoService;
|
||||
@Resource
|
||||
private ElePropertyConfig elePropertyConfig;
|
||||
|
||||
@Around("@annotation(requiredPermission)")
|
||||
public Object requirePermission(ProceedingJoinPoint joinPoint, RequiredPermission requiredPermission) throws Throwable{
|
||||
public Object requirePermission(ProceedingJoinPoint joinPoint, RequiredPermission requiredPermission) throws Throwable {
|
||||
Object[] args = joinPoint.getArgs();
|
||||
|
||||
String[] argNames = ((MethodSignature) joinPoint.getSignature()).getParameterNames();
|
||||
String paramInfo = AopUtil.getReqArgs(args, argNames);
|
||||
UserThreadLocal.setReqArgs(paramInfo);
|
||||
if (args.length == 0) {
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
|
|
@ -37,10 +41,9 @@ public class FilePermissionCheckAspect {
|
|||
FilePermission filePermission = requiredPermission.value();
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
String id = extractId(args[0]); // 提取ID逻辑封装成方法,减少冗余代码
|
||||
|
||||
// 特殊处理 FileInfoQueryDTO
|
||||
if (args[0] instanceof FileInfoQueryDTO) {
|
||||
if (id.length() > ElectromagneticConstants.PRJ_ID_LENGTH) {
|
||||
if (id.length() > elePropertyConfig.getPrjFolderMaxLength()) {
|
||||
return joinPoint.proceed();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
package com.electromagnetic.industry.software.manage.aop;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.electromagnetic.industry.software.common.pojo.UserLoginInfo;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.connector.ResponseFacade;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StopWatch;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
|
|
@ -29,41 +30,25 @@ public class ServiceAspect {
|
|||
String methodInfo = jp.getTarget().getClass().getSimpleName() + "."
|
||||
+ jp.getSignature().getName();
|
||||
Object[] args = jp.getArgs();
|
||||
String paramInfo = "";
|
||||
if (args != null && args.length > 0) {
|
||||
if (args[0] != null && args[0].getClass() != ResponseFacade.class) {
|
||||
try {
|
||||
List<Object> list = new ArrayList<>();
|
||||
for (Object obj : jp.getArgs()) {
|
||||
|
||||
if (obj instanceof ServletResponse) {
|
||||
log.info("参数中有response");
|
||||
} else if (obj instanceof ServletRequest) {
|
||||
log.info("参数中有request");
|
||||
} else if (obj instanceof MultipartFile) {
|
||||
//文件不输出
|
||||
MultipartFile obj1 = (MultipartFile) obj;
|
||||
log.info("参数中文件;文件名:{},文件大小:{}", obj1.getName(), obj1.getSize());
|
||||
break;
|
||||
} else {
|
||||
list.add(obj);
|
||||
}
|
||||
}
|
||||
paramInfo = JSONUtil.toJsonStr(list);
|
||||
} catch (Exception e) {
|
||||
log.warn("切面异常--->{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
String[] argNames = ((MethodSignature) jp.getSignature()).getParameterNames();
|
||||
String paramInfo = AopUtil.getReqArgs(args, argNames);
|
||||
log.info("请求接口开始:{},参数:{}", methodInfo, paramInfo);
|
||||
long startTime = System.currentTimeMillis();
|
||||
StopWatch stopwatch = new StopWatch();
|
||||
stopwatch.start("接口:" + methodInfo);
|
||||
Object rvt = jp.proceed();
|
||||
if (rvt instanceof ResponseEntity) {
|
||||
return rvt;
|
||||
if (Objects.isNull(UserThreadLocal.getUser())) {
|
||||
UserLoginInfo userLoginInfo = new UserLoginInfo();
|
||||
UserThreadLocal.set(userLoginInfo);
|
||||
}
|
||||
UserThreadLocal.setReqArgs(paramInfo);
|
||||
Object rvt = jp.proceed();
|
||||
String returnInfo = "";
|
||||
if (rvt instanceof ResponseEntity || rvt instanceof Flux) {
|
||||
UserThreadLocal.setRes(ElectromagneticResultUtil.success(""));
|
||||
} else {
|
||||
UserThreadLocal.setRes((ElectromagneticResult) rvt);
|
||||
returnInfo = JSONUtil.toJsonStr(rvt);
|
||||
}
|
||||
String returnInfo = JSONUtil.toJsonStr(rvt);
|
||||
log.info("请求接口结束:{},返回参数:{},接口耗时:{}", methodInfo, returnInfo, (System.currentTimeMillis() - startTime) + "毫秒");
|
||||
stopwatch.stop();
|
||||
log.debug(stopwatch.prettyPrint());
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.common;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.exception.PermissionDeniedException;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
|
|
@ -11,8 +13,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
|
|||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import java.nio.file.AccessDeniedException;
|
||||
|
||||
@Slf4j
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
|
@ -22,6 +22,8 @@ public class GlobalExceptionHandler {
|
|||
@ResponseBody
|
||||
public ElectromagneticResult<?> runTimeError(Throwable e) {
|
||||
log.error(e.getMessage(), e);
|
||||
UserThreadLocal.setExceptionDetail(ExceptionUtil.stacktraceToOneLineString(e));
|
||||
UserThreadLocal.setRes(new ElectromagneticResult<>(false, "-1", e.getMessage(), ""));
|
||||
return ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +32,8 @@ public class GlobalExceptionHandler {
|
|||
@ResponseBody
|
||||
public ElectromagneticResult<?> bizError(BizException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
UserThreadLocal.setExceptionDetail(ExceptionUtil.stacktraceToOneLineString(e));
|
||||
UserThreadLocal.setRes(new ElectromagneticResult<>(false, "-1", e.getMessage(), ""));
|
||||
return ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||
}
|
||||
|
||||
|
|
@ -38,6 +42,18 @@ public class GlobalExceptionHandler {
|
|||
@ResponseBody
|
||||
public ElectromagneticResult<?> accessDeniedError(PermissionDeniedException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
UserThreadLocal.setExceptionDetail(ExceptionUtil.stacktraceToOneLineString(e));
|
||||
UserThreadLocal.setRes(new ElectromagneticResult<>(false, HttpStatus.UNAUTHORIZED.value() + "", e.getMessage(), ""));
|
||||
return ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(Throwable.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ResponseBody
|
||||
public ElectromagneticResult<?> unknown(Throwable e) {
|
||||
log.error(e.getMessage(), e);
|
||||
UserThreadLocal.setExceptionDetail(ExceptionUtil.stacktraceToOneLineString(e));
|
||||
UserThreadLocal.setRes(new ElectromagneticResult<>(false, "-1", e.getMessage(), ""));
|
||||
return ElectromagneticResultUtil.fail("-1", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
|
||||
import org.springframework.ai.chat.memory.InMemoryChatMemory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AiAdvisor {
|
||||
|
||||
@Bean
|
||||
public MessageChatMemoryAdvisor messageChatMemoryAdvisor() {
|
||||
return new MessageChatMemoryAdvisor(new InMemoryChatMemory());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
public class DruidDataSourceConfig {
|
||||
|
||||
/**
|
||||
* 添加 DruidDataSource 组件到容器中,并绑定属性
|
||||
*/
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "spring.datasource")
|
||||
@ConditionalOnProperty(name = "spring.datasource.type", havingValue = "com.alibaba.druid.pool.DruidDataSource")
|
||||
public DataSource druid() {
|
||||
return new DruidDataSource();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,44 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||
import com.electromagnetic.industry.software.common.pojo.UserLoginInfo;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
public class EdMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
if (metaObject.hasSetter("gmtCreate")) {
|
||||
this.strictInsertFill(metaObject, "gmtCreate", Date.class, new Date());
|
||||
if (metaObject.hasGetter("createdTime")) {
|
||||
this.setFieldValByName("createdTime", new Date(), metaObject);
|
||||
}
|
||||
if (metaObject.hasGetter("createdAt")) {
|
||||
this.strictInsertFill(metaObject, "createdAt", Date.class, new Date());
|
||||
if (metaObject.hasGetter("createdBy")) {
|
||||
this.setFieldValByName("createdBy", Optional.ofNullable(UserThreadLocal.getUser()).map(UserLoginInfo::getUserId).orElse(""), metaObject);
|
||||
}
|
||||
if (metaObject.hasSetter("gmtModified")) {
|
||||
this.strictUpdateFill(metaObject, "gmtModified", Date.class, new Date());
|
||||
if (metaObject.hasGetter("updatedTime")) {
|
||||
this.setFieldValByName("updatedTime", new Date(), metaObject);
|
||||
}
|
||||
if (metaObject.hasGetter("updatedAt")) {
|
||||
this.strictUpdateFill(metaObject, "updatedAt", Date.class, new Date());
|
||||
if (metaObject.hasGetter("updatedBy")) {
|
||||
this.setFieldValByName("updatedBy", Optional.ofNullable(UserThreadLocal.getUser()).map(UserLoginInfo::getUserId).orElse(""), metaObject);
|
||||
}
|
||||
if (metaObject.hasGetter("effectFlag")) {
|
||||
this.setFieldValByName("effectFlag", EffectFlagEnum.EFFECT.code, metaObject);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
if (metaObject.hasSetter("gmtModified")) {
|
||||
this.strictUpdateFill(metaObject, "gmtModified", Date.class, new Date());
|
||||
if (metaObject.hasGetter("updatedTime")) {
|
||||
this.setFieldValByName("updatedTime", new Date(), metaObject);
|
||||
}
|
||||
if (metaObject.hasGetter("updatedAt")) {
|
||||
this.strictUpdateFill(metaObject, "updatedAt", Date.class, new Date());
|
||||
if (metaObject.hasGetter("updatedBy")) {
|
||||
this.setFieldValByName("updatedBy", Optional.ofNullable(UserThreadLocal.getUser()).map(UserLoginInfo::getUserId).orElse(""), metaObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,173 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class ElePropertyConfig {
|
||||
|
||||
@Value("${data.ele.tmp.path}")
|
||||
private String eleTmpPath;
|
||||
|
||||
@Value("${data.sys.prj.path}")
|
||||
private String sysPrjPath;
|
||||
|
||||
@Value("${data.sys.upload.path}")
|
||||
private String sysUploadPath;
|
||||
|
||||
@Value("${data.sys.download.path}")
|
||||
private String sysDownloadPath;
|
||||
|
||||
@Value("${data.user.prj.path}")
|
||||
private String userPrjPath;
|
||||
|
||||
@Value("${data.user.upload.path}")
|
||||
private String userUploadPath;
|
||||
|
||||
@Value("${data.user.download.path}")
|
||||
private String userDownloadPath;
|
||||
|
||||
@Value("${data.repo.prj.path}")
|
||||
private String repoPrjPath;
|
||||
|
||||
@Value("${data.repo.upload.path}")
|
||||
private String repoUploadPath;
|
||||
|
||||
@Value("${data.repo.download.path}")
|
||||
private String repoDownloadPath;
|
||||
|
||||
@Getter
|
||||
@Value("${backup.mysql.script.path}")
|
||||
private String backupMysqlScriptPath;
|
||||
|
||||
@Getter
|
||||
@Value("${tmp.file.store.hour}")
|
||||
private int tmpFileStoreHour;
|
||||
|
||||
@Getter
|
||||
@Value("${backup.remote.host}")
|
||||
private String remoteHost = "";
|
||||
|
||||
@Getter
|
||||
@Value("${backup.remote.port}")
|
||||
private int remotePort;
|
||||
|
||||
@Value("${winPrefix}")
|
||||
private String winPrefix = "";
|
||||
|
||||
@Getter
|
||||
@Value("${backup.mysql.path}")
|
||||
private String sqlDirs;
|
||||
|
||||
@Getter
|
||||
@Value("${ai.store.max.docs:200}")
|
||||
private Integer aiMaxDocs;
|
||||
|
||||
@Getter
|
||||
@Value("${prj.folder.max.length}")
|
||||
private Integer prjFolderMaxLength;
|
||||
|
||||
@Value("${prjRootPath}")
|
||||
private String prjRootPath;
|
||||
|
||||
@Value("${allow.upload.file.types}")
|
||||
private String allowUploadFileTypes;
|
||||
|
||||
public List<String> getAiAllowUploadFileTypes() {
|
||||
return List.of(allowUploadFileTypes.replace(" ", "").split(","));
|
||||
}
|
||||
|
||||
public String getEleTmpPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + eleTmpPath;
|
||||
}
|
||||
return prjRootPath + eleTmpPath;
|
||||
}
|
||||
|
||||
public String getSysPrjPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + sysPrjPath;
|
||||
}
|
||||
return prjRootPath + sysPrjPath;
|
||||
}
|
||||
|
||||
public String getSysUploadPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + sysUploadPath;
|
||||
}
|
||||
return prjRootPath + sysUploadPath;
|
||||
}
|
||||
|
||||
public String getSysDownloadPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + sysDownloadPath;
|
||||
}
|
||||
return prjRootPath + sysDownloadPath;
|
||||
}
|
||||
|
||||
public String getUserPrjPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + userPrjPath;
|
||||
}
|
||||
return prjRootPath + userPrjPath;
|
||||
}
|
||||
|
||||
public String getUserUploadPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + userUploadPath;
|
||||
}
|
||||
return prjRootPath + userUploadPath;
|
||||
}
|
||||
|
||||
public String getUserDownloadPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + userDownloadPath;
|
||||
}
|
||||
return prjRootPath + userDownloadPath;
|
||||
}
|
||||
|
||||
public String getRepoPrjPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + repoPrjPath;
|
||||
}
|
||||
return prjRootPath + repoPrjPath;
|
||||
}
|
||||
|
||||
public String getRepoUploadPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + repoUploadPath;
|
||||
}
|
||||
return prjRootPath + repoUploadPath;
|
||||
}
|
||||
|
||||
public String getRepoDownloadPath() {
|
||||
if (EleCommonUtil.isWinOs()) {
|
||||
return winPrefix + prjRootPath + repoDownloadPath;
|
||||
}
|
||||
return prjRootPath + repoDownloadPath;
|
||||
}
|
||||
|
||||
public String getUploadDataDir(int dataOwnCode) {
|
||||
if (DataOwnEnum.isSysCode(dataOwnCode)) {
|
||||
return getSysUploadPath();
|
||||
} else if (DataOwnEnum.isUserCode(dataOwnCode)) {
|
||||
return getUserUploadPath();
|
||||
}
|
||||
return getRepoUploadPath();
|
||||
}
|
||||
|
||||
public String getDownloadDataDir(int dataOwnCode) {
|
||||
if (DataOwnEnum.isSysCode(dataOwnCode)) {
|
||||
return getSysDownloadPath();
|
||||
} else if (DataOwnEnum.isUserCode(dataOwnCode)) {
|
||||
return getUserDownloadPath();
|
||||
}
|
||||
return getRepoDownloadPath();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,23 +1,36 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.SystemClock;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.cons.UserConstants;
|
||||
import com.electromagnetic.industry.software.common.enums.AdminTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.pojo.AccessSuccessInfo;
|
||||
import com.electromagnetic.industry.software.common.pojo.UserLoginInfo;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import com.electromagnetic.industry.software.common.util.TokenUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.mapper.TokenMapper;
|
||||
import com.electromagnetic.industry.software.manage.mapper.UserAccessLogMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.Token;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.UserAccessLog;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
|
|
@ -26,8 +39,44 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
@Resource
|
||||
private TokenMapper tokenMapper;
|
||||
|
||||
@Resource
|
||||
private UserAccessLogMapper userAccessLogMapper;
|
||||
|
||||
@Resource
|
||||
private ElePropertyConfig elePropertyConfig;
|
||||
|
||||
private static String getRealIp(HttpServletRequest request) {
|
||||
String ipAddress = request.getHeader("X-Forwarded-For");
|
||||
if (StrUtil.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) {
|
||||
// 回退到X-Real-IP或直接RemoteAddr
|
||||
ipAddress = request.getHeader("X-Real-IP");
|
||||
}
|
||||
if (StrUtil.isEmpty(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) {
|
||||
ipAddress = request.getRemoteAddr();
|
||||
}
|
||||
// 处理多级代理的情况(取第一个IP)
|
||||
if (ipAddress.contains(",")) {
|
||||
ipAddress = ipAddress.split(",")[0].trim();
|
||||
}
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
private static String parseIpFromUrl(String url) {
|
||||
|
||||
int start = url.indexOf("//");
|
||||
url = url.substring(start + 2);
|
||||
int end = url.indexOf("/");
|
||||
String tmp = url.substring(0, end);
|
||||
if (!tmp.contains(":")) {
|
||||
return tmp;
|
||||
}
|
||||
int index = tmp.indexOf(":");
|
||||
return tmp.substring(0, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
request.getSession().setAttribute("accessStartTime", System.currentTimeMillis());
|
||||
// 首先校验token
|
||||
boolean isTokenValid = checkToken(request, response);
|
||||
if (!isTokenValid) {
|
||||
|
|
@ -37,8 +86,8 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
}
|
||||
|
||||
private boolean checkSysAdminOperation(HttpServletRequest request, HttpServletResponse response) {
|
||||
String requestURI = request.getRequestURI();
|
||||
if (requestURI.startsWith("/data/ed/prj") && !UserThreadLocal.getAdminType().equals(AdminTypeEnum.SYSTEM.getValue())) {
|
||||
String uri = request.getRequestURI();
|
||||
if (uri.startsWith("/data/ed/prj") && !UserThreadLocal.getAdminType().equals(AdminTypeEnum.SYSTEM.getValue())) {
|
||||
log.warn("{}没有层级操作权限,当前用户类型是{}", UserThreadLocal.getUsername(), UserThreadLocal.getAdminType());
|
||||
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
|
||||
return false;
|
||||
|
|
@ -48,6 +97,7 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
|
||||
private boolean checkToken(HttpServletRequest request, HttpServletResponse response) {
|
||||
String token = request.getHeader("Authorization");
|
||||
String uri = request.getRequestURI();
|
||||
if (token == null) {
|
||||
log.error("Authorization header is null");
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
|
|
@ -57,13 +107,13 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
}
|
||||
boolean result = isTokenValid(token);
|
||||
if (!result) {
|
||||
log.error("Invalid token");
|
||||
log.error("Invalid token, uri is --->{}", uri);
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
return false;
|
||||
} else {
|
||||
Claims claims = TokenUtil.getLoginInfo(token);
|
||||
if (claims == null) {
|
||||
log.error("User info is missing");
|
||||
log.error("User info is missing, uri is --->{}", uri);
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -72,20 +122,94 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
userLoginInfo.setUsername(claims.get(UserConstants.LOGIN_USER_NAME, String.class));
|
||||
userLoginInfo.setWorkNumber(claims.get(UserConstants.LOGIN_WORK_NUMBER, String.class));
|
||||
userLoginInfo.setAdminType(claims.get(UserConstants.LOGIN_ADMIN_TYPE, String.class));
|
||||
userLoginInfo.setPrjTmpDir(elePropertyConfig.getEleTmpPath());
|
||||
UserThreadLocal.set(userLoginInfo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
UserThreadLocal.remove();
|
||||
|
||||
try {
|
||||
long accessStartTime = (long) request.getSession().getAttribute("accessStartTime");
|
||||
long accessEndTime = System.currentTimeMillis();
|
||||
UserOperation userOperation = ((HandlerMethod) handler).getMethod().getAnnotation(UserOperation.class);
|
||||
|
||||
if (ObjectUtil.isEmpty(userOperation)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String reqArgs = UserThreadLocal.getReqArgs();
|
||||
|
||||
UserLoginInfo user = Optional.of(UserThreadLocal.getUser()).orElse(new UserLoginInfo());
|
||||
List<AccessSuccessInfo> successInfoList = user.getSuccessInfoList();
|
||||
|
||||
if (CollUtil.isEmpty(successInfoList)) {
|
||||
ElectromagneticResult res = user.getResult();
|
||||
UserAccessLog userAccessLog = new UserAccessLog()
|
||||
.setId(IdWorker.getSnowFlakeIdString())
|
||||
.setUserId(user.getUserId())
|
||||
.setAccessStartTime(DateUtil.date(accessStartTime))
|
||||
.setAccessEndTime(DateUtil.date(accessEndTime))
|
||||
.setAccessDuration(accessEndTime - accessStartTime)
|
||||
.setAction(userOperation.value())
|
||||
.setRequestUrl(request.getRequestURL().toString())
|
||||
.setRequestIp(parseIpFromUrl(request.getRequestURL().toString()))
|
||||
.setReqArgs(reqArgs)
|
||||
.setRemoteAddr(getRealIp(request))
|
||||
.setAccessSuccess(true)
|
||||
.setOperationModule(userOperation.modelName().key)
|
||||
.setOperationMsg(res.getErrorMessage())
|
||||
.setDataId("")
|
||||
.setParentId("");
|
||||
|
||||
userAccessLog.setResponse(JSONUtil.toJsonStr(res));
|
||||
if (!res.getSuccess()) {
|
||||
userAccessLog.setAccessSuccess(false);
|
||||
userAccessLog.setOperationMsg(res.getErrorMessage());
|
||||
userAccessLog.setExceptionDetail(UserThreadLocal.getUser().getExceptionDetail());
|
||||
}
|
||||
userAccessLogMapper.insert(userAccessLog);
|
||||
} else {
|
||||
for (AccessSuccessInfo accessSuccessInfo : successInfoList) {
|
||||
UserAccessLog userAccessLog = new UserAccessLog()
|
||||
.setId(IdWorker.getSnowFlakeIdString())
|
||||
.setUserId(user.getUserId())
|
||||
.setAccessStartTime(DateUtil.date(accessStartTime))
|
||||
.setAccessEndTime(DateUtil.date(accessEndTime))
|
||||
.setAccessDuration(accessEndTime - accessStartTime)
|
||||
.setAction(userOperation.value())
|
||||
.setRequestUrl(request.getRequestURL().toString())
|
||||
.setRequestIp(parseIpFromUrl(request.getRequestURL().toString()))
|
||||
.setReqArgs(reqArgs)
|
||||
.setRemoteAddr(getRealIp(request))
|
||||
.setAccessSuccess(true)
|
||||
.setOperationModule(userOperation.modelName().key)
|
||||
.setOperationMsg(accessSuccessInfo.getSuccessMsg())
|
||||
.setDataId(accessSuccessInfo.getDataId())
|
||||
.setParentId(accessSuccessInfo.getParentId());
|
||||
|
||||
ElectromagneticResult<?> result = user.getResult();
|
||||
if (result != null) {
|
||||
userAccessLog.setResponse(JSONUtil.toJsonStr(result));
|
||||
if (!result.getSuccess()) {
|
||||
userAccessLog.setAccessSuccess(false);
|
||||
userAccessLog.setOperationMsg(result.getErrorMessage());
|
||||
userAccessLog.setExceptionDetail(UserThreadLocal.getUser().getExceptionDetail());
|
||||
}
|
||||
} else { // 返回为ResponseEntity,且状态为失败。
|
||||
userAccessLog.setAccessSuccess(false);
|
||||
}
|
||||
userAccessLogMapper.insert(userAccessLog);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("请求后置异常,原因 {}", e.getMessage(), e);
|
||||
} finally {
|
||||
UserThreadLocal.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean isTokenValid(String tokenStr) {
|
||||
|
|
@ -93,4 +217,5 @@ public class LoginInterceptor implements HandlerInterceptor {
|
|||
Date now = new Date(SystemClock.now());
|
||||
return token != null && now.before(token.getExpireAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.config;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @version $Id: d.java, v 0.1 2021-01-05 19:33 Exp $$
|
||||
|
|
@ -27,12 +26,17 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||
|
||||
registry.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
|
||||
registry.addResourceHandler("index.html")
|
||||
.addResourceLocations("classpath:/static/");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(loginInterceptor)
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/index")
|
||||
.excludePathPatterns("/static/**", "/css/**", "/js/**", "/images/**", "/fonts/**", "/assets/**")
|
||||
.excludePathPatterns("/data/ed/user/login");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.AdminTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.AccessLogQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.UserAccessLogService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/log/")
|
||||
public class AccessLogController {
|
||||
|
||||
@Resource
|
||||
private UserAccessLogService userAccessLogService;
|
||||
|
||||
@UserOperation(value = "查看操作记录", modelName = UserOperationModuleEnum.LOG)
|
||||
@RequestMapping("file")
|
||||
public ElectromagneticResult<?> file(@RequestBody AccessLogQueryDTO accessLogQueryDTO) {
|
||||
return userAccessLogService.info(accessLogQueryDTO, false);
|
||||
}
|
||||
|
||||
|
||||
@UserOperation(value = "查看审计", modelName = UserOperationModuleEnum.LOG)
|
||||
@RequestMapping("audit")
|
||||
public ElectromagneticResult<?> audit(@RequestBody AccessLogQueryDTO accessLogQueryDTO) {
|
||||
Assert.isTrue(UserThreadLocal.getAdminType().equals(AdminTypeEnum.AUDIT.getValue()), "当前用户没有查看审计的权限");
|
||||
return userAccessLogService.info(accessLogQueryDTO, true);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询所有操作对象", modelName = UserOperationModuleEnum.LOG)
|
||||
@RequestMapping("operation/module")
|
||||
public ElectromagneticResult<?> operationModule() {
|
||||
return userAccessLogService.operationModule();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.ai.ChatTaskThread1;
|
||||
import com.electromagnetic.industry.software.manage.ai.ChatTaskThread2;
|
||||
import com.electromagnetic.industry.software.manage.ai.ThreadUtil;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.QueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.serviceimpl.ChatService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.ai.chat.model.ChatResponse;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/ai")
|
||||
public class AiController {
|
||||
|
||||
@Resource
|
||||
private ChatService chatService;
|
||||
|
||||
@RequestMapping("/upload")
|
||||
public ElectromagneticResult<?> upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
return chatService.addFromUpload(file);
|
||||
}
|
||||
|
||||
// @PostMapping("/chat")
|
||||
// public ElectromagneticResult<String> chat(@RequestBody QueryDTO queryDTO) throws Exception {
|
||||
// log.info("question is --->" + queryDTO.getMsg());
|
||||
// ChatTaskThread<String> chatTaskThread = new ChatTaskThread<>(chatService, queryDTO);
|
||||
// Future<String> future = ThreadUtil.getThreadPool().submit(chatTaskThread);
|
||||
// String res = future.get();
|
||||
// log.info("answer is --->" + res);
|
||||
// return ElectromagneticResultUtil.success(res);
|
||||
// }
|
||||
|
||||
@PostMapping(path = "/chatStreamStr", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<String> chatStreamStr(@RequestBody QueryDTO queryDTO) throws ExecutionException, InterruptedException {
|
||||
if (StrUtil.isEmpty(queryDTO.getMsg())) {
|
||||
return Flux.empty();
|
||||
}
|
||||
queryDTO.setUserId(UserThreadLocal.getUserId());
|
||||
ChatTaskThread1 chatTaskThread = new ChatTaskThread1(chatService, queryDTO);
|
||||
Future<Flux<String>> future = ThreadUtil.getThreadPool().submit(chatTaskThread);
|
||||
return future.get();
|
||||
}
|
||||
|
||||
@PostMapping(path = "/chatStreamResp", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<ChatResponse> chatStreamResp(@RequestBody QueryDTO queryDTO) throws ExecutionException, InterruptedException {
|
||||
if (StrUtil.isEmpty(queryDTO.getMsg())) {
|
||||
return Flux.empty();
|
||||
}
|
||||
queryDTO.setUserId(UserThreadLocal.getUserId());
|
||||
ChatTaskThread2 chatTaskThread2 = new ChatTaskThread2(chatService, queryDTO);
|
||||
Future<Flux<ChatResponse>> future = ThreadUtil.getThreadPool().submit(chatTaskThread2);
|
||||
return future.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.TagCreateDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdTagLibraryService;
|
||||
import com.electromagnetic.industry.software.manage.service.FileTagRelationService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/tag")
|
||||
public class EdTagLibraryController {
|
||||
|
||||
@Resource
|
||||
private EdTagLibraryService edTagLibraryService;
|
||||
|
||||
@Resource
|
||||
private FileTagRelationService fileTagRelationService;
|
||||
|
||||
// 新建标签组
|
||||
@GetMapping("/createGroup")
|
||||
@UserOperation(value = "创建了标签组", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> createTagGroup(@RequestParam String tagName) {
|
||||
String createdBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.createTagGroup(tagName, createdBy));
|
||||
}
|
||||
|
||||
// 在标签组下新建标签
|
||||
@GetMapping("/createTag")
|
||||
@UserOperation(value = "创建了标签", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> createTag(@RequestParam String parentId, @RequestParam String tagName) {
|
||||
String createdBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.createTag(parentId, tagName, createdBy));
|
||||
}
|
||||
|
||||
// 拖拽修改排序/分组
|
||||
@GetMapping("/updateOrder")
|
||||
@UserOperation(value = "修改了标签顺序", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> updateTagOrder(@RequestParam String tagId, @RequestParam String newTagId, @RequestParam String newParentId, @RequestParam Integer newOrderBy) {
|
||||
String updatedBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.updateTagOrder(tagId, newTagId, newParentId, newOrderBy, updatedBy));
|
||||
}
|
||||
|
||||
// 发布标签
|
||||
@PostMapping("/batchPublish")
|
||||
@UserOperation(value = "发布了标签组", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> publishTag(@RequestBody List<String> tagIds) {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.batchPublishTagGroups(tagIds));
|
||||
}
|
||||
|
||||
// 废除标签
|
||||
@GetMapping("/delete")
|
||||
@UserOperation(value = "废除了标签组/标签", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> deleteTag(@RequestParam String tagId) {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.deleteTagOrGroup(tagId));
|
||||
}
|
||||
|
||||
//获取标签数据
|
||||
@GetMapping("/list")
|
||||
@UserOperation(value = "查看了标签数据", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> listTags() {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.listTagsWithGroups());
|
||||
}
|
||||
|
||||
// 修改标签组/标签
|
||||
@GetMapping("/updateTag")
|
||||
@UserOperation(value = "修改了标签组/标签", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> updateTag(@RequestParam String tagId, @RequestParam String tagName) {
|
||||
String updatedBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.updateTagInfo(tagId, tagName, updatedBy));
|
||||
}
|
||||
|
||||
// 查看标签树
|
||||
@GetMapping("/tree")
|
||||
@UserOperation(value = "查看了标签树", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> listTagTree() {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.listTagTree());
|
||||
}
|
||||
|
||||
// 查看所有标签
|
||||
@GetMapping("/listAllTags")
|
||||
@UserOperation(value = "查看了所有标签", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> listAllTags() {
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.listAllTags());
|
||||
}
|
||||
|
||||
// 批量添加标签到文件
|
||||
@PostMapping("/addTagsToFile")
|
||||
@UserOperation(value = "批量添加了标签到文件", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> addTagsToFile(@RequestBody TagCreateDTO dto) {
|
||||
String createdBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(fileTagRelationService.addTagsToFile(dto.getFileId(), dto.getTagIds(), createdBy));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.manage.service.FileBackLogService;
|
||||
import jakarta.annotation.Resource;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/backup/")
|
||||
public class FileBackupLogController {
|
||||
|
||||
@Resource
|
||||
private FileBackLogService fileBackLogService;
|
||||
|
||||
@RequestMapping(value = "list")
|
||||
@UserOperation(value = "查询备份日志", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
||||
public ElectromagneticResult<?> list(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||
return fileBackLogService.query(pageNum, pageSize);
|
||||
}
|
||||
|
||||
@GetMapping(value = "restore")
|
||||
@UserOperation(value = "系统恢复", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
||||
public ElectromagneticResult<?> restore() {
|
||||
Long maxEndTime = fileBackLogService.restore();
|
||||
return ElectromagneticResultUtil.success(DateUtil.date(maxEndTime).toString());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.manage.service.FileFormatService;
|
||||
import jakarta.annotation.Resource;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/file/format")
|
||||
public class FileFormatController {
|
||||
|
||||
@Resource
|
||||
private FileFormatService fileFormatService;
|
||||
|
||||
@GetMapping("/add")
|
||||
@UserOperation(value = "新增文件格式", modelName = UserOperationModuleEnum.FILE_FORMAT)
|
||||
public ElectromagneticResult<?> addFileFormat(@RequestParam String suffixName) {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.addFileFormat(suffixName));
|
||||
}
|
||||
|
||||
@GetMapping("/delete")
|
||||
@UserOperation(value = "删除文件格式", modelName = UserOperationModuleEnum.FILE_FORMAT)
|
||||
public ElectromagneticResult<?> deleteFileFormat(@RequestParam String id) {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.deleteFileFormat(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@UserOperation(value = "查询文件格式列表", modelName = UserOperationModuleEnum.FILE_FORMAT)
|
||||
public ElectromagneticResult<?> list() {
|
||||
return ElectromagneticResultUtil.success(fileFormatService.getList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.AdminTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.RecycleFileQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.FileRecycleService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/recycle/file")
|
||||
public class FileRecycleController {
|
||||
|
||||
@Resource
|
||||
private FileRecycleService fileRecycleService;
|
||||
|
||||
@RequestMapping("list")
|
||||
@UserOperation(value = "查看回收站", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
||||
public ElectromagneticResult<?> list(@RequestBody RecycleFileQueryDTO pars) {
|
||||
return fileRecycleService.list(pars);
|
||||
}
|
||||
|
||||
@RequestMapping("remove")
|
||||
@UserOperation(value = "彻底清除文件", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
||||
public ElectromagneticResult<?> remove(@RequestParam String fileId) {
|
||||
Assert.isTrue(UserThreadLocal.getAdminType().equals(AdminTypeEnum.SYSTEM.getValue()), "当前用户没有删除文件权限");
|
||||
return fileRecycleService.remove(fileId);
|
||||
}
|
||||
|
||||
@RequestMapping("recover")
|
||||
@UserOperation(value = "文件恢复", modelName = UserOperationModuleEnum.BACKUP_FILE)
|
||||
public ElectromagneticResult<?> recover(@RequestParam String fileId) {
|
||||
Assert.isTrue(UserThreadLocal.getAdminType().equals(AdminTypeEnum.SYSTEM.getValue()), "当前用户没有文件恢复权限");
|
||||
return fileRecycleService.recover(fileId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
@GetMapping("index")
|
||||
public String index() {
|
||||
return "index";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/permission")
|
||||
public class PermissionController {
|
||||
|
|
@ -19,8 +19,8 @@ public class PermissionController {
|
|||
@Resource
|
||||
private PermissionService permissionService;
|
||||
|
||||
@ApiOperation(value = "查询当前用户在当前目录的功能权限", notes = "")
|
||||
@GetMapping(value = "/{id}")
|
||||
@UserOperation(value = "查询了在当前目录的功能权限", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
public ElectromagneticResult<?> getUserPermission(@PathVariable("id") String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(permissionService.getUserPermission(userId, id, false));
|
||||
|
|
|
|||
|
|
@ -1,135 +1,192 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.RequiredPermission;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.FilePermission;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/file")
|
||||
public class EdFileInfoController {
|
||||
@RequestMapping("/data/ed/repo/file")
|
||||
public class RepoEdFileInfoController {
|
||||
|
||||
@Resource
|
||||
private EdFileInfoService edFileInfoService;
|
||||
|
||||
@UserOperation(value = "查看工程树", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequestMapping("tree")
|
||||
public ElectromagneticResult<?> tree() {
|
||||
return edFileInfoService.tree();
|
||||
return edFileInfoService.tree(PrjQuerySource.REPO_DB.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "创建文件夹", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequestMapping("createFolder")
|
||||
public ElectromagneticResult<?> createFolder(@RequestBody CreateFolderDTO createFolderDTO) {
|
||||
return edFileInfoService.createFolder(createFolderDTO);
|
||||
return edFileInfoService.createFolder(createFolderDTO, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "作废", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.DELETE)
|
||||
@RequestMapping("delete")
|
||||
public ElectromagneticResult<?> delete(@RequestParam String id) {
|
||||
return edFileInfoService.delete(id);
|
||||
return edFileInfoService.delete(id, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping("info")
|
||||
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
||||
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO);
|
||||
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "上传文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.UPLOAD)
|
||||
@RequestMapping("upload")
|
||||
public ElectromagneticResult<?> upload(@RequestParam("parentId") String parentId,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.upload(parentId, file, strategy);
|
||||
return edFileInfoService.upload(parentId, file, strategy, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "下载文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.DOWNLOAD)
|
||||
@RequestMapping("download")
|
||||
public ResponseEntity<InputStreamResource> download(@RequestParam String id, HttpServletResponse response) {
|
||||
return edFileInfoService.download(id, response);
|
||||
return edFileInfoService.download(id, response, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.EDIT)
|
||||
@RequestMapping("updateFileInfo")
|
||||
public ElectromagneticResult<?> updateFileInfo(@RequestBody UpdateFileInfoDTO updateFileInfoDTO) {
|
||||
return edFileInfoService.updateFileInfo(updateFileInfoDTO);
|
||||
return edFileInfoService.updateFileInfo(updateFileInfoDTO, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "移动文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.MOVE)
|
||||
@RequestMapping("moveFile")
|
||||
public ElectromagneticResult<?> moveFile(@RequestParam("id") String id,
|
||||
@RequestParam("targetFolderId") String targetFolderId,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.moveFile(id, targetFolderId, strategy);
|
||||
return edFileInfoService.moveFile(id, targetFolderId, strategy, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "复制文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.MOVE)
|
||||
@RequestMapping("copyFile")
|
||||
public ElectromagneticResult<?> copyFile(@RequestParam("id") String id,
|
||||
@RequestParam("targetFolderId") String targetFolderId,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.copyFile(id, targetFolderId, strategy);
|
||||
return edFileInfoService.copyFile(id, targetFolderId, strategy, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查看文件历史版本信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping("versionView")
|
||||
public ElectromagneticResult<?> versionView(@RequestParam String fileId) {
|
||||
return edFileInfoService.versionView(fileId);
|
||||
}
|
||||
|
||||
@UserOperation(value = "回退版本", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.EDIT)
|
||||
@RequestMapping("versionBack")
|
||||
public ElectromagneticResult<?> versionBack(@RequestParam String fileId, @RequestParam int targetVersion) {
|
||||
return edFileInfoService.versionBack(fileId, targetVersion);
|
||||
}
|
||||
|
||||
@UserOperation(value = "导出数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequestMapping("batchExport")
|
||||
public ResponseEntity<InputStreamResource> batchExport(@RequestParam String fileIds, HttpServletResponse response) throws IOException {
|
||||
return edFileInfoService.batchExport(fileIds, response);
|
||||
return edFileInfoService.batchExport(fileIds, response, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequestMapping(value = "/mergeChunks", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> mergeChunks(@RequestParam String identifier,
|
||||
@RequestParam String fileName,
|
||||
@RequestParam Integer totalChunks) {
|
||||
return edFileInfoService.mergeChunks(identifier, fileName, totalChunks);
|
||||
return edFileInfoService.mergeChunks(identifier, fileName, totalChunks, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||
return edFileInfoService.batchImport(fileChunkDTO);
|
||||
return edFileInfoService.batchImport(fileChunkDTO, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库")
|
||||
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
||||
return edFileInfoService.checkChunkExist(fileChunkDTO, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequestMapping(value = "/uploadRecord", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||
return edFileInfoService.uploadRecord(pageNum, pageSize);
|
||||
return edFileInfoService.uploadRecord(pageNum, pageSize, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询文件详细信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping(value = "/fileDetail", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> detail(@RequestParam String id) {
|
||||
return edFileInfoService.detail(id);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询子文件集", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping(value = "/queryChildFolder", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> queryChildFolder(@RequestParam String parentId) {
|
||||
return edFileInfoService.queryChildFolder(parentId);
|
||||
return edFileInfoService.queryChildFolder(parentId, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "预览文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.PREVIEW)
|
||||
@RequestMapping(value = "preview", method = RequestMethod.GET)
|
||||
public ResponseEntity<InputStreamResource> preview(@RequestParam String id, HttpServletResponse response) {
|
||||
return edFileInfoService.preview(id, response, DataOwnEnum.REPO_FILE.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加进收藏夹
|
||||
*
|
||||
* @param id 文件id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/collection")
|
||||
@UserOperation(value = "收藏了文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> addFavorite(@RequestParam String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.addFavorite(userId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从收藏夹移除
|
||||
*
|
||||
* @param id 文件id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/removeCollection")
|
||||
@UserOperation(value = "从收藏夹移除文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
public ElectromagneticResult<?> removeFavorite(@RequestParam String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.removeFavorite(userId, id));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CheckNameUniqueRequest;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateRelationDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileRelationService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/repo/relation")
|
||||
public class RepoEdFileRelationController {
|
||||
|
||||
@Resource
|
||||
EdFileRelationService edFileRelationService;
|
||||
|
||||
@Resource
|
||||
EdFileInfoService edFileInfoService;
|
||||
|
||||
/**
|
||||
* 创建文件关系
|
||||
*
|
||||
* @param relation
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@UserOperation(value = "创建文件关系", modelName = UserOperationModuleEnum.FILE_RELATION)
|
||||
public ElectromagneticResult<?> createRelation(@RequestBody EdFileRelation relation) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.createRelation(relation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件关系
|
||||
*
|
||||
* @param updateRelation
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@UserOperation(value = "更新文件关系", modelName = UserOperationModuleEnum.FILE_RELATION)
|
||||
public ElectromagneticResult<?> updateRelation(@RequestBody UpdateRelationDTO updateRelation) {
|
||||
LambdaUpdateWrapper<EdFileRelation> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(EdFileRelation::getId, updateRelation.getRelationId()).set(EdFileRelation::getRelationship, updateRelation.getRelationship());
|
||||
boolean isUpdated = edFileRelationService.update(wrapper);
|
||||
if (isUpdated) {
|
||||
UserThreadLocal.setSuccessInfo("", updateRelation.getRelationId(), "更新了文件关系");
|
||||
}
|
||||
return ElectromagneticResultUtil.success(isUpdated);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消文件关系
|
||||
*
|
||||
* @param relationId 关系主键id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/cancel/{relationId}", method = RequestMethod.GET)
|
||||
@UserOperation(value = "取消文件关系", modelName = UserOperationModuleEnum.FILE_RELATION)
|
||||
public ElectromagneticResult<?> cancelRelation(@PathVariable("relationId") String relationId) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.cancelRelation(relationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示文件关系
|
||||
*/
|
||||
@RequestMapping(value = "listRelations/{id}", method = RequestMethod.GET)
|
||||
@UserOperation(value = "查看文件关系", modelName = UserOperationModuleEnum.FILE_RELATION)
|
||||
public ElectromagneticResult<?> listRelations(@PathVariable("id") String id) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.listRelations(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验文件名是否唯一
|
||||
*/
|
||||
@RequestMapping(value = "/checkFileNameExist", method = RequestMethod.POST)
|
||||
@UserOperation(value = "校验文件名唯一性", modelName = UserOperationModuleEnum.FILE_RELATION)
|
||||
public ElectromagneticResult<?> checkFileNameExist(@RequestBody CheckNameUniqueRequest checkNameUniqueRequest) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.checkNameExist(checkNameUniqueRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地上传并建立关系
|
||||
*/
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
@UserOperation(value = "上传了文件并创建文件关系", modelName = UserOperationModuleEnum.FILE_RELATION)
|
||||
public ElectromagneticResult<?> uploadRelation(@RequestParam("parentId") String parentId,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("description") String description,
|
||||
@RequestParam("id") String id) {
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.uploadFileAndRelation(parentId, id, file, description, DataOwnEnum.REPO_FILE.code));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.QueryPublishStatus;
|
||||
import com.electromagnetic.industry.software.manage.service.EdPrjService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/repo/prj")
|
||||
public class RepoPrjController {
|
||||
|
||||
@Resource
|
||||
private EdPrjService edPrjService;
|
||||
|
||||
@UserOperation(value = "创建层级", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("create")
|
||||
public ElectromagneticResult<?> create(@RequestParam String prjName) {
|
||||
return edPrjService.createNewPrj(prjName, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "删除层级", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("delete")
|
||||
public ElectromagneticResult<?> delete(@RequestParam String prjId) {
|
||||
return edPrjService.delete(prjId, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "修改层级名", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("modify")
|
||||
public ElectromagneticResult<?> modifyPrjName(@RequestParam String newPrjName, @RequestParam String prjId) {
|
||||
return edPrjService.modifyPrjName(prjId, newPrjName, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询所有层级", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("queryAll")
|
||||
public ElectromagneticResult<?> queryAll() {
|
||||
return edPrjService.queryAllPrjInfo(PrjQuerySource.REPO_PRJ.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "添加子集", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("addFolder")
|
||||
public ElectromagneticResult<?> addFolder(@RequestParam String folderName, @RequestParam String parentId) {
|
||||
return edPrjService.addFolder(parentId, folderName, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "修改子集名称", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("modifyFolder")
|
||||
public ElectromagneticResult<?> modifyFolder(@RequestParam String newFolderName, @RequestParam String id) {
|
||||
return edPrjService.modifyFolder(id, newFolderName, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "废除子集", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("deleteFolder")
|
||||
public ElectromagneticResult<?> deleteFolder(@RequestParam String id) {
|
||||
return edPrjService.deleteFolder(id, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "更改层级顺序", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("folderResort")
|
||||
public ElectromagneticResult<?> folderResort(@RequestBody List<FolderResortDTO> folderResortDTOList) {
|
||||
return edPrjService.folderResort(folderResortDTOList);
|
||||
}
|
||||
|
||||
@UserOperation(value = "发布层级", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("publish")
|
||||
public ElectromagneticResult<?> publish(@RequestParam String prjId) {
|
||||
return edPrjService.publish(prjId, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "引用层级", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("follow")
|
||||
public ElectromagneticResult<?> follow(@RequestParam String sourceId, @RequestParam String targetId) {
|
||||
return edPrjService.follow(sourceId, targetId, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询层级发布状态", modelName = UserOperationModuleEnum.REPO_PRJ_SETTING)
|
||||
@RequestMapping("publishStatus")
|
||||
public ElectromagneticResult<?> publishStatus(@RequestBody QueryPublishStatus queryPublishStatus) {
|
||||
return edPrjService.publishStatus(queryPublishStatus, DataOwnEnum.REPO_PRJ.code);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.RequiredRole;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.AdminTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.RoleDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.RolePageDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.RoleService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/role")
|
||||
|
|
@ -20,67 +20,57 @@ public class RoleController {
|
|||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@ApiOperation(value = "新建角色", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "新建角色", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@RequestMapping(value = "/createRole", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> createRole(@RequestBody RoleDTO roleDTO) {
|
||||
try {
|
||||
Boolean res = roleService.createRole(roleDTO);
|
||||
return ElectromagneticResultUtil.success(res);
|
||||
} catch (BizException e) {
|
||||
return ElectromagneticResultUtil.fail("400", e.getMessage());
|
||||
}
|
||||
return ElectromagneticResultUtil.success(roleService.createRole(roleDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新角色", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "更新角色", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@RequestMapping(value = "/updateRole", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> updateRole(@RequestBody RoleDTO roleDTO) {
|
||||
try {
|
||||
Boolean res = roleService.updateRole(roleDTO);
|
||||
return ElectromagneticResultUtil.success(res);
|
||||
} catch (BizException e) {
|
||||
return ElectromagneticResultUtil.fail("400", e.getMessage());
|
||||
}
|
||||
return ElectromagneticResultUtil.success(roleService.updateRole(roleDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除角色", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "删除角色", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@GetMapping(value = "/deleteRole/{roleId}")
|
||||
public ElectromagneticResult<?> deleteRole(@PathVariable("roleId") String roleId) {
|
||||
return ElectromagneticResultUtil.success(roleService.deleteRole(roleId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查看角色", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "查看指定角色", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@GetMapping(value = "/getSingleRole/{roleId}")
|
||||
public ElectromagneticResult<?> getRole(@PathVariable("roleId") String roleId) {
|
||||
return ElectromagneticResultUtil.success(roleService.getRole(roleId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取角色列表", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "查看角色", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> getRoles(@RequestBody RolePageDTO rolePageDTO) {
|
||||
return ElectromagneticResultUtil.success(roleService.getRoles(rolePageDTO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过角色名查看角色权限", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "查看某一角色的权限", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@GetMapping(value = "/getRoleByName")
|
||||
public ElectromagneticResult<?> getRoleByName(@RequestParam("roleName") String roleName) {
|
||||
return ElectromagneticResultUtil.success(roleService.getRoleByName(roleName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色名列表", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "获取角色名列表", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@GetMapping(value = "/getRoleNames")
|
||||
public ElectromagneticResult<?> getRoleNames() {
|
||||
return ElectromagneticResultUtil.success(roleService.getAllRoleNames());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获得角色配置模版", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@UserOperation(value = "获取角色配置模版", modelName = UserOperationModuleEnum.PERMISSION)
|
||||
@GetMapping(value = "/getRoleTemplate")
|
||||
public ElectromagneticResult<?> getRoleTemplate() {
|
||||
return ElectromagneticResultUtil.success(roleService.getRoleTemplate());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.RequiredPermission;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.FilePermission;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/file")
|
||||
public class SysEdFileInfoController {
|
||||
|
||||
@Resource
|
||||
private EdFileInfoService edFileInfoService;
|
||||
|
||||
@UserOperation(value = "查看工程树", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequestMapping("tree")
|
||||
public ElectromagneticResult<?> tree() {
|
||||
return edFileInfoService.tree(PrjQuerySource.SYS_DB.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "创建文件夹", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequestMapping("createFolder")
|
||||
public ElectromagneticResult<?> createFolder(@RequestBody CreateFolderDTO createFolderDTO) {
|
||||
return edFileInfoService.createFolder(createFolderDTO, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "作废", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.DELETE)
|
||||
@RequestMapping("delete")
|
||||
public ElectromagneticResult<?> delete(@RequestParam String id) {
|
||||
return edFileInfoService.delete(id, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping("info")
|
||||
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
||||
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "上传文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.UPLOAD)
|
||||
@RequestMapping("upload")
|
||||
public ElectromagneticResult<?> upload(@RequestParam("parentId") String parentId,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.upload(parentId, file, strategy, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "下载文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.DOWNLOAD)
|
||||
@RequestMapping("download")
|
||||
public ResponseEntity<InputStreamResource> download(@RequestParam String id, HttpServletResponse response) {
|
||||
return edFileInfoService.download(id, response, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.EDIT)
|
||||
@RequestMapping("updateFileInfo")
|
||||
public ElectromagneticResult<?> updateFileInfo(@RequestBody UpdateFileInfoDTO updateFileInfoDTO) {
|
||||
return edFileInfoService.updateFileInfo(updateFileInfoDTO, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "移动文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.MOVE)
|
||||
@RequestMapping("moveFile")
|
||||
public ElectromagneticResult<?> moveFile(@RequestParam("id") String id,
|
||||
@RequestParam("targetFolderId") String targetFolderId,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.moveFile(id, targetFolderId, strategy, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "复制文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.MOVE)
|
||||
@RequestMapping("copyFile")
|
||||
public ElectromagneticResult<?> copyFile(@RequestParam("id") String id,
|
||||
@RequestParam("targetFolderId") String targetFolderId,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.copyFile(id, targetFolderId, strategy, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查看文件历史版本信息", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping("versionView")
|
||||
public ElectromagneticResult<?> versionView(@RequestParam String fileId) {
|
||||
return edFileInfoService.versionView(fileId);
|
||||
}
|
||||
|
||||
@UserOperation(value = "回退版本", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.EDIT)
|
||||
@RequestMapping("versionBack")
|
||||
public ElectromagneticResult<?> versionBack(@RequestParam String fileId, @RequestParam int targetVersion) {
|
||||
return edFileInfoService.versionBack(fileId, targetVersion);
|
||||
}
|
||||
|
||||
@UserOperation(value = "导出数据库", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequestMapping("batchExport")
|
||||
public ResponseEntity<InputStreamResource> batchExport(@RequestParam String fileIds, HttpServletResponse response) throws IOException {
|
||||
return edFileInfoService.batchExport(fileIds, response, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequestMapping(value = "/mergeChunks", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> mergeChunks(@RequestParam String identifier,
|
||||
@RequestParam String fileName,
|
||||
@RequestParam Integer totalChunks) {
|
||||
return edFileInfoService.mergeChunks(identifier, fileName, totalChunks, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||
return edFileInfoService.batchImport(fileChunkDTO, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库")
|
||||
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||
return edFileInfoService.checkChunkExist(fileChunkDTO, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequestMapping(value = "/uploadRecord", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||
return edFileInfoService.uploadRecord(pageNum, pageSize, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询文件详细信息", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping(value = "/fileDetail", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> detail(@RequestParam String id) {
|
||||
return edFileInfoService.detail(id);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询子文件集", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.VIEW)
|
||||
@RequestMapping(value = "/queryChildFolder", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> queryChildFolder(@RequestParam String parentId) {
|
||||
return edFileInfoService.queryChildFolder(parentId, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "预览文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
@RequiredPermission(value = FilePermission.PREVIEW)
|
||||
@RequestMapping(value = "preview", method = RequestMethod.GET)
|
||||
public ResponseEntity<InputStreamResource> preview(@RequestParam String id, HttpServletResponse response) {
|
||||
return edFileInfoService.preview(id, response, DataOwnEnum.SYS_FILE.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加进收藏夹
|
||||
*
|
||||
* @param id 文件id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/collection")
|
||||
@UserOperation(value = "收藏了文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> addFavorite(@RequestParam String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.addFavorite(userId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从收藏夹移除
|
||||
*
|
||||
* @param id 文件id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/removeCollection")
|
||||
@UserOperation(value = "从收藏夹移除了文件", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> removeFavorite(@RequestParam String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.removeFavorite(userId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示当前用户收藏夹文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listCollection")
|
||||
@UserOperation(value = "查看了收藏夹", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> listFavorite(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.findFavorite(userId, fileInfoQueryDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,29 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CheckNameUniqueRequest;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateRelationDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.serviceimpl.EdFileRelationServiceImpl;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileRelationService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/relation")
|
||||
public class EdFileRelationController {
|
||||
public class SysEdFileRelationController {
|
||||
|
||||
@Resource
|
||||
EdFileRelationServiceImpl edFileRelationService;
|
||||
EdFileRelationService edFileRelationService;
|
||||
@Resource
|
||||
EdFileInfoService edFileInfoService;
|
||||
|
||||
/**
|
||||
* 创建文件关系
|
||||
|
|
@ -27,26 +32,27 @@ public class EdFileRelationController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@UserOperation(value = "创建了文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> createRelation(@RequestBody EdFileRelation relation) {
|
||||
try {
|
||||
Boolean res = edFileRelationService.createRelation(relation);
|
||||
return ElectromagneticResultUtil.success(res);
|
||||
} catch (BizException e) {
|
||||
return ElectromagneticResultUtil.fail("500", e.getMessage());
|
||||
}
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.createRelation(relation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件关系
|
||||
* 更新文件关系
|
||||
*
|
||||
* @param updateRelation
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@UserOperation(value = "更新了文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> updateRelation(@RequestBody UpdateRelationDTO updateRelation) {
|
||||
LambdaUpdateWrapper<EdFileRelation> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(EdFileRelation::getId, updateRelation.getRelationId()).set(EdFileRelation::getRelationship, updateRelation.getRelationship());
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.update(wrapper));
|
||||
boolean isUpdated = edFileRelationService.update(new EdFileRelation(), wrapper);
|
||||
if (isUpdated) {
|
||||
UserThreadLocal.setSuccessInfo("", updateRelation.getRelationId(), "更新了文件关系");
|
||||
}
|
||||
return ElectromagneticResultUtil.success(isUpdated);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,6 +62,7 @@ public class EdFileRelationController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/cancel/{relationId}", method = RequestMethod.GET)
|
||||
@UserOperation(value = "取消了文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> cancelRelation(@PathVariable("relationId") String relationId) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.cancelRelation(relationId));
|
||||
}
|
||||
|
|
@ -64,6 +71,7 @@ public class EdFileRelationController {
|
|||
* 展示文件关系
|
||||
*/
|
||||
@RequestMapping(value = "listRelations/{id}", method = RequestMethod.GET)
|
||||
@UserOperation(value = "查看了文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> listRelations(@PathVariable("id") String id) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.listRelations(id));
|
||||
}
|
||||
|
|
@ -72,6 +80,7 @@ public class EdFileRelationController {
|
|||
* 检验文件名是否唯一
|
||||
*/
|
||||
@RequestMapping(value = "/checkFileNameExist", method = RequestMethod.POST)
|
||||
@UserOperation(value = "校验文件名唯一性", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> checkFileNameExist(@RequestBody CheckNameUniqueRequest checkNameUniqueRequest) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.checkNameExist(checkNameUniqueRequest));
|
||||
}
|
||||
|
|
@ -80,10 +89,11 @@ public class EdFileRelationController {
|
|||
* 本地上传并建立关系
|
||||
*/
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
@UserOperation(value = "上传了文件并创建了文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> uploadRelation(@RequestParam("parentId") String parentId,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("description") String description,
|
||||
@RequestParam("id") String id) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.uploadFileAndRelation(parentId, id, file, description));
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.uploadFileAndRelation(parentId, id, file, description, DataOwnEnum.SYS_FILE.code));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +1,99 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.QueryPublishStatus;
|
||||
import com.electromagnetic.industry.software.manage.service.EdPrjService;
|
||||
import com.electromagnetic.industry.software.manage.service.PermissionService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/prj")
|
||||
public class ProjectController {
|
||||
public class SysProjectController {
|
||||
|
||||
@Resource
|
||||
private EdPrjService edPrjService;
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
|
||||
@UserOperation(value = "创建层级", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("create")
|
||||
public ElectromagneticResult<?> create(@RequestParam String prjName) {
|
||||
return edPrjService.createNewPrj(prjName);
|
||||
return edPrjService.createNewPrj(prjName, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "删除层级", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("delete")
|
||||
public ElectromagneticResult<?> delete(@RequestParam String prjId) {
|
||||
return edPrjService.delete(prjId);
|
||||
return edPrjService.delete(prjId, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "修改层级名", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("modify")
|
||||
public ElectromagneticResult<?> modifyPrjName(@RequestParam String newPrjName, @RequestParam String prjId) {
|
||||
return edPrjService.modifyPrjName(prjId, newPrjName);
|
||||
return edPrjService.modifyPrjName(prjId, newPrjName, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询所有层级", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("queryAll")
|
||||
public ElectromagneticResult<?> queryAll() {
|
||||
return edPrjService.queryAllPrjInfo();
|
||||
return edPrjService.queryAllPrjInfo(PrjQuerySource.SYS_PRJ.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "添加子集", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("addFolder")
|
||||
public ElectromagneticResult<?> addFolder(@RequestParam String folderName, @RequestParam String parentId) {
|
||||
return edPrjService.addFolder(parentId, folderName);
|
||||
return edPrjService.addFolder(parentId, folderName, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "修改子集名称", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("modifyFolder")
|
||||
public ElectromagneticResult<?> modifyFolder(@RequestParam String newFolderName, @RequestParam String id) {
|
||||
return edPrjService.modifyFolder(id, newFolderName);
|
||||
return edPrjService.modifyFolder(id, newFolderName, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "废除子集", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("deleteFolder")
|
||||
public ElectromagneticResult<?> deleteFolder(@RequestParam String id) {
|
||||
return edPrjService.deleteFolder(id);
|
||||
return edPrjService.deleteFolder(id, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "更改层级顺序", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("folderResort")
|
||||
public ElectromagneticResult<?> folderResort(@RequestBody List<FolderResortDTO> folderResortDTOList) {
|
||||
return edPrjService.folderResort(folderResortDTOList);
|
||||
}
|
||||
|
||||
@UserOperation(value = "发布层级", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("publish")
|
||||
public ElectromagneticResult<?> publish(@RequestParam String prjId) {
|
||||
ElectromagneticResult<?> result = edPrjService.publish(prjId);
|
||||
edPrjService.publish(prjId, DataOwnEnum.SYS_PRJ.code);
|
||||
// 更新项目权限
|
||||
permissionService.syncPermissions(prjId);
|
||||
return result;
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
}
|
||||
|
||||
@UserOperation(value = "引用层级", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("follow")
|
||||
public ElectromagneticResult<?> follow(@RequestParam String sourceId, @RequestParam String targetId) {
|
||||
return edPrjService.follow(sourceId, targetId);
|
||||
return edPrjService.follow(sourceId, targetId, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询层级发布状态", modelName = UserOperationModuleEnum.SYS_PRJ_SETTING)
|
||||
@RequestMapping("publishStatus")
|
||||
public ElectromagneticResult<?> publishStatus(@RequestBody QueryPublishStatus queryPublishStatus) {
|
||||
return edPrjService.publishStatus(queryPublishStatus);
|
||||
return edPrjService.publishStatus(queryPublishStatus, DataOwnEnum.SYS_PRJ.code);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,97 +1,98 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.RequiredRole;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.AdminTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PublishEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.*;
|
||||
import com.electromagnetic.industry.software.manage.service.UserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("/data/ed/user")
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/user")
|
||||
public class UserController {
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@ApiOperation(value = "登录", notes = "")
|
||||
@PostMapping("/login")
|
||||
@UserOperation(value = "登陆", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> login(@RequestBody UserLoginRequest loginRequest) {
|
||||
return userService.login(loginRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增用户信息", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@PostMapping("/createUser")
|
||||
@UserOperation(value = "新增用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> createUser(@RequestBody UserRequest userRequest) {
|
||||
return userService.createUser(userRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "编辑用户信息", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@PutMapping("/updateUser")
|
||||
@UserOperation(value = "编辑用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> updateUser(@RequestBody UserModiRequest userModiRequest) {
|
||||
return userService.modifyUser(userModiRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发布用户信息", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@RequestMapping(value = "/publish", method = RequestMethod.POST)
|
||||
@UserOperation(value = "发布用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> publishUser(@RequestBody UserPublishRequest userPublishRequest) {
|
||||
return userService.publishUser(userPublishRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取单条用户信息", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@RequestMapping(value = "/getInfo", method = RequestMethod.GET)
|
||||
@UserOperation(value = "获取某一用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> getSingleUser(GetSingleUserRequest getSingleUserRequest) {
|
||||
return userService.getSingleUser(getSingleUserRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询用户信息", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@UserOperation(value = "查询用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> searchUser(@RequestBody SearchUserRequest searchUserRequest) {
|
||||
return userService.searchUser(searchUserRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "校验工号唯一性", notes = "")
|
||||
@RequestMapping(value = "/validateWorkNumber", method = RequestMethod.POST)
|
||||
@UserOperation(value = "校验工号唯一性", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> validateWorkNum(@RequestBody UserWorkNumRequest userWorkNumRequest) {
|
||||
return userService.validateWorkNum(userWorkNumRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除用户信息", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@PostMapping(value = "/deleteUser")
|
||||
@UserOperation(value = "删除用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> deleteUser(@RequestBody UserDeleteRequest userDeleteRequest) {
|
||||
return userService.deleteUser(userDeleteRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "登出", notes = "")
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.POST)
|
||||
@UserOperation(value = "登出", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> logout(@RequestHeader("Authorization") String token) {
|
||||
return userService.logout(token);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员绑定界面查询用户", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@RequestMapping(value = "/bindRole/list", method = RequestMethod.POST)
|
||||
@UserOperation(value = "查询用户信息", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> getPublishedUsers(@RequestBody SearchUserRequest searchUserRequest) {
|
||||
searchUserRequest.setIsPublished(PublishEnum.PUBLISHED.getCode().toString());
|
||||
return userService.searchUser(searchUserRequest);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员绑定", notes = "")
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@RequestMapping(value = "/bindRoles", method = RequestMethod.POST)
|
||||
@UserOperation(value = "绑定人员与角色", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> bindRoles(@RequestBody List<UserBindRoleDTO> list) {
|
||||
if (userService.bindRoles(list)) {
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
|
|
@ -100,21 +101,36 @@ public class UserController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "密码重置", notes = "")
|
||||
// @RequiredRole(AdminTypeEnum.SYSTEM)
|
||||
@PutMapping("/changePassword")
|
||||
@UserOperation(value = "修改用户密码", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> changePassword(@RequestBody ChangePasswordRequest request) {
|
||||
return userService.changePassword(request.getUserId(), request.getNewPassword());
|
||||
}
|
||||
|
||||
@RequiredRole(AdminTypeEnum.SECURITY)
|
||||
@GetMapping(value = "/resetPassword/{userId}")
|
||||
@UserOperation(value = "重置密码", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> resetPassword(@PathVariable("userId") String userId) {
|
||||
return ElectromagneticResultUtil.success(userService.resetPassword(userId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前用户管理员类型")
|
||||
@GetMapping(value = "/getAdminType")
|
||||
@UserOperation(value = "获取当前用户的管理员类型", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> getAdminType() {
|
||||
String adminType = UserThreadLocal.getAdminType();
|
||||
if (adminType == null || adminType.isEmpty()) {
|
||||
return ElectromagneticResultUtil.fail("500","当前用户未登录");
|
||||
UserThreadLocal.setSuccessInfo("", "", "查询当前用户的管理员类型失败,当前用户未登录");
|
||||
return ElectromagneticResultUtil.fail("500", "当前用户未登录");
|
||||
} else {
|
||||
UserThreadLocal.setSuccessInfo("", "", "查询当前用户的管理员类型成功");
|
||||
return ElectromagneticResultUtil.success(adminType);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/validateOldPassword")
|
||||
@UserOperation(value = "校验原始密码", modelName = UserOperationModuleEnum.USER)
|
||||
public ElectromagneticResult<?> validateOldPassword(@RequestBody ValidateOldPasswordRequest request) {
|
||||
return userService.validateOldPassword(request.getUserId(), request.getOldPassword());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/user/file")
|
||||
public class UserEdFileInfoController {
|
||||
|
||||
@Resource
|
||||
private EdFileInfoService edFileInfoService;
|
||||
|
||||
@UserOperation(value = "查看工程树", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("tree")
|
||||
public ElectromagneticResult<?> tree() {
|
||||
return edFileInfoService.tree(PrjQuerySource.USER_DB.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "创建文件夹", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("createFolder")
|
||||
public ElectromagneticResult<?> createFolder(@RequestBody CreateFolderDTO createFolderDTO) {
|
||||
return edFileInfoService.createFolder(createFolderDTO, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "作废", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("delete")
|
||||
public ElectromagneticResult<?> delete(@RequestParam String id) {
|
||||
return edFileInfoService.delete(id, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("info")
|
||||
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
||||
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "上传文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("upload")
|
||||
public ElectromagneticResult<?> upload(@RequestParam("parentId") String parentId,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.upload(parentId, file, strategy, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "下载文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("download")
|
||||
public ResponseEntity<InputStreamResource> download(@RequestParam String id, HttpServletResponse response) {
|
||||
return edFileInfoService.download(id, response, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "导出数据库", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("batchExport")
|
||||
public ResponseEntity<InputStreamResource> batchExport(@RequestParam String fileIds, HttpServletResponse response) throws IOException {
|
||||
return edFileInfoService.batchExport(fileIds, response, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping(value = "/mergeChunks", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> mergeChunks(@RequestParam String identifier,
|
||||
@RequestParam String fileName,
|
||||
@RequestParam Integer totalChunks) {
|
||||
return edFileInfoService.mergeChunks(identifier, fileName, totalChunks, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||
return edFileInfoService.batchImport(fileChunkDTO, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "批量上传数据库")
|
||||
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||
return edFileInfoService.checkChunkExist(fileChunkDTO, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("updateFileInfo")
|
||||
public ElectromagneticResult<?> updateFileInfo(@RequestBody UpdateFileInfoDTO updateFileInfoDTO) {
|
||||
return edFileInfoService.updateFileInfo(updateFileInfoDTO, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "移动文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("moveFile")
|
||||
public ElectromagneticResult<?> moveFile(@RequestParam("id") String id,
|
||||
@RequestParam("targetFolderId") String targetFolderId,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.moveFile(id, targetFolderId, strategy, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "复制文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("copyFile")
|
||||
public ElectromagneticResult<?> copyFile(@RequestParam("id") String id,
|
||||
@RequestParam("targetFolderId") String targetFolderId,
|
||||
@RequestParam("strategy") Integer strategy) {
|
||||
return edFileInfoService.copyFile(id, targetFolderId, strategy, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查看文件历史版本信息", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("versionView")
|
||||
public ElectromagneticResult<?> versionView(@RequestParam String fileId) {
|
||||
return edFileInfoService.versionView(fileId);
|
||||
}
|
||||
|
||||
@UserOperation(value = "回退版本", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("versionBack")
|
||||
public ElectromagneticResult<?> versionBack(@RequestParam String fileId, @RequestParam int targetVersion) {
|
||||
return edFileInfoService.versionBack(fileId, targetVersion);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping(value = "/uploadRecord", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||
return edFileInfoService.uploadRecord(pageNum, pageSize, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询文件详细信息", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping(value = "/fileDetail", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> detail(@RequestParam String id) {
|
||||
return edFileInfoService.detail(id);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询子文件集", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping(value = "/queryChildFolder", method = RequestMethod.GET)
|
||||
public ElectromagneticResult<?> queryChildFolder(@RequestParam String parentId) {
|
||||
return edFileInfoService.queryChildFolder(parentId, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "预览文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping(value = "preview", method = RequestMethod.GET)
|
||||
public ResponseEntity<InputStreamResource> preview(@RequestParam String id, HttpServletResponse response) {
|
||||
return edFileInfoService.preview(id, response, DataOwnEnum.USER_FILE.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加进收藏夹
|
||||
*
|
||||
* @param id 文件id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/collection")
|
||||
@UserOperation(value = "收藏文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
public ElectromagneticResult<?> addFavorite(@RequestParam String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.addFavorite(userId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 从收藏夹移除
|
||||
*
|
||||
* @param id 文件id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/removeCollection")
|
||||
@UserOperation(value = "从收藏夹移除文件", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
public ElectromagneticResult<?> removeFavorite(@RequestParam String id) {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.removeFavorite(userId, id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CheckNameUniqueRequest;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateRelationDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileInfoService;
|
||||
import com.electromagnetic.industry.software.manage.service.EdFileRelationService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/user/relation")
|
||||
public class UserEdFileRelationController {
|
||||
|
||||
@Resource
|
||||
EdFileRelationService edFileRelationService;
|
||||
@Resource
|
||||
EdFileInfoService edFileInfoService;
|
||||
|
||||
/**
|
||||
* 创建文件关系
|
||||
*
|
||||
* @param relation
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@UserOperation(value = "创建文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> createRelation(@RequestBody EdFileRelation relation) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.createRelation(relation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文件关系
|
||||
*
|
||||
* @param updateRelation
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@UserOperation(value = "更新文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> updateRelation(@RequestBody UpdateRelationDTO updateRelation) {
|
||||
LambdaUpdateWrapper<EdFileRelation> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(EdFileRelation::getId, updateRelation.getRelationId()).set(EdFileRelation::getRelationship, updateRelation.getRelationship());
|
||||
boolean isUpdated = edFileRelationService.update(wrapper);
|
||||
if (isUpdated) {
|
||||
UserThreadLocal.setSuccessInfo("", updateRelation.getRelationId(), "更新了文件关系");
|
||||
}
|
||||
return ElectromagneticResultUtil.success(isUpdated);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消文件关系
|
||||
*
|
||||
* @param relationId 关系主键id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/cancel/{relationId}", method = RequestMethod.GET)
|
||||
@UserOperation(value = "取消文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> cancelRelation(@PathVariable("relationId") String relationId) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.cancelRelation(relationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示文件关系
|
||||
*/
|
||||
@RequestMapping(value = "listRelations/{id}", method = RequestMethod.GET)
|
||||
@UserOperation(value = "查看文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> listRelations(@PathVariable("id") String id) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.listRelations(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验文件名是否唯一
|
||||
*/
|
||||
@RequestMapping(value = "/checkFileNameExist", method = RequestMethod.POST)
|
||||
@UserOperation(value = "校验文件名唯一性", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> checkFileNameExist(@RequestBody CheckNameUniqueRequest checkNameUniqueRequest) {
|
||||
return ElectromagneticResultUtil.success(edFileRelationService.checkNameExist(checkNameUniqueRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地上传并建立关系
|
||||
*/
|
||||
@RequestMapping(value = "/upload", method = RequestMethod.POST)
|
||||
@UserOperation(value = "上传了文件并创建文件关系", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||
public ElectromagneticResult<?> uploadRelation(@RequestParam("parentId") String parentId,
|
||||
@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("description") String description,
|
||||
@RequestParam("id") String id) {
|
||||
return ElectromagneticResultUtil.success(edFileInfoService.uploadFileAndRelation(parentId, id, file, description, DataOwnEnum.USER_FILE.code));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.TagCreateDTO;
|
||||
import com.electromagnetic.industry.software.manage.service.FileTagRelationService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/user/tag")
|
||||
public class UserEdFileTagController {
|
||||
|
||||
@Resource
|
||||
private FileTagRelationService fileTagRelationService;
|
||||
|
||||
// 批量添加标签到文件
|
||||
@PostMapping("/addTagsToFile")
|
||||
@UserOperation(value = "批量添加了标签到文件", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> addTagsToFile(@RequestBody TagCreateDTO dto) {
|
||||
String createdBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(fileTagRelationService.addTagsToFile(dto.getFileId(), dto.getTagIds(), createdBy));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.electromagnetic.industry.software.manage.controller;
|
||||
|
||||
import com.electromagnetic.industry.software.common.annotations.UserOperation;
|
||||
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.PrjQuerySource;
|
||||
import com.electromagnetic.industry.software.common.enums.UserOperationModuleEnum;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FolderResortDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.QueryPublishStatus;
|
||||
import com.electromagnetic.industry.software.manage.service.EdPrjService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data/ed/user/prj")
|
||||
public class UserPrjController {
|
||||
|
||||
@Resource
|
||||
private EdPrjService edPrjService;
|
||||
|
||||
@UserOperation(value = "创建层级", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("create")
|
||||
public ElectromagneticResult<?> create(@RequestParam String prjName) {
|
||||
return edPrjService.createNewPrj(prjName, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "删除层级", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("delete")
|
||||
public ElectromagneticResult<?> delete(@RequestParam String prjId) {
|
||||
return edPrjService.delete(prjId, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "修改层级名", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("modify")
|
||||
public ElectromagneticResult<?> modifyPrjName(@RequestParam String newPrjName, @RequestParam String prjId) {
|
||||
return edPrjService.modifyPrjName(prjId, newPrjName, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询所有层级", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("queryAll")
|
||||
public ElectromagneticResult<?> queryAll() {
|
||||
return edPrjService.queryAllPrjInfo(PrjQuerySource.USER_PRJ.value);
|
||||
}
|
||||
|
||||
@UserOperation(value = "添加子集", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("addFolder")
|
||||
public ElectromagneticResult<?> addFolder(@RequestParam String folderName, @RequestParam String parentId) {
|
||||
return edPrjService.addFolder(parentId, folderName, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "修改子集名称", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("modifyFolder")
|
||||
public ElectromagneticResult<?> modifyFolder(@RequestParam String newFolderName, @RequestParam String id) {
|
||||
return edPrjService.modifyFolder(id, newFolderName, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "废除子集", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("deleteFolder")
|
||||
public ElectromagneticResult<?> deleteFolder(@RequestParam String id) {
|
||||
return edPrjService.deleteFolder(id, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "更改层级顺序", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("folderResort")
|
||||
public ElectromagneticResult<?> folderResort(@RequestBody List<FolderResortDTO> folderResortDTOList) {
|
||||
return edPrjService.folderResort(folderResortDTOList);
|
||||
}
|
||||
|
||||
@UserOperation(value = "发布层级", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("publish")
|
||||
public ElectromagneticResult<?> publish(@RequestParam String prjId) {
|
||||
return edPrjService.publish(prjId, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "引用层级", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("follow")
|
||||
public ElectromagneticResult<?> follow(@RequestParam String sourceId, @RequestParam String targetId) {
|
||||
return edPrjService.follow(sourceId, targetId, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
|
||||
@UserOperation(value = "查询层级发布状态", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||
@RequestMapping("publishStatus")
|
||||
public ElectromagneticResult<?> publishStatus(@RequestBody QueryPublishStatus queryPublishStatus) {
|
||||
return edPrjService.publishStatus(queryPublishStatus, DataOwnEnum.USER_PRJ.code);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.AiFileUploadRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AiFileUploadRecordMapper extends BaseMapper<AiFileUploadRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.AiQuestionRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AiQuestionRecordMapper extends BaseMapper<AiQuestionRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileFavorite;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface EdFileFavoriteMapper extends BaseMapper<EdFileFavorite> {
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,48 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoVO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EdFileInfoMapper extends BaseMapper<EdFileInfo> {
|
||||
|
||||
|
||||
default EdFileInfo selectById(String id) {
|
||||
return this.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.select(EdFileInfo.class, file -> !StrUtil.equals(file.getColumn(), "file_content"))
|
||||
.eq(EdFileInfo::getId, id));
|
||||
}
|
||||
|
||||
default EdFileInfo selectById1(String id) {
|
||||
return this.selectOne(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||
.eq(EdFileInfo::getId, id));
|
||||
}
|
||||
|
||||
@Select("select max(id) from ed_file_info where length(id) = 6")
|
||||
String maxPrjId();
|
||||
|
||||
/**
|
||||
* 收藏页 数据查询
|
||||
*
|
||||
* @param page
|
||||
* @param ids
|
||||
* @param queryDTO
|
||||
* @return
|
||||
*/
|
||||
IPage<FileInfoVO> queryFileList(Page<FileInfoVO> page,
|
||||
@Param("ids") List<String> ids,
|
||||
@Param("pars") FileInfoQueryDTO queryDTO,
|
||||
@Param("saveStatus") int saveStatus,
|
||||
@Param("effectFlag") int effectFlag);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface EdTagLibraryMapper extends BaseMapper<EdTagLibrary> {
|
||||
|
||||
// @Select("SELECT MAX(order_by) FROM ed_tag_library WHERE type = #{type} and parent_id = #{parentId}")
|
||||
// Integer selectMaxOrder(@Param("type") int type, @Param("parentId") String parentId);
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileBackupLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FileBackupLogMapper extends BaseMapper<FileBackupLog> {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FileFormatMapper extends BaseMapper<FileFormat> {
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileTagRelation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FileTagRelationMapper extends BaseMapper<FileTagRelation> {
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ public interface RoleMapper extends BaseMapper<Role> {
|
|||
|
||||
@Select("<script>" +
|
||||
"SELECT " +
|
||||
" r.role_id AS roleId, " +
|
||||
" r.id AS roleId, " +
|
||||
" r.role_name AS roleName, " +
|
||||
" r.role_desc AS roleDesc, " +
|
||||
" GROUP_CONCAT(DISTINCT f.file_name) AS dataScope, " +
|
||||
|
|
@ -28,20 +28,20 @@ public interface RoleMapper extends BaseMapper<Role> {
|
|||
"FROM " +
|
||||
" ed_role r " +
|
||||
"LEFT JOIN " +
|
||||
" ed_role_permission rp ON r.role_id = rp.role_id " +
|
||||
" ed_role_permission rp ON r.id = rp.role_id " +
|
||||
"LEFT JOIN " +
|
||||
" ed_file_info f ON rp.file_id = f.id " +
|
||||
"LEFT JOIN" +
|
||||
" ed_user_role ur ON r.role_id = ur.role_id " +
|
||||
" ed_user_role ur ON r.id = ur.role_id " +
|
||||
"LEFT JOIN" +
|
||||
" ed_users u ON ur.user_id = u.user_id " +
|
||||
" ed_users u ON ur.user_id = u.id " +
|
||||
"WHERE " +
|
||||
" 1=1 " +
|
||||
"<if test=\"ew != null and ew.sqlSegment != null and ew.sqlSegment != ''\">" +
|
||||
" AND ${ew.sqlSegment} " +
|
||||
"</if>" +
|
||||
"GROUP BY " +
|
||||
" r.role_id" +
|
||||
" r.id" +
|
||||
"</script>")
|
||||
Page<RoleDTO> getPageRoleDTO(Page<RoleDTO> page, @Param(Constants.WRAPPER) QueryWrapper<Role> queryWrapper);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public interface TokenMapper extends BaseMapper<Token> {
|
|||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
int insert(Token token);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.UserAccessLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserAccessLogMapper extends BaseMapper<UserAccessLog> {
|
||||
}
|
||||
|
|
@ -1,49 +1,16 @@
|
|||
package com.electromagnetic.industry.software.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.User;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.PublishParam;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.SearchKeyWords;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.UserDeleteKeyWords;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
int insert(User user);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
int modify(User user);
|
||||
|
||||
/**
|
||||
* 发布
|
||||
*
|
||||
* @param publishParam
|
||||
* @return
|
||||
*/
|
||||
int publish(PublishParam publishParam);
|
||||
|
||||
/**
|
||||
* 通过工号查询用户
|
||||
*
|
||||
* @param workNumber
|
||||
* @return
|
||||
*/
|
||||
User selectUserByWorkNumber(String workNumber);
|
||||
|
||||
/**
|
||||
/*
|
||||
* 通过用户编码查询用户
|
||||
*
|
||||
* @param userId
|
||||
|
|
@ -67,14 +34,6 @@ public interface UserMapper {
|
|||
*/
|
||||
int getTotalCount(SearchKeyWords searchKeywords);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userDeleteKeyWords
|
||||
* @return
|
||||
*/
|
||||
int deleteUser(UserDeleteKeyWords userDeleteKeyWords);
|
||||
|
||||
/**
|
||||
* 查找用户角色名称
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "ai_file_upload_record")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AiFileUploadRecord extends BaseModel {
|
||||
|
||||
@TableField(value = "id")
|
||||
private String id;
|
||||
|
||||
@TableField(value = "file_name")
|
||||
private String fileName;
|
||||
|
||||
@TableField(value = "file_md5")
|
||||
private String fileMd5;
|
||||
|
||||
@TableField(value = "vector_id")
|
||||
private String vectorId;
|
||||
|
||||
@TableField(value = "file_size")
|
||||
private long fileSize;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "ai_question_record")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AiQuestionRecord extends BaseModel {
|
||||
|
||||
private String id;
|
||||
|
||||
@TableField(value = "question")
|
||||
private String question;
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
|
@ -12,24 +13,30 @@ public class BaseModel {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
@TableField(value = "created_time", fill = FieldFill.INSERT)
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
@TableField(value = "created_by", fill = FieldFill.INSERT)
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
@TableField(value = "updated_time")
|
||||
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 最后更新人
|
||||
*/
|
||||
@TableField(value = "updated_by")
|
||||
@TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* 是否有效 0-无效 1-有效
|
||||
*/
|
||||
@TableField(value = "effect_flag")
|
||||
private Integer effectFlag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("ed_file_favorite")
|
||||
public class EdFileFavorite extends BaseModel {
|
||||
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
@TableField("user_id")
|
||||
private String userId;
|
||||
|
||||
@TableField("file_id")
|
||||
private String fileId;
|
||||
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
}
|
||||
}
|
||||
|
|
@ -2,17 +2,13 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ed_file_info")
|
||||
@Accessors(chain = true)
|
||||
|
|
@ -85,11 +81,7 @@ public class EdFileInfo extends BaseModel {
|
|||
*/
|
||||
@TableField(value = "pre_version")
|
||||
private Integer preVersion;
|
||||
/**
|
||||
* 是否有效 0-无效 1-有效
|
||||
*/
|
||||
@TableField(value = "effect_flag")
|
||||
private Integer effectFlag;
|
||||
|
||||
/**
|
||||
* 保存状态,0-上传中 1-上传成功 2-上传失败
|
||||
*/
|
||||
|
|
@ -111,12 +103,14 @@ public class EdFileInfo extends BaseModel {
|
|||
@TableField(value = "file_code")
|
||||
private String fileCode;
|
||||
/**
|
||||
* 是否是管理员定义的系统层级目录
|
||||
* 数据的归属:0-》上传的文件或者新建的文件夹 1-》系统管理员创建的层级 2-》用户自定义的层级
|
||||
*/
|
||||
@TableField(value = "prj_dir")
|
||||
private Boolean prjDir;
|
||||
@TableField(value = "data_own")
|
||||
private Integer dataOwn;
|
||||
|
||||
/** 当一个文件作废时,其所有的历史文件也会跟着作废,此时该文件及其历史文件的all_deleted=true**/
|
||||
/**
|
||||
* 当一个文件作废时,其所有的历史文件也会跟着作废,此时该文件及其历史文件的all_deleted=true
|
||||
**/
|
||||
@TableField(value = "all_deleted")
|
||||
private Boolean allDeleted;
|
||||
|
||||
|
|
@ -127,17 +121,10 @@ public class EdFileInfo extends BaseModel {
|
|||
private Boolean permanentDeleted;
|
||||
|
||||
public void newInit() {
|
||||
String userId = UserThreadLocal.getUserId();
|
||||
String newFileDbId = IdWorker.getSnowFlakeIdString();
|
||||
String fileTime = EleCommonUtil.getNowTimeStr();
|
||||
Date now = new Date();
|
||||
this.setUpdatedBy(userId);
|
||||
this.setId(newFileDbId);
|
||||
this.setUpdatedTime(now);
|
||||
this.setCreatedTime(now);
|
||||
this.setFileTime(fileTime);
|
||||
this.setCreatedBy(userId);
|
||||
this.setFileId(newFileDbId);
|
||||
this.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("ed_file_relation")
|
||||
public class EdFileRelation {
|
||||
public class EdFileRelation extends BaseModel {
|
||||
|
||||
private String id;
|
||||
|
||||
|
|
@ -30,21 +30,7 @@ public class EdFileRelation {
|
|||
*/
|
||||
private String relationship;
|
||||
|
||||
/**
|
||||
* 创建者 用户id
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* 更新者 用户id
|
||||
*/
|
||||
@TableField(value = "updated_by")
|
||||
private String updatedBy;
|
||||
|
||||
@TableField(value = "updated_at", fill = FieldFill.UPDATE)
|
||||
private Date updatedAt;
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.enums.PublishEnum;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("ed_tag_library")
|
||||
public class EdTagLibrary extends BaseModel {
|
||||
|
||||
@TableId
|
||||
private String tagId; // 主键 ID
|
||||
private String parentId; // 父 ID,"" 代表是标签组
|
||||
private Integer type; // 0: 标签组, 1: 标签
|
||||
private String tagName; // 标签库或标签名称
|
||||
private Integer orderBy; // 排序字段
|
||||
private Integer isPublished; // 是否已发布(0: 未发布, 1: 已发布)
|
||||
|
||||
public void newInit() {
|
||||
this.setTagId(IdWorker.getSnowFlakeIdString());
|
||||
this.setIsPublished(PublishEnum.UNPUBLISHED.getCode()); //默认未发布
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("file_backup_log")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FileBackupLog extends BaseModel {
|
||||
|
||||
private String id;
|
||||
|
||||
private String fileId;
|
||||
|
||||
private String fileCode;
|
||||
|
||||
private boolean backupSuccess;
|
||||
|
||||
private Long startTime;
|
||||
|
||||
private Long endTime;
|
||||
|
||||
private Long duration;
|
||||
|
||||
private String failInfoDetail;
|
||||
|
||||
private long fileTime;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private Integer source;
|
||||
|
||||
private Date fileCreateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("ed_file_format")
|
||||
public class FileFormat extends BaseModel {
|
||||
|
||||
private String id;
|
||||
|
||||
private String suffixNo;
|
||||
|
||||
private String suffixName;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("file_tag_relations")
|
||||
public class FileTagRelation extends BaseModel {
|
||||
|
||||
private String id;
|
||||
private String fileId;
|
||||
private String tagId;
|
||||
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +1,17 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("ed_role") // 指定表名
|
||||
public class Role {
|
||||
public class Role extends BaseModel {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@TableField(value = "role_id")
|
||||
private String roleId;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
|
|
@ -30,38 +25,8 @@ public class Role {
|
|||
@TableField(value = "role_desc")
|
||||
private String roleDesc;
|
||||
|
||||
/**
|
||||
* 创建者用户编码
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 创建者姓名
|
||||
*/
|
||||
@TableField(value = "creator_name")
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "gmt_create", fill = FieldFill.INSERT)
|
||||
private Date gmtCreate;
|
||||
|
||||
/**
|
||||
* 编辑者用户编码
|
||||
*/
|
||||
private String modifier;
|
||||
|
||||
/**
|
||||
* 编辑者姓名
|
||||
*/
|
||||
@TableField(value = "modifier_name")
|
||||
private String modifierName;
|
||||
|
||||
/**
|
||||
* 编辑时间
|
||||
*/
|
||||
@TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
|
||||
private Date gmtModified;
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("ed_role_permission")
|
||||
@AllArgsConstructor
|
||||
public class RolePermission {
|
||||
public class RolePermission extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableField(value = "id")
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
|
|
@ -34,10 +34,7 @@ public class RolePermission {
|
|||
@TableField(value = "permission_code")
|
||||
private String permissionCode;
|
||||
|
||||
|
||||
public RolePermission(String roleId, String fileId, String permissionCode) {
|
||||
this.roleId = roleId;
|
||||
this.fileId = fileId;
|
||||
this.permissionCode = permissionCode;
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.cons.UserConstants;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import com.electromagnetic.industry.software.common.util.SignUtils;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ed_users")
|
||||
@Data
|
||||
public class User {
|
||||
public class User extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编码
|
||||
*/
|
||||
private String userId;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
|
|
@ -89,34 +90,11 @@ public class User {
|
|||
*/
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String creatorName;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date gmtCreate;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String modifier;
|
||||
/**
|
||||
* 更新人姓名
|
||||
*/
|
||||
private String modifierName;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date gmtModified;
|
||||
|
||||
/**
|
||||
* 是否有效:0-无效 1-有效
|
||||
*/
|
||||
private Integer effectFlag;
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
this.setSalt(RandomUtil.randomString(16));
|
||||
this.setUserPwd(SignUtils.MD5(UserConstants.DEFAULT_PASSWORD + this.getSalt()));
|
||||
this.setIsPublished(UserConstants.DEFAULT_PUBLISH_STATUS);
|
||||
this.setIsActivated(UserConstants.DEFAULT_ACTIVE_STATUS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.models;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("user_access_log")
|
||||
public class UserAccessLog extends BaseModel {
|
||||
|
||||
private String id;
|
||||
|
||||
// 操作人的id
|
||||
private String userId;
|
||||
|
||||
// 请求开始时间
|
||||
private Date accessStartTime;
|
||||
|
||||
// 请求结束时间
|
||||
private Date accessEndTime;
|
||||
|
||||
// 请求耗时
|
||||
private Long accessDuration;
|
||||
|
||||
// 进行的操作
|
||||
private String action;
|
||||
|
||||
// 请求的url
|
||||
private String requestUrl;
|
||||
|
||||
// 请求的ip
|
||||
private String requestIp;
|
||||
|
||||
// 请求的参数
|
||||
private String reqArgs;
|
||||
|
||||
// 请求远端地址
|
||||
private String remoteAddr;
|
||||
|
||||
// 请求是否成功
|
||||
private Boolean accessSuccess;
|
||||
|
||||
// 操作详情
|
||||
private String operationMsg;
|
||||
|
||||
// 异常信息 供开发者异常查看
|
||||
private String exceptionDetail;
|
||||
|
||||
// 操作对象
|
||||
private String operationModule;
|
||||
|
||||
// 数据id
|
||||
private String dataId;
|
||||
|
||||
// 父id,最权限需要
|
||||
private String parentId;
|
||||
|
||||
// 请求返回的结果
|
||||
private String response;
|
||||
|
||||
}
|
||||
|
|
@ -2,11 +2,17 @@ package com.electromagnetic.industry.software.manage.pojo.models;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("ed_user_role")
|
||||
public class UserRole {
|
||||
public class UserRole extends BaseModel {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户编码
|
||||
|
|
@ -19,4 +25,8 @@ public class UserRole {
|
|||
*/
|
||||
@TableField(value = "role_id")
|
||||
private String roleId;
|
||||
|
||||
public void newInit() {
|
||||
this.setId(IdWorker.getSnowFlakeIdString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.other;
|
||||
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class FileInfoVO {
|
||||
|
|
@ -22,6 +25,8 @@ public class FileInfoVO {
|
|||
|
||||
private String parentId;
|
||||
|
||||
private String categoryId;
|
||||
|
||||
private Integer dataType;
|
||||
|
||||
private Integer dataStatus;
|
||||
|
|
@ -41,4 +46,17 @@ public class FileInfoVO {
|
|||
private String fileCode;
|
||||
|
||||
private String createdBy;
|
||||
|
||||
private List<FileTagInfo> labels;
|
||||
|
||||
private String dataOwn;
|
||||
|
||||
// 是否是收藏数据,1是,0否
|
||||
private Integer isFavorite;
|
||||
|
||||
// 是否是个人数据,1是,0否
|
||||
private Integer isPersonal;
|
||||
|
||||
// 文件权限
|
||||
private Map<String, Boolean> permissions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,4 @@ public class PublishParam {
|
|||
*/
|
||||
private List<String> userIds;
|
||||
|
||||
/**
|
||||
* 编辑者
|
||||
*/
|
||||
private String modifier;
|
||||
|
||||
/**
|
||||
* 编辑者姓名
|
||||
*/
|
||||
private String modifierName;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.other;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -11,15 +12,11 @@ public class SingleUserResponse {
|
|||
|
||||
private static final long serialVersionUID = -7475233976453471059L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户编码
|
||||
*/
|
||||
private String userId;
|
||||
@JsonProperty("userId")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
|
|
@ -51,11 +48,6 @@ public class SingleUserResponse {
|
|||
*/
|
||||
private String userAccount;
|
||||
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
// private String userPwd;
|
||||
|
||||
/**
|
||||
* 角色名称拼接字符串
|
||||
*/
|
||||
|
|
@ -98,36 +90,23 @@ public class SingleUserResponse {
|
|||
*/
|
||||
private Integer isDefaultPwd;
|
||||
|
||||
/**
|
||||
* 盐
|
||||
*/
|
||||
// private String salt;
|
||||
|
||||
private Date createdTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String creator;
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
* 最后更新时间
|
||||
*/
|
||||
private String creatorName;
|
||||
private Date updatedTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* 最后更新人
|
||||
*/
|
||||
private Date gmtCreate;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String modifier;
|
||||
/**
|
||||
* 更新人姓名
|
||||
*/
|
||||
private String modifierName;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date gmtModified;
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* 是否有效:0-无效 1-有效
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AccessLogQueryDTO {
|
||||
|
||||
private String dataId;
|
||||
|
||||
private int pageNum;
|
||||
|
||||
private int pageSize;
|
||||
|
||||
private String keyWord;
|
||||
|
||||
private String operationModuleKey;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
public class ChangePasswordRequest {
|
||||
private String userId;
|
||||
|
||||
private String newPassword;
|
||||
|
||||
// Getters and Setters
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
public String getNewPassword() {
|
||||
return newPassword;
|
||||
}
|
||||
|
||||
public void setNewPassword(String newPassword) {
|
||||
this.newPassword = newPassword;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ChatQueryDTO {
|
||||
private String question;
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ package com.electromagnetic.industry.software.manage.pojo.req;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FileInfoQueryDTO {
|
||||
|
||||
|
|
@ -54,7 +56,7 @@ public class FileInfoQueryDTO {
|
|||
/**
|
||||
* 版本号(0-升序,1-降序
|
||||
*/
|
||||
private Integer fileVersion;
|
||||
private Integer versionSort;
|
||||
|
||||
/**
|
||||
* 文件大小0-升序,1-降序)
|
||||
|
|
@ -65,4 +67,9 @@ public class FileInfoQueryDTO {
|
|||
* 状态(0-未发布 1-已发布 2-占用)
|
||||
*/
|
||||
private Integer dataStatus;
|
||||
|
||||
/**
|
||||
* 标签查询ID列表
|
||||
*/
|
||||
private List<String> tagIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,7 @@ public class PublishedFileDTO {
|
|||
|
||||
private Integer effectFlag;
|
||||
|
||||
private Boolean prjDir;
|
||||
|
||||
|
||||
public void newInit() {
|
||||
this.setPrjDir(Boolean.TRUE);
|
||||
this.setDataStatus(PublishEnum.PUBLISHED.getCode());
|
||||
this.setEffectFlag(EffectFlagEnum.EFFECT.code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QueryDTO {
|
||||
|
||||
private String msg;
|
||||
|
||||
private String userId;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RecycleFileQueryDTO {
|
||||
|
||||
private String keyword;
|
||||
|
||||
private int pageNum;
|
||||
|
||||
private int pageSize;
|
||||
|
||||
/**
|
||||
* 文件名排序 (0-升序,1-降序)
|
||||
*/
|
||||
private Integer fileNameSort;
|
||||
|
||||
/**
|
||||
* 文件类型 (0-升序,1-降序)
|
||||
*/
|
||||
private Integer fileTypeSort;
|
||||
|
||||
/**
|
||||
* 文件类型过滤
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 上传时间(0-升序,1-降序)
|
||||
*/
|
||||
private Integer createdTime;
|
||||
|
||||
/**
|
||||
* 修改时间(0-升序,1-降序)
|
||||
*/
|
||||
private Integer updatedTime;
|
||||
|
||||
|
||||
/**
|
||||
* 版本号(0-升序,1-降序
|
||||
*/
|
||||
private Integer versionSort;
|
||||
|
||||
/**
|
||||
* 文件大小0-升序,1-降序)
|
||||
*/
|
||||
private Integer fileSizeSort;
|
||||
|
||||
}
|
||||
|
|
@ -37,4 +37,6 @@ public class RolePermissionDTO {
|
|||
* 子目录
|
||||
*/
|
||||
private List<RolePermissionDTO> children;
|
||||
|
||||
private int dataOwnCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TagCreateDTO {
|
||||
|
||||
private String fileId;
|
||||
|
||||
private List<String> tagIds;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UploadDTO {
|
||||
|
||||
private String content;
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -14,7 +15,8 @@ public class UserModiRequest extends BaseRequest implements Serializable {
|
|||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
private String userId;
|
||||
@JsonProperty("userId")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户姓名
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.req;
|
||||
|
||||
public class ValidateOldPasswordRequest {
|
||||
private String userId;
|
||||
private String oldPassword;
|
||||
|
||||
// Getters and Setters
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getOldPassword() {
|
||||
return oldPassword;
|
||||
}
|
||||
|
||||
public void setOldPassword(String oldPassword) {
|
||||
this.oldPassword = oldPassword;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class AccessLogQueryVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String userName;
|
||||
|
||||
// 进行的操作
|
||||
private String action;
|
||||
|
||||
// 操作对象
|
||||
private String operationModule;
|
||||
|
||||
// 操作详情
|
||||
private String operationMsg;
|
||||
|
||||
// 操作时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
// 请求远端地址
|
||||
private String remoteAddr;
|
||||
|
||||
// 请求是否成功
|
||||
private Boolean accessSuccess;
|
||||
|
||||
// 请求耗时
|
||||
private Long accessDuration;
|
||||
|
||||
// 请求的ip
|
||||
private String requestIp;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class FileBackLogVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String fileId;
|
||||
|
||||
private String fileCode;
|
||||
|
||||
private String fileName;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date backStartTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date backEndTime;
|
||||
|
||||
private boolean backupSuccess;
|
||||
|
||||
private Integer dataOwn;
|
||||
|
||||
private String dataOwner;
|
||||
|
||||
private String filePath;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileFormatVO {
|
||||
private String id;
|
||||
|
||||
private String suffixNo;
|
||||
|
||||
private String suffixName;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class FileInfoQueryPageVO {
|
||||
|
||||
private long total;
|
||||
|
||||
private List<FileInfoVO> records = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class FileRecycleQueryVO {
|
||||
|
||||
private String id;
|
||||
|
||||
private String fileId;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private String fileType;
|
||||
|
||||
private String fileVersion;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updatedTime;
|
||||
|
||||
private String fileNote;
|
||||
|
||||
private long fileSize;
|
||||
|
||||
private String fileSizeShow;
|
||||
|
||||
private String updatedBy;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String dataOwner;
|
||||
|
||||
private int dataOwn;
|
||||
|
||||
private String filePath;
|
||||
|
||||
private String filePrjPath;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileTagInfo {
|
||||
|
||||
private String tagId;
|
||||
|
||||
private String tagName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OperationModuleVO {
|
||||
private String text;
|
||||
private String value;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.electromagnetic.industry.software.manage.pojo.resp;
|
||||
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TagListVO {
|
||||
|
||||
private String tagId; // 主键 ID
|
||||
private String parentId; // 父 ID,"" 代表是标签组
|
||||
private Integer type; // 0: 标签组, 1: 标签
|
||||
private String tagName; // 标签库或标签名称
|
||||
private Integer orderBy; // 排序字段
|
||||
private Integer isPublished; // 是否已发布(0: 未发布, 1: 已发布)
|
||||
|
||||
private List<EdTagLibrary> children;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileFavorite;
|
||||
|
||||
public interface EdFileFavoriteService extends IService<EdFileFavorite> {
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param userId
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
public boolean logicRemove(String userId, String fileId);
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +1,21 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoVO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CreateFolderDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileChunkDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.FileInfoQueryDTO;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.UpdateFileInfoDTO;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public interface EdFileInfoService {
|
||||
|
||||
|
|
@ -21,21 +25,21 @@ public interface EdFileInfoService {
|
|||
* @param fileInfoQueryDTO
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> queryEdFileInfo(FileInfoQueryDTO fileInfoQueryDTO);
|
||||
ElectromagneticResult<?> queryEdFileInfo(FileInfoQueryDTO fileInfoQueryDTO, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 新建文件夹
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> createFolder(CreateFolderDTO createFolderDTO);
|
||||
ElectromagneticResult<?> createFolder(CreateFolderDTO createFolderDTO, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 项目层级结构查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> tree();
|
||||
ElectromagneticResult<?> tree(int querySource);
|
||||
|
||||
/**
|
||||
* 删除目录
|
||||
|
|
@ -43,7 +47,7 @@ public interface EdFileInfoService {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> delete(String id);
|
||||
ElectromagneticResult<?> delete(String id, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
|
|
@ -51,14 +55,14 @@ public interface EdFileInfoService {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ResponseEntity<InputStreamResource> download(String id, HttpServletResponse response);
|
||||
ResponseEntity<InputStreamResource> download(String id, HttpServletResponse response, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 更新文件信息
|
||||
*
|
||||
* @param updateFileInfoDTO
|
||||
*/
|
||||
ElectromagneticResult<?> updateFileInfo(UpdateFileInfoDTO updateFileInfoDTO);
|
||||
ElectromagneticResult<?> updateFileInfo(UpdateFileInfoDTO updateFileInfoDTO, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 版本回退
|
||||
|
|
@ -75,7 +79,7 @@ public interface EdFileInfoService {
|
|||
* @param fileChunkDTO
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO);
|
||||
ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 批量导入
|
||||
|
|
@ -83,7 +87,7 @@ public interface EdFileInfoService {
|
|||
* @param fileChunkDTO
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO);
|
||||
ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 合并分片
|
||||
|
|
@ -93,7 +97,7 @@ public interface EdFileInfoService {
|
|||
* @param totalChunks
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> mergeChunks(String identifier, String fileName, Integer totalChunks);
|
||||
ElectromagneticResult<?> mergeChunks(String identifier, String fileName, Integer totalChunks, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
|
|
@ -101,7 +105,7 @@ public interface EdFileInfoService {
|
|||
* @param dataIdArr
|
||||
* @return
|
||||
*/
|
||||
ResponseEntity<InputStreamResource> batchExport(String dataIdArr, HttpServletResponse response) throws IOException;
|
||||
ResponseEntity<InputStreamResource> batchExport(String dataIdArr, HttpServletResponse response, int dataOwnCode) throws IOException;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
|
|
@ -111,7 +115,7 @@ public interface EdFileInfoService {
|
|||
* @param strategy
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> upload(String parentId, MultipartFile file, Integer strategy);
|
||||
ElectromagneticResult<?> upload(String parentId, MultipartFile file, Integer strategy, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 版本查看
|
||||
|
|
@ -128,7 +132,7 @@ public interface EdFileInfoService {
|
|||
* @param targetFolderId
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> moveFile(String id, String targetFolderId, Integer strategy);
|
||||
ElectromagneticResult<?> moveFile(String id, String targetFolderId, Integer strategy, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 复制文件
|
||||
|
|
@ -137,14 +141,14 @@ public interface EdFileInfoService {
|
|||
* @param targetFolderId
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> copyFile(String id, String targetFolderId, Integer strategy);
|
||||
ElectromagneticResult<?> copyFile(String id, String targetFolderId, Integer strategy, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 发布管理
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize);
|
||||
ElectromagneticResult<?> uploadRecord(int pageNum, int pageSize, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 查询文件详情
|
||||
|
|
@ -157,18 +161,86 @@ public interface EdFileInfoService {
|
|||
/**
|
||||
* 获取文件的层级Id
|
||||
*/
|
||||
String getCategoryId (String id);
|
||||
String getCategoryId(String id);
|
||||
|
||||
/**
|
||||
* 根据父id查询其下自定义的文件夹
|
||||
*
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> queryChildFolder(String parentId);
|
||||
|
||||
ElectromagneticResult<?> queryChildFolder(String parentId, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 文件预览
|
||||
*
|
||||
* @param id
|
||||
* @param response
|
||||
*/
|
||||
ResponseEntity<InputStreamResource> preview(String id, HttpServletResponse response, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 收藏页 数据查询
|
||||
*
|
||||
* @param page
|
||||
* @param ids
|
||||
* @param queryDTO
|
||||
* @return
|
||||
*/
|
||||
IPage<FileInfoVO> queryFileList(Page<FileInfoVO> page, List<String> ids, FileInfoQueryDTO queryDTO, int saveStatus, int effectFlag);
|
||||
|
||||
/**
|
||||
* 处理重名文件,文件名后+_1
|
||||
*
|
||||
* @param fileInfo
|
||||
*/
|
||||
void resetFileInfoName(EdFileInfo fileInfo);
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
*
|
||||
* @param userId
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
boolean addFavorite(String userId, String fileId);
|
||||
|
||||
/**
|
||||
* 判断是否已收藏
|
||||
*
|
||||
* @param userId
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
boolean isFavorite(String userId, String fileId);
|
||||
|
||||
/**
|
||||
* 移除收藏
|
||||
*
|
||||
* @param userId
|
||||
* @param fileId
|
||||
* @return
|
||||
*/
|
||||
boolean removeFavorite(String userId, String fileId);
|
||||
|
||||
/**
|
||||
* 查询当前用户收藏文件信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param fileInfoQueryDTO 分页信息
|
||||
* @return
|
||||
*/
|
||||
IPage<FileInfoVO> findFavorite(String userId, FileInfoQueryDTO fileInfoQueryDTO);
|
||||
|
||||
/**
|
||||
* 文件上传并建立关系
|
||||
*
|
||||
* @param parentId
|
||||
* @param id 主文件Id
|
||||
* @param file
|
||||
* @param desc 关系描述
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> uploadFileAndRelation(String parentId, String id, MultipartFile file, String desc, int dataOwnCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.CheckNameUniqueRequest;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileRelationViewVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public interface EdFileRelationService {
|
||||
public interface EdFileRelationService extends IService<EdFileRelation> {
|
||||
|
||||
/**
|
||||
* 创建文件关系
|
||||
|
|
@ -40,13 +39,11 @@ public interface EdFileRelationService {
|
|||
Boolean checkNameExist(CheckNameUniqueRequest checkNameUniqueRequest);
|
||||
|
||||
/**
|
||||
* 文件上传并建立关系
|
||||
* 逻辑删除文件关系
|
||||
*
|
||||
* @param parentId
|
||||
* @param id 主文件Id
|
||||
* @param file
|
||||
* @param descrption 关系描述
|
||||
* @param fileId 文件主键id
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> uploadFileAndRelation(String parentId, String id, MultipartFile file, String descrption);
|
||||
boolean logicRemove(String fileId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public interface EdPrjService {
|
|||
*
|
||||
* @param prjName 新的工程名
|
||||
*/
|
||||
ElectromagneticResult<?> createNewPrj(String prjName);
|
||||
ElectromagneticResult<?> createNewPrj(String prjName, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 修改项目名称
|
||||
|
|
@ -22,7 +22,7 @@ public interface EdPrjService {
|
|||
* @param newPrjName
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> modifyPrjName(String prjId, String newPrjName);
|
||||
ElectromagneticResult<?> modifyPrjName(String prjId, String newPrjName, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 删除一个项目,做逻辑删除
|
||||
|
|
@ -30,7 +30,7 @@ public interface EdPrjService {
|
|||
* @param prjId
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> delete(String prjId);
|
||||
ElectromagneticResult<?> delete(String prjId, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 添加子集
|
||||
|
|
@ -39,14 +39,14 @@ public interface EdPrjService {
|
|||
* @param folderName
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> addFolder(String parentId, String folderName);
|
||||
ElectromagneticResult<?> addFolder(String parentId, String folderName, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 查询所有项目
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> queryAllPrjInfo();
|
||||
ElectromagneticResult<?> queryAllPrjInfo(int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 子集拖拽重排序
|
||||
|
|
@ -62,7 +62,7 @@ public interface EdPrjService {
|
|||
* @param prjId
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> publish(String prjId);
|
||||
ElectromagneticResult<?> publish(String prjId, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 删除子集
|
||||
|
|
@ -70,7 +70,7 @@ public interface EdPrjService {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> deleteFolder(String id);
|
||||
ElectromagneticResult<?> deleteFolder(String id, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 层级沿用
|
||||
|
|
@ -79,7 +79,7 @@ public interface EdPrjService {
|
|||
* @param targetId
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> follow(String sourceId, String targetId);
|
||||
ElectromagneticResult<?> follow(String sourceId, String targetId, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 修改子集名称
|
||||
|
|
@ -88,7 +88,7 @@ public interface EdPrjService {
|
|||
* @param newFolderName
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> modifyFolder(String id, String newFolderName);
|
||||
ElectromagneticResult<?> modifyFolder(String id, String newFolderName, int dataOwnCode);
|
||||
|
||||
/**
|
||||
* 获取项目的发布状态
|
||||
|
|
@ -96,5 +96,5 @@ public interface EdPrjService {
|
|||
* @param queryPublishStatus
|
||||
* @return
|
||||
*/
|
||||
ElectromagneticResult<?> publishStatus(QueryPublishStatus queryPublishStatus);
|
||||
ElectromagneticResult<?> publishStatus(QueryPublishStatus queryPublishStatus, int dataOwnCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.common.pojo.TreeNode;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EdTagLibraryService extends IService<EdTagLibrary> {
|
||||
|
||||
/**
|
||||
* 新建分组
|
||||
*
|
||||
* @param tagName
|
||||
* @param createdBy
|
||||
*/
|
||||
Boolean createTagGroup(String tagName, String createdBy);
|
||||
|
||||
/**
|
||||
* 新建标签
|
||||
*
|
||||
* @param parentId
|
||||
* @param tagName
|
||||
* @param createdBy
|
||||
*/
|
||||
Boolean createTag(String parentId, String tagName, String createdBy);
|
||||
|
||||
/**
|
||||
* 拖拽标签顺序
|
||||
*
|
||||
* @param tagId
|
||||
* @param newOrderBy
|
||||
*/
|
||||
Boolean updateTagOrder(String tagId, String newTagId, String newParentId, Integer newOrderBy, String updatedBy);
|
||||
|
||||
/**
|
||||
* 发布标签
|
||||
*
|
||||
* @param tagGroupIds
|
||||
*/
|
||||
Boolean batchPublishTagGroups(List<String> tagGroupIds);
|
||||
|
||||
/**
|
||||
* 废除标签
|
||||
*
|
||||
* @param tagId
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteTagOrGroup(String tagId);
|
||||
|
||||
/**
|
||||
* 标签数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<TagListVO> listTagsWithGroups();
|
||||
|
||||
/**
|
||||
* 更新标签信息
|
||||
*
|
||||
* @param tagId
|
||||
* @param tagName
|
||||
* @return 更新结果
|
||||
*/
|
||||
Boolean updateTagInfo(String tagId, String tagName, String updatedBy);
|
||||
|
||||
/**
|
||||
* 构建标签树
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<TreeNode> listTagTree();
|
||||
|
||||
/**
|
||||
* 获取所有标签
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FileTagInfo> listAllTags();
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
|
||||
public interface FileBackLogService {
|
||||
|
||||
ElectromagneticResult<?> query(Integer pageNumber, Integer pageSize);
|
||||
|
||||
Long restore();
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.FileFormat;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileFormatVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FileFormatService extends IService<FileFormat> {
|
||||
|
||||
/**
|
||||
* 创建文件格式
|
||||
*
|
||||
* @param suffixName
|
||||
* @return
|
||||
*/
|
||||
boolean addFileFormat(String suffixName);
|
||||
|
||||
/**
|
||||
* 删除文件格式
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean deleteFileFormat(String id);
|
||||
|
||||
/**
|
||||
* 查询文件格式列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<FileFormatVO> getList();
|
||||
|
||||
/**
|
||||
* 更新文件格式
|
||||
*
|
||||
* @param fileFormat
|
||||
* @return
|
||||
*/
|
||||
boolean updateFileFormat(FileFormat fileFormat);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.manage.pojo.req.RecycleFileQueryDTO;
|
||||
|
||||
public interface FileRecycleService {
|
||||
|
||||
ElectromagneticResult<?> list(RecycleFileQueryDTO queryDTO);
|
||||
|
||||
ElectromagneticResult<?> remove(String fileId);
|
||||
|
||||
ElectromagneticResult<?> recover(String fileId);
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue