Procházet zdrojové kódy

Merge branch 'master' of https://gitee.com/antai-wuliu/ANTAI-API

liyg před 2 roky
rodič
revize
fe66a78ba1

+ 27 - 1
src/main/java/com/steerinfo/dil/controller/AMScontroller.java

@@ -485,7 +485,33 @@ public class AMScontroller {
         return amsFeign.getProductiveRequirementDelete(map);
     }
 
+    @ApiOperation(value = "需求计划新增接口", notes = "需求计划新增接口")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
+    })
+    @PostMapping(value = "/salePlanAdd")
+    @LogAround(foreignKeys = {"transPlanId"}, foreignKeyTypes = {"需求计划"})
+    public Map<String, Object> salePlanAdd(@RequestBody(required = false) Map<String, Object> map) {
+        return amsFeign.salePlanAdd(map);
+    }
 
+    @ApiOperation(value = "需求计划修改接口", notes = "需求计划修改接口")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
+    })
+    @PostMapping(value = "/salePlanUpdate")
+    @LogAround(foreignKeys = {"transPlanId"}, foreignKeyTypes = {"需求计划"})
+    public Map<String, Object> salePlanUpdate(@RequestBody(required = false) Map<String, Object> map) {
+        return amsFeign.salePlanUpdate(map);
+    }
 
-
+    @ApiOperation(value = "需求计划新增接口", notes = "需求计划新增接口")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
+    })
+    @PostMapping(value = "/salePlanDelete")
+    @LogAround(foreignKeys = {"transPlanId"}, foreignKeyTypes = {"需求计划"})
+    public Map<String, Object> salePlanDelete(@RequestBody(required = false) Map<String, Object> map) {
+        return amsFeign.salePlanDelete(map);
+    }
 }

+ 51 - 1
src/main/java/com/steerinfo/dil/controller/SystemFileController.java

@@ -16,6 +16,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;
@@ -57,7 +58,6 @@ public class SystemFileController extends BaseRESTfulController {
         if (file != null) {
             for (int i = 0; i < file.length; i++) {
                 try {
-
                     //获取系统时间
                     SimpleDateFormat simpleDateFormat = new SimpleDateFormat("/yyyy/MM/dd");
                     //获取文件名
@@ -95,6 +95,56 @@ public class SystemFileController extends BaseRESTfulController {
 
     }
 
+    @PostMapping("/insertFiles")
+    public RESTfulResult insertFiles(String[] fileUuids,String[] fileNames,String[]fileTypes, Map<Object,MultipartFile>FileList, MultipartRequest request) throws Exception {
+
+        List<MultipartFile> files  = new ArrayList<>();
+        int index=-1;
+        for(int i=0;i<21;i++) {
+            MultipartFile file = request.getFile("file" + i);
+            if (file != null) {
+                files.add(file);
+                if (index < 0) {
+                    index = i;
+                }
+            }
+        }
+
+        for (int i = 0; i < fileUuids.length; i++) {
+            //获取系统时间
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("/yyyy/MM/dd");
+            //获取文件名
+            String oldName = fileNames[i].toString();
+            //取当前时间的长整形值包含毫秒
+            String newName = IDutils.getImageName();
+            //重新命名文件
+
+            String filePath = simpleDateFormat.format(new Date())+"/"+fileTypes[i].toString();
+            //获取输入流
+            String fileTypeName = files.get(i).getOriginalFilename();
+            fileTypeName=fileTypeName.substring(fileTypeName.lastIndexOf(".")) ;
+            newName = oldName+"("+newName+")" +fileTypeName;
+            InputStream inputStream = files.get(i).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(fileUuids[i]);
+                SystemFile modela = systemFileService.add(uploadFile);
+                if (modela != null) {
+                    fileUuids[i] += "," + modela.getId();
+                }
+            } else {
+                return failed(null, "上传文件失败");
+            }
+        }
+
+       return success();
+
+    }
+
     @PostMapping("/previewfile")
     public RESTfulResult previewfile(@RequestBody HashMap parmas) {
         String filename = parmas.get("filename").toString();

+ 9 - 0
src/main/java/com/steerinfo/dil/feign/AmsFeign.java

@@ -166,4 +166,13 @@ public interface AmsFeign {
     @PostMapping(value = "api/v1/ams/amstransrequirements/getProductiveRequirementDelete")
     Map<String, Object> getProductiveRequirementDelete(@RequestBody(required = false)Map<String, Object> map);
 
+    @PostMapping(value = "api/v1/ams/amstransplans/salePlanAdd")
+    Map<String, Object> salePlanAdd(@RequestBody(required = false)Map<String, Object> map);
+
+    @PostMapping(value = "api/v1/ams/amstransplans/salePlanUpdate")
+    Map<String, Object> salePlanUpdate(@RequestBody(required = false)Map<String, Object> map);
+
+    @PostMapping(value = "api/v1/ams/amstransplans/salePlanDelete")
+    Map<String, Object> salePlanDelete(@RequestBody(required = false)Map<String, Object> map);
+
 }