1
0
Преглед на файлове

增加关于分析操作方法逻辑

chenendian преди 1 месец
родител
ревизия
7e7cef93cf

+ 21 - 3
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/DecisionTaskController.java

@@ -10,9 +10,7 @@ import com.siwei.common.core.web.controller.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 决策任务控制器
@@ -38,6 +36,24 @@ public class DecisionTaskController extends BaseController {
         }
     }
 
+
+    @PostMapping("analyse")
+    public R<DecisionTask> analyse(@RequestBody Map<String,?> paramData) {
+        try {
+            //参数校验
+            String name = Objects.nonNull(paramData.get("name")) ? String.valueOf(paramData.get("name")):"";
+            String shape = Objects.nonNull(paramData.get("shape")) ? String.valueOf(paramData.get("shape")):"";//ewkt
+            Integer shapeType = Objects.nonNull(paramData.get("shapeType")) ? (Integer) paramData.get("shapeType") : -1;
+            String shapeFilePath =  Objects.nonNull(paramData.get("shapeFilePath")) ? String.valueOf(paramData.get("shapeFilePath")):"";
+            List<Integer> dataType =  Objects.nonNull(paramData.get("dataType")) ? (List<Integer>) paramData.get("dataType"):new ArrayList<>();
+            DecisionTask decisionTask = decisionTaskService.analyse(name, shape, shapeType, shapeFilePath, dataType);
+            return R.ok(decisionTask);
+        } catch (Exception e) {
+            return R.fail(e.getMessage());
+        }
+    }
+
+
     @GetMapping("/{id}")
     public R<DecisionTask> get(@PathVariable String id) {
         try {
@@ -100,11 +116,13 @@ public class DecisionTaskController extends BaseController {
             subMap1.put("zddm", "123456789");
             subMap1.put("area", 1234567);
             subMap1.put("qlr", "张三");
+            subMap1.put("id", "bad6ca22b2e54f46b6c9835cc2040b57");
 
             Map<String, Object> subMap2 = new HashMap<>();
             subMap2.put("zddm", "123456789");
             subMap2.put("area", 1234567);
             subMap2.put("qlr", "张三");
+            subMap2.put("id", "bad6ca22b2e54f46b6c9835cc20445567");
 
             List<Map<String,Object>> dataList = List.of(
                     subMap1,

+ 5 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/DecisionTaskService.java

@@ -17,4 +17,8 @@ public interface DecisionTaskService {
     void update(DecisionTaskVo decisionTaskVo);
 
     void batchDelete(List<String> ids);
-}
+
+    DecisionTask analyse(String name, String shape, Integer shapeType, String shapeFilePath, List<Integer> dataType);
+
+
+    }

+ 24 - 4
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/DecisionTaskServiceImpl.java

@@ -9,10 +9,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class DecisionTaskServiceImpl implements DecisionTaskService {
@@ -56,4 +53,27 @@ public class DecisionTaskServiceImpl implements DecisionTaskService {
     public void batchDelete(List<String> ids) {
         decisionTaskMapper.batchDelete(ids);
     }
+
+
+    //todo 这里的分析逻辑比较复杂,后续再完善,目前先占位
+    //1.先把分析结果保存到数据库,状态为处理中
+    //2.分析完成后更新数据库状态为已完成,并保存分析结果的文件路径
+    //3.分析过程中可以通过查询接口查询分析状态和结果
+    //4.异步方法进行返回,并且可以返回数据id
+    @Override
+    public DecisionTask analyse(String name, String shape, Integer shapeType, String shapeFilePath, List<Integer> dataType) {
+
+//        String name = Objects.nonNull(paramData.get("name")) ? String.valueOf(paramData.get("name")):"";
+//        String shape = Objects.nonNull(paramData.get("shape")) ? String.valueOf(paramData.get("shape")):"";//ewkt
+//        Integer shapeType = Objects.nonNull(paramData.get("shapeType")) ? (Integer) paramData.get("shapeType") : -1;
+//        String shapeFilePath =  Objects.nonNull(paramData.get("shapeFilePath")) ? String.valueOf(paramData.get("shapeFilePath")):"";
+//        List<Integer> dataType =  Objects.nonNull(paramData.get("dataType")) ? (List<Integer>) paramData.get("dataType"):new ArrayList<>();
+
+        return null;
+    }
+
+
+
+
+
 }