重构
This commit is contained in:
44
pom.xml
44
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
<artifactId>smart</artifactId>
|
<artifactId>smart</artifactId>
|
||||||
<version>3.8.9</version>
|
<version>3.8.9</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<!-- <packaging>war</packaging>-->
|
<!-- <packaging>war</packaging>-->
|
||||||
|
|
||||||
<name>zg</name>
|
<name>zg</name>
|
||||||
<url>http://www.zg.vip</url>
|
<url>http://www.zg.vip</url>
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
|
||||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
<pagehelper.spring.boot.starter.version>1.4.7</pagehelper.spring.boot.starter.version>
|
<pagehelper.spring.boot.starter.version>1.4.7</pagehelper.spring.boot.starter.version>
|
||||||
<fastjson.version>2.0.53</fastjson.version>
|
<fastjson.version>2.0.53</fastjson.version>
|
||||||
@@ -34,7 +37,8 @@
|
|||||||
<kaptcha.version>2.3.3</kaptcha.version>
|
<kaptcha.version>2.3.3</kaptcha.version>
|
||||||
<swagger.version>3.0.0</swagger.version>
|
<swagger.version>3.0.0</swagger.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<oshi.version>6.6.5</oshi.version>
|
<!-- OSHI 6.x 需要 JDK11,这里固定为 JDK8 可用的 5.8.5 -->
|
||||||
|
<oshi.version>5.8.5</oshi.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<!-- override dependency version -->
|
<!-- override dependency version -->
|
||||||
<tomcat.version>9.0.102</tomcat.version>
|
<tomcat.version>9.0.102</tomcat.version>
|
||||||
@@ -82,11 +86,13 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- spring-boot-devtools -->
|
<!-- spring-boot-devtools -->
|
||||||
<!-- <dependency>-->
|
<!--
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
<dependency>
|
||||||
<!-- <artifactId>spring-boot-devtools</artifactId>-->
|
<groupId>org.springframework.boot</groupId>
|
||||||
<!-- <optional>true</optional> <!– 表示依赖不会传递 –>-->
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<!-- </dependency>-->
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- spring security 安全认证 -->
|
<!-- spring security 安全认证 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -218,6 +224,7 @@
|
|||||||
<artifactId>poi-ooxml</artifactId>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
<version>${poi.version}</version>
|
<version>${poi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--MinIo-->
|
<!--MinIo-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.minio</groupId>
|
<groupId>io.minio</groupId>
|
||||||
@@ -274,21 +281,6 @@
|
|||||||
<artifactId>ZMPrinter</artifactId>
|
<artifactId>ZMPrinter</artifactId>
|
||||||
<version>4.4.7</version>
|
<version>4.4.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.zkweix</groupId>-->
|
|
||||||
<!-- <artifactId>RFIDReaderAPI</artifactId>-->
|
|
||||||
<!-- <version>1.0.0</version>-->
|
|
||||||
<!-- <scope>system</scope>-->
|
|
||||||
<!-- <systemPath>${project.basedir}/libs/RFIDReaderAPI.jar</systemPath>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>com.zmtech</groupId>-->
|
|
||||||
<!-- <artifactId>ZMPrinter</artifactId>-->
|
|
||||||
<!-- <version>4.4.7</version>-->
|
|
||||||
<!-- <scope>system</scope>-->
|
|
||||||
<!-- <systemPath>${project.basedir}/libs/ZMPrinter.jar</systemPath>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
@@ -307,12 +299,16 @@
|
|||||||
<mainClass>com.zg.SmartApplication</mainClass>
|
<mainClass>com.zg.SmartApplication</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<!-- 关键:固定编译插件版本,并指定 JDK8 的 source/target -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>9</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>9</target>
|
<target>${maven.compiler.target}</target>
|
||||||
|
<!-- JDK8 环境不要配置 <release> -->
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class SecurityConfig
|
|||||||
"/captchaImage",
|
"/captchaImage",
|
||||||
"/user/**",
|
"/user/**",
|
||||||
"/stat/**",
|
"/stat/**",
|
||||||
"/query/jh/**",
|
// "/query/jh/**",
|
||||||
"/wisdom/signature/**",
|
"/wisdom/signature/**",
|
||||||
"/system/config/**",
|
"/system/config/**",
|
||||||
"/AutoInventory/**",
|
"/AutoInventory/**",
|
||||||
@@ -124,12 +124,10 @@ public class SecurityConfig
|
|||||||
"/photo/**",
|
"/photo/**",
|
||||||
"/wisdom/stock/**",
|
"/wisdom/stock/**",
|
||||||
"/system/media/**",
|
"/system/media/**",
|
||||||
"/wisdom/**",
|
|
||||||
"/mock/**",
|
"/mock/**",
|
||||||
"/information/device/**",
|
"/information/device/**",
|
||||||
"/MatchScan/**",
|
"/MatchScan/**",
|
||||||
"/wisdom/task/**",
|
"/wisdom/task/**",
|
||||||
// "/wisdom/stock/**",
|
|
||||||
// "/information/materialtype/**",
|
// "/information/materialtype/**",
|
||||||
// "/information/warehousingtype/**",
|
// "/information/warehousingtype/**",
|
||||||
// "/information/warehouseinfo/**",
|
// "/information/warehouseinfo/**",
|
||||||
|
|||||||
@@ -1,252 +1,3 @@
|
|||||||
//package com.zg.project.wisdom.controller;
|
|
||||||
//
|
|
||||||
//import com.zg.framework.web.domain.AjaxResult;
|
|
||||||
//import org.apache.commons.lang3.StringUtils;
|
|
||||||
//import org.springframework.http.MediaType;
|
|
||||||
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
//import org.springframework.util.unit.DataSize;
|
|
||||||
//import org.springframework.web.bind.annotation.*;
|
|
||||||
//import org.springframework.web.multipart.MultipartFile;
|
|
||||||
//
|
|
||||||
//import javax.annotation.Resource;
|
|
||||||
//import java.io.IOException;
|
|
||||||
//import java.io.InputStream;
|
|
||||||
//import java.io.OutputStream;
|
|
||||||
//import java.nio.file.*;
|
|
||||||
//import java.util.*;
|
|
||||||
//import java.util.concurrent.CompletableFuture;
|
|
||||||
//import java.util.concurrent.Semaphore;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 多媒体上传控制器(支持图片与视频并行落盘)
|
|
||||||
// */
|
|
||||||
//@RestController
|
|
||||||
//@RequestMapping("/system/media")
|
|
||||||
//public class MediaUploadController {
|
|
||||||
//
|
|
||||||
// /** 根目录(如需配置化,可改为从 application.yml 读取) */
|
|
||||||
// private static final Path ROOT_DIR = Paths.get("D:/uploads");
|
|
||||||
//
|
|
||||||
// /** 本次上传总大小限制:100MB */
|
|
||||||
// private static final long MAX_TOTAL_BYTES = DataSize.ofMegabytes(100).toBytes();
|
|
||||||
//
|
|
||||||
// /** 图片/视频数量限制 */
|
|
||||||
// private static final int MAX_IMAGE_COUNT = 100;
|
|
||||||
// private static final int MAX_VIDEO_COUNT = 5;
|
|
||||||
//
|
|
||||||
// /** 单次请求内的并发上限(建议 2~4;默认 4) */
|
|
||||||
// private static final int PER_REQUEST_CONCURRENCY = 4;
|
|
||||||
//
|
|
||||||
// /** 注入线程池 Bean:threadPoolTaskExecutor */
|
|
||||||
// @Resource(name = "threadPoolTaskExecutor")
|
|
||||||
// private ThreadPoolTaskExecutor executor;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 上传接口
|
|
||||||
// */
|
|
||||||
// @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
||||||
// public AjaxResult upload(
|
|
||||||
// @RequestParam("username") String username,
|
|
||||||
// @RequestParam("nameBase") String nameBase,
|
|
||||||
// @RequestParam(value = "imageNames", required = false) String imageNames,
|
|
||||||
// @RequestParam(value = "videoNames", required = false) String videoNames,
|
|
||||||
// @RequestPart(value = "images", required = false) MultipartFile[] images,
|
|
||||||
// @RequestPart(value = "videos", required = false) MultipartFile[] videos
|
|
||||||
// ) {
|
|
||||||
// try {
|
|
||||||
// // 1. 基础校验
|
|
||||||
// if (StringUtils.isBlank(username)) {
|
|
||||||
// return AjaxResult.error("username 不能为空");
|
|
||||||
// }
|
|
||||||
// if (StringUtils.isBlank(nameBase)) {
|
|
||||||
// return AjaxResult.error("nameBase(命名信息)不能为空");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// int imageCount = images == null ? 0 : images.length;
|
|
||||||
// int videoCount = videos == null ? 0 : videos.length;
|
|
||||||
//
|
|
||||||
// if (imageCount == 0 && videoCount == 0) {
|
|
||||||
// return AjaxResult.error("请至少上传一张图片或一段视频");
|
|
||||||
// }
|
|
||||||
// if (imageCount > MAX_IMAGE_COUNT) {
|
|
||||||
// return AjaxResult.error("图片最多支持上传 " + MAX_IMAGE_COUNT + " 张");
|
|
||||||
// }
|
|
||||||
// if (videoCount > MAX_VIDEO_COUNT) {
|
|
||||||
// return AjaxResult.error("视频最多支持上传 " + MAX_VIDEO_COUNT + " 段");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 2. 总体积校验
|
|
||||||
// long totalBytes = 0L;
|
|
||||||
// if (images != null) for (MultipartFile f : images) totalBytes += safeSize(f);
|
|
||||||
// if (videos != null) for (MultipartFile f : videos) totalBytes += safeSize(f);
|
|
||||||
// if (totalBytes > MAX_TOTAL_BYTES) {
|
|
||||||
// return AjaxResult.error("本次上传总大小超过 100 MB(约 " + (totalBytes / 1024 / 1024) + " MB)");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 3. 目标目录
|
|
||||||
// String base = sanitize(nameBase);
|
|
||||||
// String user = sanitize(username);
|
|
||||||
// String folderName = base + "_" + user;
|
|
||||||
// Path targetDir = ROOT_DIR.resolve(folderName).normalize();
|
|
||||||
// if (!targetDir.startsWith(ROOT_DIR)) {
|
|
||||||
// return AjaxResult.error("非法路径");
|
|
||||||
// }
|
|
||||||
// Files.createDirectories(targetDir);
|
|
||||||
//
|
|
||||||
// // 4. 解析前端传递的文件名
|
|
||||||
// List<String> imageNameList = new ArrayList<>();
|
|
||||||
// List<String> videoNameList = new ArrayList<>();
|
|
||||||
//
|
|
||||||
// if (StringUtils.isNotBlank(imageNames)) {
|
|
||||||
// try {
|
|
||||||
// imageNameList = Arrays.asList(imageNames.split(","));
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 如果解析失败,使用空列表
|
|
||||||
// imageNameList = new ArrayList<>();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (StringUtils.isNotBlank(videoNames)) {
|
|
||||||
// try {
|
|
||||||
// videoNameList = Arrays.asList(videoNames.split(","));
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // 如果解析失败,使用空列表
|
|
||||||
// videoNameList = new ArrayList<>();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 5. 并发落盘任务
|
|
||||||
// int seq = 1;
|
|
||||||
// List<CompletableFuture<Map<String, Object>>> futures = new ArrayList<>();
|
|
||||||
// Semaphore semaphore = new Semaphore(PER_REQUEST_CONCURRENCY);
|
|
||||||
//
|
|
||||||
// // 5.1 图片处理
|
|
||||||
// if (images != null) {
|
|
||||||
// for (int i = 0; i < images.length; i++) {
|
|
||||||
// MultipartFile img = images[i];
|
|
||||||
// if (img == null || img.isEmpty()) continue;
|
|
||||||
//
|
|
||||||
// // 使用前端传递的文件名,如果没有则从原始文件名获取扩展名
|
|
||||||
// String originalName = i < imageNameList.size() ? imageNameList.get(i) : img.getOriginalFilename();
|
|
||||||
// String ext = getExtension(originalName).toLowerCase(Locale.ROOT);
|
|
||||||
// if (StringUtils.isBlank(ext)) {
|
|
||||||
// ext = "jpg"; // 图片默认扩展名
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final String filename = String.format("%s%s%03d.%s", base, user, seq++, ext);
|
|
||||||
// final Path dest = targetDir.resolve(filename).normalize();
|
|
||||||
//
|
|
||||||
// futures.add(CompletableFuture.supplyAsync(() -> {
|
|
||||||
// acquire(semaphore);
|
|
||||||
// try { return saveOne(img, dest, "image"); }
|
|
||||||
// finally { semaphore.release(); }
|
|
||||||
// }, executor));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 5.2 视频处理
|
|
||||||
// if (videos != null) {
|
|
||||||
// for (int i = 0; i < videos.length; i++) {
|
|
||||||
// MultipartFile vid = videos[i];
|
|
||||||
// if (vid == null || vid.isEmpty()) continue;
|
|
||||||
//
|
|
||||||
// // 使用前端传递的文件名,如果没有则从原始文件名获取扩展名
|
|
||||||
// String originalName = i < videoNameList.size() ? videoNameList.get(i) : vid.getOriginalFilename();
|
|
||||||
// String ext = getExtension(originalName).toLowerCase(Locale.ROOT);
|
|
||||||
// if (StringUtils.isBlank(ext)) {
|
|
||||||
// ext = "mp4"; // 视频默认扩展名
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final String filename = String.format("%s%s%03d.%s", base, user, seq++, ext);
|
|
||||||
// final Path dest = targetDir.resolve(filename).normalize();
|
|
||||||
//
|
|
||||||
// futures.add(CompletableFuture.supplyAsync(() -> {
|
|
||||||
// acquire(semaphore);
|
|
||||||
// try { return saveOne(vid, dest, "video"); }
|
|
||||||
// finally { semaphore.release(); }
|
|
||||||
// }, executor));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 6. 等待完成并返回
|
|
||||||
// List<Map<String, Object>> files = new ArrayList<>(futures.size());
|
|
||||||
// for (CompletableFuture<Map<String, Object>> f : futures) {
|
|
||||||
// files.add(f.join());
|
|
||||||
// }
|
|
||||||
// files.sort(Comparator.comparing(m -> String.valueOf(m.get("path"))));
|
|
||||||
//
|
|
||||||
// Map<String, Object> data = new LinkedHashMap<>();
|
|
||||||
// data.put("folder", targetDir.toString());
|
|
||||||
// data.put("username", username);
|
|
||||||
// data.put("nameBase", nameBase);
|
|
||||||
// data.put("totalBytes", totalBytes);
|
|
||||||
// data.put("count", files.size());
|
|
||||||
// data.put("files", files);
|
|
||||||
//
|
|
||||||
// return AjaxResult.success("上传成功", data);
|
|
||||||
//
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// return AjaxResult.error("保存文件失败:" + e.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // ========================= 辅助方法 =========================
|
|
||||||
//
|
|
||||||
// /** 安全获取文件大小,避免 NPE */
|
|
||||||
// private static long safeSize(MultipartFile f) {
|
|
||||||
// try { return (f == null) ? 0L : f.getSize(); }
|
|
||||||
// catch (Exception ignored) { return 0L; }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /** 获取扩展名(无则返回空字符串) */
|
|
||||||
// private static String getExtension(String originalName) {
|
|
||||||
// if (StringUtils.isBlank(originalName)) return "";
|
|
||||||
// int i = originalName.lastIndexOf('.');
|
|
||||||
// return (i >= 0 && i < originalName.length() - 1) ? originalName.substring(i + 1) : "";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /** 单文件保存 */
|
|
||||||
// private Map<String, Object> saveOne(MultipartFile src, Path dest, String type) {
|
|
||||||
// try {
|
|
||||||
// Path parent = dest.getParent();
|
|
||||||
// if (parent == null) throw new IOException("父目录为空");
|
|
||||||
// if (!dest.normalize().startsWith(parent.normalize())) throw new IOException("非法路径");
|
|
||||||
//
|
|
||||||
// try (InputStream in = src.getInputStream();
|
|
||||||
// OutputStream out = Files.newOutputStream(dest,
|
|
||||||
// StandardOpenOption.CREATE,
|
|
||||||
// StandardOpenOption.TRUNCATE_EXISTING,
|
|
||||||
// StandardOpenOption.WRITE)) {
|
|
||||||
// in.transferTo(out);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Map<String, Object> m = new LinkedHashMap<>();
|
|
||||||
// m.put("type", type);
|
|
||||||
// m.put("path", dest.toString());
|
|
||||||
// m.put("sizeBytes", src.getSize());
|
|
||||||
// m.put("sizeMB", String.format(Locale.ROOT, "%.2f", src.getSize() / 1024.0 / 1024.0));
|
|
||||||
// return m;
|
|
||||||
//
|
|
||||||
// } catch (Exception ex) {
|
|
||||||
// throw new RuntimeException("保存失败:" + dest.getFileName() + ",原因:" + ex.getMessage(), ex);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /** 获取信号量许可证(受控并发) */
|
|
||||||
// private static void acquire(Semaphore sem) {
|
|
||||||
// try { sem.acquire(); }
|
|
||||||
// catch (InterruptedException e) {
|
|
||||||
// Thread.currentThread().interrupt();
|
|
||||||
// throw new RuntimeException("线程被中断", e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /** 文件名/目录名清洗 */
|
|
||||||
// private static String sanitize(String s) {
|
|
||||||
// String cleaned = s.replaceAll("[^\\p{L}\\p{N}_-]", "_");
|
|
||||||
// return cleaned.length() > 64 ? cleaned.substring(0, 64) : cleaned;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
package com.zg.project.wisdom.controller;
|
package com.zg.project.wisdom.controller;
|
||||||
|
|
||||||
import com.zg.framework.web.domain.AjaxResult;
|
import com.zg.framework.web.domain.AjaxResult;
|
||||||
@@ -260,8 +11,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
@@ -345,7 +96,7 @@ public class MediaUploadController {
|
|||||||
List<CompletableFuture<Map<String, Object>>> futures = new ArrayList<>();
|
List<CompletableFuture<Map<String, Object>>> futures = new ArrayList<>();
|
||||||
Semaphore semaphore = new Semaphore(PER_REQUEST_CONCURRENCY);
|
Semaphore semaphore = new Semaphore(PER_REQUEST_CONCURRENCY);
|
||||||
|
|
||||||
// 4.1 图片(不做格式校验)
|
// 4.1 图片
|
||||||
if (images != null) {
|
if (images != null) {
|
||||||
for (MultipartFile img : images) {
|
for (MultipartFile img : images) {
|
||||||
if (img == null || img.isEmpty()) continue;
|
if (img == null || img.isEmpty()) continue;
|
||||||
@@ -364,7 +115,7 @@ public class MediaUploadController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4.2 视频(不做格式校验)
|
// 4.2 视频
|
||||||
if (videos != null) {
|
if (videos != null) {
|
||||||
for (MultipartFile vid : videos) {
|
for (MultipartFile vid : videos) {
|
||||||
if (vid == null || vid.isEmpty()) continue;
|
if (vid == null || vid.isEmpty()) continue;
|
||||||
@@ -420,19 +171,15 @@ public class MediaUploadController {
|
|||||||
return (i >= 0 && i < originalName.length() - 1) ? originalName.substring(i + 1) : "";
|
return (i >= 0 && i < originalName.length() - 1) ? originalName.substring(i + 1) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 单文件保存 */
|
/** 单文件保存(JDK8 兼容实现) */
|
||||||
private Map<String, Object> saveOne(MultipartFile src, Path dest, String type) {
|
private Map<String, Object> saveOne(MultipartFile src, Path dest, String type) {
|
||||||
try {
|
try {
|
||||||
Path parent = dest.getParent();
|
Path parent = dest.getParent();
|
||||||
if (parent == null) throw new IOException("父目录为空");
|
if (parent == null) throw new IOException("父目录为空");
|
||||||
if (!dest.normalize().startsWith(parent.normalize())) throw new IOException("非法路径");
|
if (!dest.normalize().startsWith(parent.normalize())) throw new IOException("非法路径");
|
||||||
|
|
||||||
try (InputStream in = src.getInputStream();
|
try (InputStream in = src.getInputStream()) {
|
||||||
OutputStream out = Files.newOutputStream(dest,
|
Files.copy(in, dest, StandardCopyOption.REPLACE_EXISTING);
|
||||||
StandardOpenOption.CREATE,
|
|
||||||
StandardOpenOption.TRUNCATE_EXISTING,
|
|
||||||
StandardOpenOption.WRITE)) {
|
|
||||||
in.transferTo(out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> m = new LinkedHashMap<>();
|
Map<String, Object> m = new LinkedHashMap<>();
|
||||||
|
|||||||
@@ -221,4 +221,15 @@ public class RkInfoController extends BaseController
|
|||||||
return toAjax(rkInfoService.refundMaterial(dto));
|
return toAjax(rkInfoService.refundMaterial(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配送出库单据查询
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "配送出库单据查询", businessType = BusinessType.OTHER)
|
||||||
|
@GetMapping("/delivery")
|
||||||
|
public AjaxResult listAllForDelivery(RkInfo query) {
|
||||||
|
List<RkInfo> list = rkInfoService.selectDeliveryAll(query);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ public class RkInfo extends BaseEntity
|
|||||||
@Excel(name = "出库单据号")
|
@Excel(name = "出库单据号")
|
||||||
private String billNoCk;
|
private String billNoCk;
|
||||||
|
|
||||||
|
/** 是否需要配送(0否 1是) */
|
||||||
|
@Excel(name = "是否需要配送", readConverterExp = "0=否,1=是")
|
||||||
|
private String isDelivery;
|
||||||
|
|
||||||
/** 县局 */
|
/** 县局 */
|
||||||
@Excel(name = "县局")
|
@Excel(name = "县局")
|
||||||
private String xj;
|
private String xj;
|
||||||
@@ -472,6 +476,15 @@ public class RkInfo extends BaseEntity
|
|||||||
public String getIsDelete() { return isDelete; }
|
public String getIsDelete() { return isDelete; }
|
||||||
public void setIsDelete(String isDelete) { this.isDelete = isDelete; }
|
public void setIsDelete(String isDelete) { this.isDelete = isDelete; }
|
||||||
|
|
||||||
|
|
||||||
|
public String getIsDelivery() {
|
||||||
|
return isDelivery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDelivery(String isDelivery) {
|
||||||
|
this.isDelivery = isDelivery;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@@ -488,6 +501,7 @@ public class RkInfo extends BaseEntity
|
|||||||
.append("isChuku", getIsChuku())
|
.append("isChuku", getIsChuku())
|
||||||
.append("billNo", getBillNo())
|
.append("billNo", getBillNo())
|
||||||
.append("billNoCk", getBillNoCk())
|
.append("billNoCk", getBillNoCk())
|
||||||
|
.append("isDelivery", getBillNoCk())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("xj", getXj())
|
.append("xj", getXj())
|
||||||
.append("xmNo", getXmNo())
|
.append("xmNo", getXmNo())
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class StockOutDTO {
|
|||||||
/** 借用时间 */
|
/** 借用时间 */
|
||||||
private Date borrowTime;
|
private Date borrowTime;
|
||||||
|
|
||||||
|
/** 是否需要配送(0否 1是) */
|
||||||
|
private String isDelivery;
|
||||||
|
|
||||||
/** 归还时间 */
|
/** 归还时间 */
|
||||||
private Date returnTime;
|
private Date returnTime;
|
||||||
|
|
||||||
|
|||||||
@@ -222,4 +222,10 @@ public interface RkInfoMapper
|
|||||||
|
|
||||||
List<RkInfo> listRkInfoByPcode(String pcode);
|
List<RkInfo> listRkInfoByPcode(String pcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需要配送的出库单
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RkInfo> selectDeliveryAll(RkInfo query);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,4 +155,10 @@ public interface IRkInfoService
|
|||||||
*/
|
*/
|
||||||
List<RkInfo> listRkInfoByPcode(String pcode);
|
List<RkInfo> listRkInfoByPcode(String pcode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需要配送的出库列表
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RkInfo> selectDeliveryAll(RkInfo query);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -661,6 +661,7 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
RkInfo update = new RkInfo();
|
RkInfo update = new RkInfo();
|
||||||
update.setId(item.getId());
|
update.setId(item.getId());
|
||||||
update.setBillNoCk(billNo);
|
update.setBillNoCk(billNo);
|
||||||
|
update.setIsDelivery(dto.getIsDelivery());
|
||||||
update.setCkType(dto.getCkType());
|
update.setCkType(dto.getCkType());
|
||||||
update.setTeamCode(dto.getTeamCode());
|
update.setTeamCode(dto.getTeamCode());
|
||||||
update.setLyTime(now);
|
update.setLyTime(now);
|
||||||
@@ -983,4 +984,13 @@ public class RkInfoServiceImpl implements IRkInfoService
|
|||||||
return rkInfoMapper.listRkInfoByPcode(pcode);
|
return rkInfoMapper.listRkInfoByPcode(pcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取需要配送的出库列表
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RkInfo> selectDeliveryAll(RkInfo query) {
|
||||||
|
return rkInfoMapper.selectDeliveryAll(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,21 @@ public class RkStatisticsServiceImpl implements RkStatisticsService {
|
|||||||
RkAgeStatVO vo = rkStatisticsMapper.selectAgeStats();
|
RkAgeStatVO vo = rkStatisticsMapper.selectAgeStats();
|
||||||
|
|
||||||
List<Map<String, Object>> list = new ArrayList<>(3);
|
List<Map<String, Object>> list = new ArrayList<>(3);
|
||||||
list.add(Map.of("name", ">10天", "value", vo.getGt10()));
|
Map<String, Object> m1 = new HashMap<>();
|
||||||
list.add(Map.of("name", ">20天", "value", vo.getGt20()));
|
m1.put("name", ">10天");
|
||||||
list.add(Map.of("name", ">30天", "value", vo.getGt30()));
|
m1.put("value", vo.getGt10());
|
||||||
|
list.add(m1);
|
||||||
|
|
||||||
|
Map<String, Object> m2 = new HashMap<>();
|
||||||
|
m2.put("name", ">20天");
|
||||||
|
m2.put("value", vo.getGt20());
|
||||||
|
list.add(m2);
|
||||||
|
|
||||||
|
Map<String, Object> m3 = new HashMap<>();
|
||||||
|
m3.put("name", ">30天");
|
||||||
|
m3.put("value", vo.getGt30());
|
||||||
|
list.add(m3);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ spring:
|
|||||||
master:
|
master:
|
||||||
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://101.132.133.142:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
# url: jdbc:mysql://192.168.1.192:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://192.168.1.251:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="isDelete" column="is_delete" />
|
<result property="isDelete" column="is_delete" />
|
||||||
<result property="hasMoved" column="has_moved"/>
|
<result property="hasMoved" column="has_moved"/>
|
||||||
<result property="lihuoYName" column="lihuo_y_name"/>
|
<result property="lihuoYName" column="lihuo_y_name"/>
|
||||||
|
<result property="isDelivery" column="is_delivery"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectRkInfoVo">
|
<sql id="selectRkInfoVo">
|
||||||
@@ -67,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ri.rk_type, st.type_name AS rk_type_name,
|
ri.rk_type, st.type_name AS rk_type_name,
|
||||||
ri.wl_type, mt.type_name AS wl_type_name,
|
ri.wl_type, mt.type_name AS wl_type_name,
|
||||||
ri.cangku, wh.warehouse_name AS cangku_name,
|
ri.cangku, wh.warehouse_name AS cangku_name,
|
||||||
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.remark,
|
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed, ri.is_delivery,ri.remark,
|
||||||
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
|
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
|
||||||
ri.team_code, ct.team_name,
|
ri.team_code, ct.team_name,
|
||||||
ri.ck_remark,
|
ri.ck_remark,
|
||||||
@@ -818,6 +819,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
|
<if test="isBorrowed != null">is_borrowed = #{isBorrowed},</if>
|
||||||
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
|
<if test="billNoCk != null">bill_no_ck = #{billNoCk},</if>
|
||||||
<if test="ckType != null">ck_type = #{ckType},</if>
|
<if test="ckType != null">ck_type = #{ckType},</if>
|
||||||
|
<if test="isDelivery != null">is_delivery = #{isDelivery},</if>
|
||||||
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
|
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
|
||||||
<if test="teamCode != null">team_code = #{teamCode},</if>
|
<if test="teamCode != null">team_code = #{teamCode},</if>
|
||||||
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
|
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
|
||||||
@@ -897,5 +899,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ORDER BY t.rk_time DESC, t.id DESC
|
ORDER BY t.rk_time DESC, t.id DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeliveryAll"
|
||||||
|
parameterType="com.zg.project.wisdom.domain.RkInfo"
|
||||||
|
resultMap="RkInfoResult">
|
||||||
|
<include refid="selectRkInfoVo"/>
|
||||||
|
<where>
|
||||||
|
ri.is_delete = '0'
|
||||||
|
AND ri.is_delivery = '1'
|
||||||
|
|
||||||
|
<!-- 可选筛选:按你当前 RkInfo 实体常用查询项补充 -->
|
||||||
|
<if test="billNoCk != null and billNoCk != ''">
|
||||||
|
AND ri.bill_no_ck = #{billNoCk}
|
||||||
|
</if>
|
||||||
|
<if test="ckType != null and ckType != ''">
|
||||||
|
AND ri.ck_type = #{ckType}
|
||||||
|
</if>
|
||||||
|
<if test="teamCode != null and teamCode != ''">
|
||||||
|
AND ri.team_code = #{teamCode}
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND ri.status = #{status}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 领用(出库)时间范围 -->
|
||||||
|
<if test="lyStartTime != null">
|
||||||
|
AND ri.ly_time <![CDATA[ >= ]]> #{lyStartTime}
|
||||||
|
</if>
|
||||||
|
<if test="lyEndTime != null">
|
||||||
|
AND ri.ly_time <![CDATA[ <= ]]> #{lyEndTime}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<!-- 关键字模糊(项目/物料/供应商/出库单号等) -->
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (
|
||||||
|
ri.xm_no_ck LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR ri.xm_ms_ck LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR ri.wl_no LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR ri.wl_ms LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR ri.gys_no LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR ri.gys_mc LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
OR ri.bill_no_ck LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY ri.ly_time DESC, ri.id DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user