ソースを参照

1.ftp服务器地址

QuietShadow 3 年 前
コミット
cb48aa9aba

+ 16 - 0
src/main/java/com/steerinfo/ftp/uploadfile/controller/UploadFileController.java

@@ -129,6 +129,22 @@ public class UploadFileController extends BaseRESTfulController {
         }
       return success();
     }
+
+    @PutMapping(value = "/batchupdate", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult batchupdate(@RequestBody UploadFile[] models) {
+        String userId = JwtUtil.getUseridByToken();
+        for (int i = 0; i < models.length; i++) {
+            UploadFile model = models[i];
+            if (model.getId() == null || model.getId().equals("")) {
+                return failed(null, "id为空");
+            }
+            model.setUpdateMan(userId);
+            model.setUpdateTime(new Date());
+            uploadFileService.modify(model);
+        }
+        return success();
+    }
+
     @PostMapping("/file")
     public RESTfulResult fileUpload( @ModelAttribute MultipartFile file, String type){
         try {

+ 3 - 0
src/main/java/com/steerinfo/ftp/uploadfile/mapper/UploadFileMapper.xml

@@ -246,6 +246,9 @@
       <if test="updateTime != null">
         UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="fileType != null">
+        FILE_TYPE = #{fileType,jdbcType=VARCHAR},
+      </if>
     </set>
     where ID = #{id,jdbcType=VARCHAR}
   </update>

+ 10 - 9
src/main/java/com/steerinfo/ftp/uploadfile/utils/FtpFileUtil.java

@@ -3,7 +3,6 @@ package com.steerinfo.ftp.uploadfile.utils;
 import com.steerinfo.framework.utils.io.IOUtils;
 import com.steerinfo.framework.utils.text.Charsets;
 import org.apache.commons.net.ftp.*;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletResponse;
@@ -33,24 +32,26 @@ public class FtpFileUtil {
      *   ftp服务器ip地址
      *   相关配置放在application.properties 中
      */
-    @Value("${custom.config.file-server.ip}")
-     String FTP_ADDRESS;
+    //@Value("${custom.config.file-server.ip}")
+    // String FTP_ADDRESS;
+    private String FTP_ADDRESS="172.16.90.238";
 
     /**
      *  端口号
      */
-    @Value("${custom.config.file-server.port}")
-    Integer FTP_PORT;
+    //@Value("${custom.config.file-server.port}")
+    //Integer FTP_PORT;
+    private Integer FTP_PORT=21;
     /**
      * 用户名
      */
-    @Value("${custom.config.file-ftp-user}")
-    String FTP_USERNAME;
+    //@Value("${custom.config.file-ftp-user}")
+    private String FTP_USERNAME="ftptest";
     /**
      * 密码
      */
-    @Value("${custom.config.file-ftp-password}")
-    String FTP_PASSWORD;
+    //@Value("${custom.config.file-ftp-password}")
+    private String FTP_PASSWORD="at286315";
 
     private FTPClient ftpClient = new FTPClient();
     private static final String SPOT = ".";