czt
9 天以前 db67639449287bcec461916a7dca6003ee5dd03c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package com.fzzy.sys.controller.file;
 
import com.fzzy.igds.data.PageResponse;
import com.fzzy.sys.manager.file.FileManager;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
 
/**
 * @Description 出入库设备相关功能
 * @Author CZT
 * @Date 2025/12/4 9:27
 */
@Slf4j
@Controller
@RequestMapping("basic/file")
public class FileController {
 
    @Resource
    private FileManager fileManager;
 
    /**
     * 鸟瞰图预览页面
     *
     * @return
     */
    @RequestMapping("/dept-img")
    public String deptImg(@RequestParam(value = "id", required = true) String id,
                          ModelMap view) {
 
        if(StringUtils.isNotEmpty(id)){
            String imgPath = fileManager.getDeptFile(id);;
            view.put("imgPath", imgPath);
        }
 
        return "web/common/preview-img";
    }
 
 
    /**
     * 长传 出入库图片
     *
     * @param file
     * @param request
     * @return
     * @throws IOException
     */
    @RequestMapping("/update-file")
    @ResponseBody
    public PageResponse<String> updateFile(
            @RequestParam(value = "file", required = true) MultipartFile file,
            HttpServletRequest request) throws IOException {
 
        String plateNum = request.getParameter("plateNum");
 
        return fileManager.upLoadInoutHandleImg(file, plateNum);
    }
 
}