庞家镇

This commit is contained in:
2023-07-01 16:06:17 +08:00
parent 27c29fca42
commit 8fb45cb66f
15 changed files with 263 additions and 20 deletions

View File

@ -21,11 +21,8 @@ import com.ruoyi.crops.domain.gsonBean.GsonFarmMachineryBean;
import com.ruoyi.crops.domain.gsonBean.GsonMachineryPositionBean;
import com.ruoyi.crops.domain.vo.FarmMachineryVo;
import com.ruoyi.crops.domain.vo.MachineryJobDataVo;
import com.ruoyi.crops.service.IFarmMachineryService;
import com.ruoyi.crops.service.IGeoServer;
import com.ruoyi.crops.service.IMapDrawPolygonService;
import com.ruoyi.crops.service.*;
import com.ruoyi.crops.service.IWarningFarmService;
import org.apache.commons.collections.map.HashedMap;
import org.checkerframework.checker.units.qual.A;
import org.locationtech.jts.geom.Geometry;
@ -59,6 +56,8 @@ public class FarmMachineryController extends BaseController {
@Autowired
private IWarningFarmService iWarningFarmService;
@Autowired
private IGeoserverShpService iGeoserverShpService;
@Autowired
private IGeoServer iGeoServer;
@Value("${FarmMachinery.vehicleList}")
@ -274,7 +273,7 @@ public class FarmMachineryController extends BaseController {
userdata.add(trajectory.getWorkplace());
//通过农机编号查询作业类型
userdata.add(String.valueOf(iFarmMachineryService.selectJobtype(vehicleno)));
userdata.add(DateUtils.getDate());
//截取wkt格式字符串改变为MULTIPOLYGON格式
String substring = drawPolygon.substring(8, drawPolygon.length() - 1);
String linestring = line.substring(10);
@ -330,8 +329,14 @@ public class FarmMachineryController extends BaseController {
String polygonZipPath = RuoYiConfig.getUploadPath()+ "/shpFile/" + LocalDate.now() + "polygon.zip";
String lineStringZipPath = RuoYiConfig.getUploadPath()+ "/shpFile/lineString.zip";
//发布shp服务
String polygonShpResult = iGeoServer.publishShp("PJZ", fileName, fileName, polygonZipPath);
String lineStringShpResult = iGeoServer.publishShp("PJZ", "lineString", "lineString", lineStringZipPath);
Boolean polygonShpResult = iGeoServer.publishShp("PJZ", fileName, fileName, polygonZipPath);
Boolean lineStringShpResult = iGeoServer.publishShp("PJZ", "lineString", "lineString", lineStringZipPath);
if (polygonShpResult){
GeoserverShp geoserverShp = new GeoserverShp();
geoserverShp.setFileName(fileName);
geoserverShp.setTime(new Date());
iGeoserverShpService.insert(geoserverShp);
}
result.put("publishPolygonShp", polygonShpResult);
result.put("publishlineStringShp", lineStringShpResult);
return AjaxResult.success(result);

View File

@ -0,0 +1,53 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.GeoserverShp;
import com.ruoyi.crops.service.IGeoserverShpService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
/**
* 发布shp地图服务文件表;(geoserver_shp)表控制层
* @author : http://www.chiner.pro
* @date : 2023-6-30
*/
@RestController
@RequestMapping("/geoserverShp")
public class GeoserverShpController extends BaseController {
@Autowired
private IGeoserverShpService iGeoserverShpService;
/**
* 通过时间查询
*/
@GetMapping("/queryByTime")
public AjaxResult queryByTime(@RequestParam Date beginTime,Date endTime){
return AjaxResult.success(iGeoserverShpService.queryByTime(beginTime,endTime));
}
/**
* 新增数据
*
* @param geoserverShp 实例对象
* @return 实例对象
*/
@PostMapping
public AjaxResult add(GeoserverShp geoserverShp){
return AjaxResult.success(iGeoserverShpService.insert(geoserverShp));
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@DeleteMapping
public AjaxResult deleteById(Integer id){
return AjaxResult.success(iGeoserverShpService.deleteById(id));
}
}