Browse Source

测点查询请求方式修改

王波 2 ngày trước cách đây
mục cha
commit
ff6db0f203

+ 28 - 15
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/CommonController.java

@@ -17,9 +17,7 @@ import com.gyee.runeconomy.util.DateUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
@@ -241,22 +239,37 @@ public class CommonController {
      *
      * @return
      */
-    @GetMapping("/findPointDatas")
+//    @GetMapping("/findPointDatas")
+//    @ResponseBody
+//    @ApiOperation(value = "查询测点值", notes = "查询测点值")
+//    public R findPointDatas(@RequestParam(value = "pointIds", required = true) String pointIds) throws Exception {
+//
+//
+//        List<String> pointList = new ArrayList<>();
+//
+//        String[] points = pointIds.split(",");
+//        if (points == null || points.length == 0 || Arrays.stream(points).allMatch(String::isEmpty)) {
+//            return R.error(ResultMsg.error());
+//        }
+//        Arrays.stream(points).forEach(p -> {
+//            pointList.add(p);
+//        });
+//        List<PointData> resultList = edosUtil.getRealData(pointList);
+//        if (StringUtils.isNotNull(resultList)) {
+//            return R.data(ResultMsg.ok(resultList));
+//        } else {
+//            return R.error(ResultMsg.error());
+//        }
+//    }
+    @PostMapping("/findPointDatas")
     @ResponseBody
     @ApiOperation(value = "查询测点值", notes = "查询测点值")
-    public R findPointDatas(@RequestParam(value = "pointIds", required = true) String pointIds) throws Exception {
-
-
-        List<String> pointList = new ArrayList<>();
-
-        String[] points = pointIds.split(",");
-        if (points == null || points.length == 0 || Arrays.stream(points).allMatch(String::isEmpty)) {
+    public R findPointDatas(@RequestBody List<String> pointIds) throws Exception {
+        if (pointIds == null || pointIds.isEmpty()) {
             return R.error(ResultMsg.error());
         }
-        Arrays.stream(points).forEach(p -> {
-            pointList.add(p);
-        });
-        List<PointData> resultList = edosUtil.getRealData(pointList);
+
+        List<PointData> resultList = edosUtil.getRealData(pointIds);
         if (StringUtils.isNotNull(resultList)) {
             return R.data(ResultMsg.ok(resultList));
         } else {