From 0892d843cd394f383ff50f480f7f22f2ec3829bc Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期五, 27 六月 2025 20:24:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java |   87 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java b/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java
index a480f19..89a05ba 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/config/captcha/CommonController.java
@@ -2,20 +2,23 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ltkj.common.core.domain.R;
 import com.ltkj.common.core.domain.entity.SysDictData;
 import com.ltkj.common.utils.SnowFlake;
 import com.ltkj.common.utils.uuid.UUID;
 import com.ltkj.hosp.domain.SysAttachment;
+import com.ltkj.hosp.mapper.TestMapper;
 import com.ltkj.hosp.service.ISysAttachmentService;
+import com.ltkj.system.service.ISysConfigService;
 import com.ltkj.system.service.ISysDictDataService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -49,6 +52,9 @@
     @Autowired
     private ServerConfig serverConfig;
 
+//    @Value("${path.xdtfilePath}")
+//    private String value;
+
     private static final String FILE_DELIMETER = ",";
 
     @Value("${photoPath}")
@@ -63,7 +69,10 @@
     private ISysAttachmentService sysAttachmentService;
     @Autowired
     private ISysDictDataService sysDictDataService;
-
+    @Autowired
+    private ISysConfigService configService;
+    @Autowired
+    private TestMapper testMapper;
 
     /**
      * 閫氱敤涓嬭浇璇锋眰
@@ -92,8 +101,8 @@
     }
 
     /**
-    *   閲嶆柊鍐欑殑涓婁紶鍥剧墖   閫傜敤浜庝綋妫�濂楅
-    */
+     *   閲嶆柊鍐欑殑涓婁紶鍥剧墖   閫傜敤浜庝綋妫�濂楅
+     */
     @PostMapping("/packageUpload")
     public AjaxResult packageUpload(@RequestBody MultipartFile file) {
         String fileName = file.getOriginalFilename();
@@ -144,12 +153,29 @@
         }
     }
 
+    /**
+     * exe涓婁紶鍥剧墖鎺ュ彛
+     * @param file
+     * @param dictVal
+     * @param ip
+     * @return
+     */
     @PostMapping("/uploadImgExe")
     @ApiOperation(value = "EXE绋嬪簭寰幆璇诲彇鍥剧墖涓婁紶")
     public AjaxResult uploadImgExe(@RequestPart("file") MultipartFile file,@RequestParam("val")String dictVal,@RequestParam("ip")String ip){
+        if (StrUtil.isBlank(dictVal))
+            return AjaxResult.error("绫诲瀷涓嶈兘涓虹┖");
         try {
+            String exeimgsaveurl = configService.selectConfigByKey("exeimgsaveurl");
+            String filePath;
+            if (StrUtil.isNotBlank(exeimgsaveurl)){
+                filePath = exeimgsaveurl;
+            }else {
+                filePath = ltkjConfig.getUploadPath();
+            }
             // 涓婁紶鏂囦欢璺緞
-            String filePath = ltkjConfig.getUploadPath();
+
+            filePath+="/"+dictVal;
             // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
             String fileName = FileUploadUtils.upload(filePath, file);
             String url = serverConfig.getUrl() + fileName;
@@ -161,9 +187,10 @@
             ajax.put("newFileName", newFileName);
             ajax.put("originalFilename", file.getOriginalFilename());
             SysAttachment sysAttachment = new SysAttachment();
+            sysAttachment.setOldFileName(file.getOriginalFilename());
             sysAttachment.setId(SnowFlake.getInstance().nextId());
             sysAttachment.setFileName(newFileName);
-            sysAttachment.setFilePath(fileName);
+            sysAttachment.setFilePath(ltkjConfig.getUploadPath()+fileName.replace("/profileupload",""));
             sysAttachment.setUrl(url);
             sysAttachment.setSysDictVal(dictVal);
             sysAttachment.setIp(ip);
@@ -177,6 +204,18 @@
             e.printStackTrace();
             return AjaxResult.error(e.getMessage());
         }
+    }
+
+    /**
+     * 鑾峰彇exe绋嬪簭涓婁紶鍥剧墖鍒楄〃
+     * @param type
+     * @return
+     */
+    @GetMapping("/getExeUploadImgList")
+    public AjaxResult getExeUploadImgList(@RequestParam("type") String type){
+        if (StrUtil.isBlank(type)) return AjaxResult.error("绫诲瀷涓嶈兘涓虹┖");
+        List<Map<String, Object>> list = testMapper.getExeUploadImgListByGnLx(type);
+        return AjaxResult.success().put("data",list);
     }
 
     @GetMapping("/listExeVal")
@@ -274,4 +313,34 @@
         }
         return AjaxResult.success("鍒犻櫎鎴愬姛");
     }
+
+
+
+    /**
+     * 蹇冪數鍥炬姤鍛婁笂浼犲浘鐗囨柟娉�
+     */
+    @PostMapping("/uploadXdtFile")
+    @ApiOperation(value = "蹇冪數鍥炬姤鍛婁笂浼犲浘鐗囨柟娉�")
+    public AjaxResult uploadXdtFile(@ApiParam("鏂囦欢") @RequestPart("file") MultipartFile file,
+                                    @ApiParam("浣撴鍙�") String tjh,@ApiParam("椤圭洰id") String proId) throws Exception {
+        try {
+            // 涓婁紶鏂囦欢璺緞
+            String value = configService.selectConfigByKey("path_xdtfilePath");
+            String filePath = value + File.separator;
+            String outputFileName = tjh +"_" +proId;
+            // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+            String fileName = FileUploadUtils.upload(filePath,outputFileName, file);
+            String url = filePath + fileName;
+            Path path = Paths.get(url);
+            byte[] data = Files.readAllBytes(path);
+            String base64 = Base64.getEncoder().encodeToString(data);
+            AjaxResult ajax = AjaxResult.success();
+            ajax.put("url", url);
+            ajax.put("fileName", fileName);
+            ajax.put("base64", base64);
+            return ajax;
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
+        }
+    }
 }

--
Gitblit v1.8.0