智慧农业后台管理
Administrator
2022-07-13 3df8757ade3bdef3b5a142c846680102589260bc
src/main/java/org/springblade/modules/lang/controller/LandController.java
@@ -123,29 +123,33 @@
         //替换分号为逗号
         String replaceAll = sNull.replaceAll(";", ",");
         land.setLandRange("'POLYGON((" + replaceAll + "))'");
      }
      List<Point2D.Double> points = new ArrayList<Point2D.Double>();
      double v1;
      String landRange = range;
      String[] s1 = landRange.split(";");
      for (String ss : s1) {
         String[] temp = ss.split(",");
         Point2D.Double point = new Point2D.Double(Double.parseDouble(temp[0]),
            Double.parseDouble(temp[1]));
         points.add(point);
      }
      PolyginArea tp = new PolyginArea();
      double area = tp.getAreaByxy(points);
      Integer landUnit = land.getLandUnit();
      //(0: 亩  1:分  2:平方米
      if (landUnit == 0) {
         double v = area * 0.0015;
         v1 = (double) Math.round(v * 100) / 100;
      } else if (landUnit == 1) {
         double v = area * 0.015;
         v1 = (double) Math.round(v * 100) / 100;
      } else {
         v1 = (double) Math.round(area * 100) / 100;
         List<Point2D.Double> points = new ArrayList<Point2D.Double>();
         double v1;
         String landRange = range;
         String[] s1 = landRange.split(";");
         for (String ss : s1) {
            String[] temp = ss.split(",");
            Point2D.Double point = new Point2D.Double(Double.parseDouble(temp[0]),
               Double.parseDouble(temp[1]));
            points.add(point);
         }
         PolyginArea tp = new PolyginArea();
         double area = tp.getAreaByxy(points);
         Integer landUnit = land.getLandUnit();
         //(0: 亩  1:分  2:平方米
         if (landUnit == 0) {
            double v = area * 0.0015;
            v1 = (double) Math.round(v * 100) / 100;
         } else if (landUnit == 1) {
            double v = area * 0.015;
            v1 = (double) Math.round(v * 100) / 100;
         } else {
            v1 = (double) Math.round(area * 100) / 100;
         }
         land.setLandArea(String.valueOf(v1));
      }else {
         land.setLandArea("0");
      }
      //图片转换上传
@@ -159,7 +163,7 @@
            e.printStackTrace();
         }
      }
      land.setLandArea(String.valueOf(v1));
      land.setType(1);
      return R.status(landService.saveLandInfo(land));
   }