Redeem 2 năm trước cách đây
mục cha
commit
16fe132ba5

+ 53 - 0
src/main/java/com/steerinfo/dil/controller/SystemFileController.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.controller;
 
+import com.google.common.collect.Iterators;
 import com.steerinfo.dil.util.FtpFileUtil;
 import com.steerinfo.dil.util.IDutils;
 import com.steerinfo.framework.controller.BaseRESTfulController;
@@ -16,6 +17,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartRequest;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -164,4 +166,55 @@ public class SystemFileController extends BaseRESTfulController {
         }
 
     }
+
+
+    @PostMapping("/insertFiles")
+    public RESTfulResult insertFiles(String fileUuids,MultipartRequest request) {
+        String filenames = "";
+        //添加到files数组
+        List<MultipartFile> files = new ArrayList<>();
+        Iterator<String> fileNames =  request.getFileNames();
+        //记录上传成功的图片;
+        int successFiles = 0;
+        int size = Iterators.size(fileNames);
+        System.out.println(size);
+        for(int j = 0 ; j<size;j++) {
+            try {
+                MultipartFile file = request.getFile("file"+j);
+                //获取系统时间
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("/yyyy/MM/dd");
+                //获取文件名
+                String oldName = file.getOriginalFilename();
+                //取当前时间的长整形值包含毫秒
+                String newName = IDutils.getImageName();
+                //重新命名文件
+                newName = newName + oldName.substring(oldName.lastIndexOf("."));
+                String filePath = simpleDateFormat.format(new Date());
+                //获取输入流
+                InputStream inputStream = file.getInputStream();
+                boolean result = ftpFileUtil.uploadToFtp(inputStream, filePath, newName, false);
+                inputStream.close();
+                if (result) {
+                    SystemFile uploadFile = new SystemFile();
+                    uploadFile.setFilename(oldName);
+                    uploadFile.setFilepath(filePath + "/" + newName);
+                    uploadFile.setId("alternateFields1");
+                    SystemFile modela = systemFileService.add(uploadFile);
+                    //if (modela != null) {
+                    //    filesid += "," + modela.getId();
+                    //}
+                    successFiles++;
+                } else {
+                    //return failed(null, "上传文件失败");
+                    continue;
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return  success();
+
+
+    }
 }

+ 34 - 0
src/main/java/com/steerinfo/dil/controller/systemOaController.java

@@ -0,0 +1,34 @@
+package com.steerinfo.dil.controller;
+
+
+import com.baomidou.mybatisplus.extension.api.R;
+import com.steerinfo.dil.util.BaseRESTfulController;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.steerinfo.dil.util.HTTPRequestUtils;
+
+import java.io.IOException;
+
+
+@RestController
+@RequestMapping("/${api.version}/systemOaController")
+public class systemOaController extends BaseRESTfulController {
+
+
+
+
+    public  void systemOa()  {
+
+
+    }
+
+    public static void main(String[] args) throws IOException {
+        //首先是登录
+        String url = "https://sso.steerinfo.com/auth/login?loginName=000415&password=st123456&app_code=oa-app";
+        String jsonObject = HTTPRequestUtils.send(url,"{}","utf-8");
+        System.out.println(jsonObject);
+
+
+    }
+}

+ 21 - 11
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -140,7 +140,8 @@
             MATERIAL_TYPE_NAME "materialTypeName",
         MATERIAL_TYPE_ID "id",
         MATERIAL_TYPE_ID "value",
-        MATERIAL_TYPE_NAME "label"
+        MATERIAL_TYPE_NAME "label",
+        MATERIAL_TYPE_NAME "text"
         from RMS_MATERIAL_TYPE
         where DELETED = 0
         )
@@ -164,7 +165,8 @@
         EMISSION_STANDARD_NAME "emissionStandardName",
         EMISSION_STANDARD_ID "id",
         EMISSION_STANDARD_ID "value",
-        EMISSION_STANDARD_NAME "label"
+        EMISSION_STANDARD_NAME "label",
+        EMISSION_STANDARD_NAME "text",
         from RMS_EMISSION_STANDARD
         where DELETED = 0
         )
@@ -189,7 +191,8 @@
         OPERATION_POINT_TYPE "operationPointType",
         OPERATION_POINT_ID "id",
         OPERATION_POINT_ID "value",
-        OPERATION_POINT_NAME "label"
+        OPERATION_POINT_NAME "label",
+        OPERATION_POINT_NAME "text"
         from RMS_OPERATION_POINT
         where DELETED = 0
         )
@@ -216,7 +219,9 @@
         PERSONNEL_NAME "personnelName",
         PERSONNEL_ID "id",
         PERSONNEL_ID "value",
-        PERSONNEL_NAME "label"
+        PERSONNEL_NAME "label",
+        PERSONNEL_NAME "text"
+
         from RMS_PERSONNEL
         where DELETED = 0
         )
@@ -269,7 +274,8 @@
         RC.JOB_NAME "jobName",
         RC.JOB_ID "id",
         RC.JOB_ID "value",
-        RC.JOB_NAME "label"
+        RC.JOB_NAME "label",
+        RC.JOB_NAME "text"
         from RMS_JOB_INFO RC
         where DELETED = 0
         )
@@ -293,7 +299,8 @@
             RC.TRANS_RANGE_NAME "transrangeName",
         RC.TRANS_RANGE_ID "id",
         RC.TRANS_RANGE_ID "value",
-        RC.TRANS_RANGE_NAME "label"
+        RC.TRANS_RANGE_NAME "label",
+        RC.TRANS_RANGE_NAME "text"
         from RMS_TRANS_RANGE RC
         where DELETED = 0
         )
@@ -317,7 +324,8 @@
         RC.RULES_CODE "rulesCode",
         RC.RULES_ID "id",
         RC.RULES_ID "value",
-        RC.RULES_CODE "label"
+        RC.RULES_CODE "label",
+        RC.RULES_CODE "text",
         from RMS_DEMAND_RULES RC
         where DELETED = 0
         )
@@ -341,7 +349,8 @@
         RC.CAPACITY_TYPE_NAME "capacityTypeName",
         RC.CAPACITY_TYPE_ID "id",
         RC.CAPACITY_TYPE_ID "value",
-        RC.CAPACITY_TYPE_NAME "label"
+        RC.CAPACITY_TYPE_NAME "label",
+        RC.CAPACITY_TYPE_NAME "text",
         from RMS_CAPACITY_TYPE RC
         where DELETED = 0
         )
@@ -366,7 +375,8 @@
         RC.LINE_NAME "lineName",
         RC.LINE_ID "id",
         RC.LINE_ID "value",
-        RC.LINE_NAME "label"
+        RC.LINE_NAME "label",
+        RC.LINE_NAME "text"
         from RMS_LINE RC
         where DELETED = 0
         )
@@ -390,7 +400,8 @@
         RC.MATERIAL_NAME "materialName",
         RC.MATERIAL_ID "id",
         RC.MATERIAL_ID "value",
-        RC.MATERIAL_NAME "label"
+        RC.MATERIAL_NAME "label",
+        RC.MATERIAL_NAME "text",
         from RMS_MATERIAL RC
         where DELETED = 0
         )
@@ -406,7 +417,6 @@
             </if>
         </where>
         FETCH NEXT 100 ROWS ONLY
-
     </select>
 
 </mapper>