智慧农业后台管理
Administrator
2022-07-05 8ec2d2febf56274b7cecb291a4657780e311f8fa
src/main/java/org/springblade/modules/lang/controller/LandController.java
@@ -32,6 +32,7 @@
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.farm.entity.Farm;
import org.springblade.modules.farm.vo.FarmVO;
import org.springblade.modules.resource.endpoint.OssEndpoint;
import org.springblade.modules.system.entity.DictBiz;
import org.springblade.modules.system.service.IDictBizService;
import org.springframework.web.bind.annotation.*;
@@ -63,6 +64,7 @@
   private final ILandService landService;
   private final IDictBizService dictService;
   private final OssEndpoint ossEndpoint;
   /**
    * 详情
@@ -145,6 +147,18 @@
      } else {
         v1 = (double) Math.round(area * 100) / 100;
      }
      //图片转换上传
      if (null!=land.getUrl() && !land.getUrl().equals("")){
         try {
            //上传
            String url = ossEndpoint.uploadBase64String(land.getUrl());
            //回填url
            land.setUrl(url);
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
      land.setLandArea(String.valueOf(v1));
      land.setType(1);
      return R.status(landService.saveLandInfo(land));
@@ -189,6 +203,18 @@
      } else {
         v1 = (double) Math.round(area * 100) / 100;
      }
      //图片转换上传
      if (null!=land.getUrl() && !land.getUrl().equals("")){
         try {
            //上传
            String url = ossEndpoint.uploadBase64String(land.getUrl());
            //回填url
            land.setUrl(url);
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
      land.setLandArea(String.valueOf(v1));
      land.setType(1);
      return R.status(landService.updateLandById(land));