庞家镇
This commit is contained in:
parent
27c29fca42
commit
8fb45cb66f
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
@ -75,6 +75,8 @@ public class ShapeUtil {
|
||||
builder.add("workplace", String.class);
|
||||
//作业类型
|
||||
builder.add("jobtype", String.class);
|
||||
//作业时间
|
||||
builder.add("date", String.class);
|
||||
|
||||
if ("Polygon".equals(geoType) || "polygon".equals(geoType)) {
|
||||
builder.add("the_geom", Polygon.class);
|
||||
@ -172,6 +174,7 @@ public class ShapeUtil {
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
|
||||
featureBuilder.add(polygon);
|
||||
SimpleFeature feature = featureBuilder.buildFeature(null);
|
||||
@ -195,6 +198,7 @@ public class ShapeUtil {
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
featureBuilder.add(userdata.get(++index));
|
||||
|
||||
featureBuilder.add(lineString);
|
||||
SimpleFeature feature = featureBuilder.buildFeature(null);
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.ruoyi.crops.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发布shp地图服务文件表;
|
||||
* @author : http://www.chiner.pro
|
||||
* @date : 2023-6-30
|
||||
*/
|
||||
|
||||
public class GeoserverShp{
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Integer id ;
|
||||
private String fileName ;
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date time ;
|
||||
|
||||
public Integer getId(){
|
||||
return this.id;
|
||||
}
|
||||
public void setId(Integer id){
|
||||
this.id=id;
|
||||
}
|
||||
public String getFileName(){
|
||||
return this.fileName;
|
||||
}
|
||||
public void setFileName(String fileName){
|
||||
this.fileName=fileName;
|
||||
}
|
||||
public Date getTime(){
|
||||
return this.time;
|
||||
}
|
||||
public void setTime(Date time){
|
||||
this.time=time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GeoserverShp{" +
|
||||
"id=" + id +
|
||||
", fileName='" + fileName + '\'' +
|
||||
", time='" + time + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ public class FarmMachineryVo {
|
||||
private Integer id ;
|
||||
/** 农机编号 */
|
||||
private String vehicleno ;
|
||||
/** 终端编号 */
|
||||
private String vmeid ;
|
||||
/** 农机类型 */
|
||||
private String vehicletype ;
|
||||
/** 车主姓名 */
|
||||
@ -41,4 +43,12 @@ public class FarmMachineryVo {
|
||||
public void setOwnername(String ownername) {
|
||||
this.ownername = ownername;
|
||||
}
|
||||
|
||||
public String getVmeid() {
|
||||
return vmeid;
|
||||
}
|
||||
|
||||
public void setVmeid(String vmeid) {
|
||||
this.vmeid = vmeid;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.ruoyi.crops.mapper;
|
||||
|
||||
import com.ruoyi.crops.domain.GeoserverShp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface GeoserverShpMapper {
|
||||
List<GeoserverShp> queryByTime(@Param("beginTime")Date beginTime, @Param("endTime")Date endTime);
|
||||
|
||||
void insert(GeoserverShp geoserverShp);
|
||||
|
||||
int deleteById(Integer id);
|
||||
}
|
@ -11,7 +11,6 @@ import org.locationtech.jts.geom.Coordinate;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IFarmMachineryService {
|
||||
|
||||
|
@ -6,6 +6,6 @@ import com.ruoyi.crops.domain.ServiceType;
|
||||
public interface IGeoServer {
|
||||
public String publishTiff(String workSpace, String storeName, String filePath ,String styleName) throws Exception;
|
||||
|
||||
public String publishShp(String workSpace, String storeName, String layername, String filePath);
|
||||
public Boolean publishShp(String workSpace, String storeName, String layername, String filePath);
|
||||
int insert(ServiceType serviceType);
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.ruoyi.crops.service;
|
||||
import com.ruoyi.crops.domain.GeoserverShp;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 发布shp地图服务文件表;(geoserver_shp)表服务接口
|
||||
* @author : http://www.chiner.pro
|
||||
* @date : 2023-6-30
|
||||
*/
|
||||
public interface IGeoserverShpService {
|
||||
/**
|
||||
* 通过时间查询
|
||||
*/
|
||||
List<GeoserverShp> queryByTime(Date begintime,Date endtime);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param geoserverShp 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
GeoserverShp insert(GeoserverShp geoserverShp);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
}
|
@ -72,8 +72,8 @@ public class GeoServerImpl implements IGeoServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String publishShp(String workSpace, String storeName, String layername, String filePath) {
|
||||
String result="";
|
||||
public Boolean publishShp(String workSpace, String storeName, String layername, String filePath) {
|
||||
boolean result = false;
|
||||
try {
|
||||
File zipFile=new File(filePath);
|
||||
GeoServerRESTReader reader = new GeoServerRESTReader(url, username, password);
|
||||
@ -92,10 +92,10 @@ public class GeoServerImpl implements IGeoServer {
|
||||
|
||||
if(workspaces.contains(workSpace)){
|
||||
if(publisher.publishShp(workSpace, storeName, layername, zipFile, "EPSG:4326")){
|
||||
result = "发布成功!";
|
||||
} else {
|
||||
result = "发布失败!";
|
||||
// result = "发布成功!";
|
||||
result = true;
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.ruoyi.crops.service.impl;
|
||||
|
||||
import com.ruoyi.crops.domain.GeoserverShp;
|
||||
import com.ruoyi.crops.mapper.GeoserverShpMapper;
|
||||
import com.ruoyi.crops.service.IGeoserverShpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发布shp地图服务文件表;(geoserver_shp)表服务实现类
|
||||
* @author : http://www.chiner.pro
|
||||
* @date : 2023-6-30
|
||||
*/
|
||||
@Service
|
||||
public class GeoserverShpServiceImpl implements IGeoserverShpService {
|
||||
@Autowired
|
||||
private GeoserverShpMapper geoserverShpMapper;
|
||||
|
||||
/**
|
||||
* 通过时间查询
|
||||
*/
|
||||
public List<GeoserverShp> queryByTime(Date beginTime,Date endTime){
|
||||
return geoserverShpMapper.queryByTime(beginTime,endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param geoserverShp 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
public GeoserverShp insert(GeoserverShp geoserverShp){
|
||||
geoserverShpMapper.insert(geoserverShp);
|
||||
return geoserverShp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean deleteById(Integer id){
|
||||
int total = geoserverShpMapper.deleteById(id);
|
||||
return total > 0;
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
<result property="belongcorp" column="belongcorp" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
<select id="selectMachineryData" resultType="com.ruoyi.crops.domain.vo.FarmMachineryVo">
|
||||
select id,vehicletype,vehicleno,ownername
|
||||
select id,vehicletype,vmeid,vehicleno,ownername
|
||||
from ruoyi.farm_machinery
|
||||
<where>
|
||||
<if test="vehicleno != null and vehicleno!=''">
|
||||
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.crops.mapper.GeoserverShpMapper">
|
||||
<resultMap type="com.ruoyi.crops.domain.GeoserverShp" id="GeoserverShpMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="fileName" column="file_name" jdbcType="VARCHAR"/>
|
||||
<result property="time" column="time" jdbcType="DATE"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryByTime" resultMap="GeoserverShpMap">
|
||||
select file_name,time from ruoyi.geoserver_shp where time between #{beginTime} and #{endTime}
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
insert into ruoyi.geoserver_shp(file_name, time)
|
||||
select #{fileName} ,#{time}
|
||||
where not exists (select file_name from ruoyi.geoserver_shp where file_name = #{fileName})
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from ruoyi.geoserver_shp where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
@ -34,7 +34,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectMachineryJobData" resultType="com.ruoyi.crops.domain.vo.MachineryJobDataVo">
|
||||
select fm.vehicletype,mjd.vehicleno,mjd.vmeid,mjd.jobday,mjd.jobarea,fm.ownername,fm.ownertel,mjd.jobtype,mjd.area
|
||||
select fm.vehicletype,mjd.vehicleno,mjd.vmeid,mjd.jobday,mjd.jobarea,fm.ownername,fm.ownertel,mjd.jobtype,mjd.area,mjd.workHours
|
||||
from ruoyi.machinery_job_data mjd
|
||||
left join ruoyi.farm_machinery fm on mjd.vmeid = fm.vmeid
|
||||
<where>
|
||||
|
@ -115,11 +115,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
.antMatchers("/admins/**").permitAll();
|
||||
// .antMatchers("/admins/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
// .anyRequest().authenticated()
|
||||
// .and()
|
||||
// .headers().frameOptions().disable();
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.headers().frameOptions().disable();
|
||||
// 添加Logout filter
|
||||
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||
// 添加JWT filter
|
||||
|
Loading…
Reference in New Issue
Block a user