49 changed files with 978 additions and 612 deletions
@ -0,0 +1,19 @@ |
|||
package org.dromara.workflow.api.domain.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* 流程类型,后续有的话可以根据具体业务加,要保证流程定义里面的标识key和这边code保持一致 |
|||
*/ |
|||
@Getter |
|||
@AllArgsConstructor |
|||
public enum WorkflowCodeEnum { |
|||
|
|||
ALERT("alert","预警流程"); |
|||
|
|||
final String code; |
|||
|
|||
final String description; |
|||
|
|||
} |
@ -0,0 +1,146 @@ |
|||
package org.dromara.business.domain; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
*存储解析的shp的矢量数据 |
|||
*/ |
|||
@Data |
|||
@TableName("business_geospatial_vectors") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
public class BusinessGeospatialVectors { |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
@TableId(type = IdType.AUTO) |
|||
private String id; |
|||
|
|||
// 1. 图形基础属性
|
|||
private String landCategories; // 几何信息
|
|||
|
|||
private String lineColor; // 线颜色
|
|||
|
|||
private String areaColor; // 面颜色
|
|||
|
|||
private String lineTransparency; // 线透明度
|
|||
|
|||
private String lineWidth; // 线宽度
|
|||
|
|||
private String areaTransparency; // 面透明度
|
|||
|
|||
private String shapeLength; // 形状长度
|
|||
|
|||
private String shapeArea; // 形状面积
|
|||
|
|||
// 2. 图斑标识信息
|
|||
private String featureCode; // 标识码
|
|||
|
|||
private String featureTypeCode; // 要素代码
|
|||
|
|||
private String temporaryFeatureId; // 图斑预编号
|
|||
|
|||
private String featureId; // 图斑编号
|
|||
|
|||
private String featureType; // 图斑类型
|
|||
|
|||
private String objectId; // 对象ID
|
|||
|
|||
// 3. 地类信息
|
|||
private String landTypeCode; // 地类编码
|
|||
|
|||
private String landTypeName; // 地类名称
|
|||
|
|||
private String landUseType; // 土地利用类型
|
|||
|
|||
private String landActualUse; // 土地用途
|
|||
|
|||
// 4. 权属与行政区划信息
|
|||
private String ownershipNature; // 权属性质
|
|||
|
|||
private String ownershipUnitCode; // 权属单位代码
|
|||
|
|||
private String ownershipUnitName; // 权属单位名称
|
|||
|
|||
private String landUnitCode; // 坐落单位代码
|
|||
|
|||
private String landUnitName; // 坐落单位名称
|
|||
|
|||
private String adminDivisionCode; // 行政区代码
|
|||
|
|||
private String adminDivisionName; // 行政区名称
|
|||
|
|||
// 5. 面积信息
|
|||
private String featureArea; // 图斑面积
|
|||
|
|||
private String deductionArea; // 扣除面积
|
|||
|
|||
private String featureLandArea; // 图斑地类面积
|
|||
|
|||
private String linearFeatureWidth; // 线状地物宽度
|
|||
|
|||
// 6. 农用地相关信息
|
|||
private String arableLandQuality; // 耕地等别
|
|||
|
|||
private String arableLandQualityCode; // 耕地等别代码
|
|||
|
|||
private String basicFarmlandType; // 基本农田类型
|
|||
|
|||
// 7. 规划信息
|
|||
private String planningPurpose; // 规划用途
|
|||
|
|||
private String planningPurposeCode; // 规划用途代码
|
|||
|
|||
private String planningPeriod; // 规划期限
|
|||
|
|||
// 8. 变更与历史信息
|
|||
private String originalFeatureCode; // 原始代码
|
|||
|
|||
private String originalLandTypeCode; // 原地类编码
|
|||
|
|||
private String changeRecordId; // 变更编号
|
|||
|
|||
private String changeDate; // 变更日期
|
|||
|
|||
// 9. 时间信息
|
|||
private String updateDate; // 更新日期
|
|||
|
|||
private String completionDate; // 建设日期
|
|||
|
|||
private String dataYear; // 数据年份
|
|||
|
|||
// 10. 其他属性
|
|||
private String notes; // 备注
|
|||
|
|||
private String approvalNumber; // 批准文号
|
|||
|
|||
private String urbanVillageCode; // 城镇村属性码
|
|||
|
|||
private String extendedInfo; // 扩展信息
|
|||
|
|||
private String belongingArea; // 所属区域
|
|||
|
|||
private String geographicLocation; // 地理位置
|
|||
|
|||
// 11. 拆转查相关信息
|
|||
private String demolitionType; // 拆查类型
|
|||
|
|||
private String demolitionArea; // 拆查面积
|
|||
|
|||
private String demolitionName; // 拆查名称
|
|||
|
|||
private Integer batchNo; //批次号
|
|||
|
|||
private Date createTime; //创建时间
|
|||
|
|||
|
|||
} |
@ -1,54 +0,0 @@ |
|||
package org.dromara.business.domain; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* Description: <br/> |
|||
* date: 2024/8/12$ 17:17$<br/> |
|||
* |
|||
* @author: yq |
|||
*/ |
|||
|
|||
@Data |
|||
@TableName("business_patrol_areas_platform_info") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
public class BusinessPatrolAreasPlatform extends BaseEntity { |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
@TableId(type = IdType.ASSIGN_ID) |
|||
private String id; |
|||
|
|||
@ExcelProperty(value = "patrol_areas_id") |
|||
private String patrolAreasId; |
|||
/**区域名称*/ |
|||
@ExcelProperty(value = "平台名称") |
|||
private String platformName; |
|||
|
|||
@ExcelProperty(value = "平台类型") |
|||
private String platformType; |
|||
|
|||
/**区域编号*/ |
|||
@ExcelProperty(value = "平台图片") |
|||
private String imageUrl; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
@ExcelProperty(value = "排序") |
|||
private Integer sort; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -1,42 +0,0 @@ |
|||
package org.dromara.business.domain; |
|||
|
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @Description: 巡查区域坐标 |
|||
*/ |
|||
@Data |
|||
@TableName("business_patrol_area_points") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
public class BusinessPatrolAreasPoints extends BaseEntity { |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
@TableId(type = IdType.ASSIGN_ID) |
|||
private String id; |
|||
|
|||
/**areaId*/ |
|||
@ExcelProperty(value = "areaId") |
|||
private String areaId; |
|||
/**纬度*/ |
|||
@ExcelProperty(value = "纬度") |
|||
private BigDecimal lat; |
|||
/**经度*/ |
|||
@ExcelProperty(value = "经度") |
|||
private BigDecimal lng; |
|||
/**序号*/ |
|||
@ExcelProperty(value = "序号") |
|||
private Integer sortNumber; |
|||
|
|||
} |
@ -1,54 +0,0 @@ |
|||
|
|||
package org.dromara.business.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description: 平台信息 |
|||
*/ |
|||
@Data |
|||
@TableName("business_platform_info") |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
public class BusinessPlatformInfo extends BaseEntity { |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
@TableId(type = IdType.ASSIGN_ID) |
|||
private String id; |
|||
|
|||
/**设备昵称**/ |
|||
private String platformName; |
|||
|
|||
/**设备类型**/ |
|||
private String platformType; |
|||
|
|||
/**平台图片**/ |
|||
private String imageUrl; |
|||
|
|||
/**app图片**/ |
|||
private String imageAppUrl; |
|||
|
|||
/**排序**/ |
|||
private Integer sort; |
|||
/**路由**/ |
|||
private String routes; |
|||
/**平台识别类型集合**/ |
|||
@TableField(exist = false) |
|||
private List<BusinessPlatformInfoCode> platformInfoCodes = new ArrayList<>(); |
|||
@TableField(exist = false) |
|||
private Map<String,Object> total = new HashMap<>(); |
|||
} |
@ -1,10 +0,0 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.dromara.business.domain.BusinessPatrolAreasPlatform; |
|||
|
|||
|
|||
public interface BusinessPatrolAreasPlatformMapper extends BaseMapper<BusinessPatrolAreasPlatform> { |
|||
|
|||
} |
@ -1,16 +0,0 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.dromara.business.domain.BusinessPatrolAreasPoints; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 巡查区域坐标 |
|||
*/ |
|||
public interface BusinessPatrolAreasPointsMapper extends BaseMapper<BusinessPatrolAreasPoints> { |
|||
|
|||
List<BusinessPatrolAreasPoints> listPatrolAreasPointByAreaId(@Param("areaId") String areaId); |
|||
} |
@ -1,16 +0,0 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.dromara.business.domain.BusinessPatrolAreasUser; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 巡查区域人员信息 |
|||
*/ |
|||
public interface BusinessPatrolAreasUserMapper extends BaseMapper<BusinessPatrolAreasUser> { |
|||
|
|||
List<BusinessPatrolAreasUser> listPatrolAreasUserByAreaId(@Param("areaId") String areaId); |
|||
} |
@ -1,17 +0,0 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.dromara.business.domain.BusinessPlatformInfoCode; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author sean.zhou |
|||
* @date 2021/11/10 |
|||
* @version 0.1 |
|||
*/ |
|||
public interface BusinessPlatformInfoCodeMapper extends BaseMapper<BusinessPlatformInfoCode> { |
|||
List<BusinessPlatformInfoCode> listPlatformInfoCodeByPlatformInfoId(@Param("platformInfoId") String platformInfoId); |
|||
} |
@ -1,23 +0,0 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.dromara.business.domain.BusinessPlatformInfo; |
|||
import org.dromara.business.domain.bo.BusinessPlatformInfoBo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author sean.zhou |
|||
* @date 2021/11/10 |
|||
* @version 0.1 |
|||
*/ |
|||
public interface BusinessPlatformInfoMapper extends BaseMapper<BusinessPlatformInfo> { |
|||
IPage<BusinessPlatformInfo> listPlatformInfo(Page page, @Param("condition") BusinessPlatformInfoBo platformInfoBo); |
|||
|
|||
List<BusinessPlatformInfo> listPlatformInfo(@Param("condition")BusinessPlatformInfoBo platformInfoBo); |
|||
|
|||
} |
@ -0,0 +1,8 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.dromara.business.domain.BusinessVectorDictItem; |
|||
|
|||
public interface BusinessVectorDictItemMapper extends BaseMapper<BusinessVectorDictItem> { |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package org.dromara.business.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.dromara.business.domain.BusinessVectorDict; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface BusinessVectorDictMapper extends BaseMapper<BusinessVectorDict> { |
|||
List<BusinessVectorDict> listVectorField(); |
|||
} |
@ -1,13 +0,0 @@ |
|||
package org.dromara.business.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.dromara.business.domain.BusinessPatrolAreasPoints; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 巡查区域坐标 |
|||
*/ |
|||
public interface IBusinessPatrolAreasPointsService extends IService<BusinessPatrolAreasPoints> { |
|||
List<BusinessPatrolAreasPoints> listPatrolAreasPointByAreaId(String areaId); |
|||
} |
@ -1,13 +0,0 @@ |
|||
package org.dromara.business.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.dromara.business.domain.BusinessPatrolAreasUser; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 巡查区域人员信息 |
|||
*/ |
|||
public interface IBusinessPatrolAreasUserService extends IService<BusinessPatrolAreasUser> { |
|||
List<BusinessPatrolAreasUser> listPatrolAreasUserByAreaId(String areaId); |
|||
} |
@ -1,9 +0,0 @@ |
|||
package org.dromara.business.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.dromara.business.domain.BusinessPlatformInfo; |
|||
|
|||
public interface IBusinessPlatformInfoService extends IService<BusinessPlatformInfo> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package org.dromara.business.service; |
|||
|
|||
|
|||
import org.dromara.business.domain.BusinessVectorDictItem; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface IBusinessVectorDictItemService { |
|||
|
|||
List<BusinessVectorDictItem> findDictItemByDictId(String dictId); |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package org.dromara.business.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.dromara.business.domain.BusinessVectorDict; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface IBusinessVectorDictService { |
|||
|
|||
List<BusinessVectorDict> listVectorField(); |
|||
|
|||
BusinessVectorDict findVectorDictById(String dictId); |
|||
|
|||
|
|||
} |
@ -1,23 +0,0 @@ |
|||
package org.dromara.business.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.business.domain.BusinessPatrolAreasPoints; |
|||
import org.dromara.business.mapper.BusinessPatrolAreasPointsMapper; |
|||
import org.dromara.business.service.IBusinessPatrolAreasPointsService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 巡查区域坐标 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class BusinessPatrolAreasPointsServiceImpl extends ServiceImpl<BusinessPatrolAreasPointsMapper, BusinessPatrolAreasPoints> implements IBusinessPatrolAreasPointsService { |
|||
|
|||
@Override |
|||
public List<BusinessPatrolAreasPoints> listPatrolAreasPointByAreaId(String areaId) { |
|||
return baseMapper.listPatrolAreasPointByAreaId(areaId); |
|||
} |
|||
} |
@ -1,23 +0,0 @@ |
|||
package org.dromara.business.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.business.domain.BusinessPatrolAreasUser; |
|||
import org.dromara.business.mapper.BusinessPatrolAreasUserMapper; |
|||
import org.dromara.business.service.IBusinessPatrolAreasUserService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description: 巡查区域人员信息 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class BusinessPatrolAreasUserServiceImpl extends ServiceImpl<BusinessPatrolAreasUserMapper, BusinessPatrolAreasUser> implements IBusinessPatrolAreasUserService { |
|||
|
|||
@Override |
|||
public List<BusinessPatrolAreasUser> listPatrolAreasUserByAreaId(String areaId) { |
|||
return baseMapper.listPatrolAreasUserByAreaId(areaId); |
|||
} |
|||
} |
@ -1,17 +0,0 @@ |
|||
package org.dromara.business.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.dromara.business.domain.BusinessPlatformInfo; |
|||
import org.dromara.business.mapper.BusinessPlatformInfoMapper; |
|||
import org.dromara.business.service.IBusinessPlatformInfoService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* |
|||
**/ |
|||
@Service |
|||
public class BusinessPlatformInfoServiceImpl extends ServiceImpl<BusinessPlatformInfoMapper, BusinessPlatformInfo> implements IBusinessPlatformInfoService { |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package org.dromara.business.service.impl; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.dromara.business.domain.BusinessVectorDictItem; |
|||
import org.dromara.business.mapper.BusinessVectorDictItemMapper; |
|||
import org.dromara.business.service.IBusinessVectorDictItemService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 矢量数据字段映射关联服务类 |
|||
*/ |
|||
@Service |
|||
public class BusinessVectorDictItemServiceImpl extends ServiceImpl<BusinessVectorDictItemMapper, BusinessVectorDictItem> implements IBusinessVectorDictItemService { |
|||
|
|||
|
|||
@Override |
|||
public List<BusinessVectorDictItem> findDictItemByDictId(String dictId) { |
|||
LambdaQueryWrapper<BusinessVectorDictItem> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(BusinessVectorDictItem::getDictId, dictId); |
|||
|
|||
return this.baseMapper.selectList(wrapper); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
package org.dromara.business.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.dromara.business.domain.BusinessVectorDict; |
|||
import org.dromara.business.mapper.BusinessVectorDictMapper; |
|||
import org.dromara.business.service.IBusinessVectorDictService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 矢量数据字段映射主表服务类 |
|||
*/ |
|||
@Service |
|||
public class BusinessVectorDictServiceImpl extends ServiceImpl<BusinessVectorDictMapper, BusinessVectorDict> implements IBusinessVectorDictService { |
|||
|
|||
|
|||
@Override |
|||
public List<BusinessVectorDict> listVectorField() { |
|||
return this.baseMapper.listVectorField(); |
|||
} |
|||
|
|||
@Override |
|||
public BusinessVectorDict findVectorDictById(String dictId) { |
|||
if (ObjectUtil.isEmpty(dictId)){ |
|||
throw new RuntimeException("【dictId】为空,参数为空!"); |
|||
} |
|||
|
|||
LambdaQueryWrapper<BusinessVectorDict> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(BusinessVectorDict::getId, dictId); |
|||
|
|||
return this.baseMapper.selectOne(wrapper); |
|||
} |
|||
} |
@ -0,0 +1,368 @@ |
|||
package org.dromara.business.utils; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import org.geotools.data.FileDataStore; |
|||
import org.geotools.data.FileDataStoreFinder; |
|||
import org.geotools.data.shapefile.ShapefileDataStore; |
|||
import org.geotools.data.simple.SimpleFeatureCollection; |
|||
import org.geotools.data.simple.SimpleFeatureIterator; |
|||
import org.geotools.data.simple.SimpleFeatureSource; |
|||
import org.geotools.geometry.jts.JTS; |
|||
import org.geotools.referencing.CRS; |
|||
import org.locationtech.jts.geom.Coordinate; |
|||
import org.locationtech.jts.geom.Geometry; |
|||
import org.locationtech.jts.geom.MultiPolygon; |
|||
import org.locationtech.jts.geom.Polygon; |
|||
import org.locationtech.jts.operation.union.UnaryUnionOp; |
|||
import org.opengis.feature.Property; |
|||
import org.opengis.feature.simple.SimpleFeature; |
|||
import org.opengis.referencing.crs.CoordinateReferenceSystem; |
|||
import org.opengis.referencing.operation.MathTransform; |
|||
import org.opengis.referencing.operation.TransformException; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
|
|||
import java.io.*; |
|||
import java.nio.charset.Charset; |
|||
import java.nio.file.Files; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.zip.ZipEntry; |
|||
import java.util.zip.ZipException; |
|||
import java.util.zip.ZipInputStream; |
|||
|
|||
/** |
|||
* shp文件读取工具类 |
|||
* 支持不同类型的地理要素 |
|||
*/ |
|||
public class ShpAnalysisUtil { |
|||
|
|||
private static final Logger log = LoggerFactory.getLogger(ShpAnalysisUtil.class); |
|||
|
|||
private static final String CHECK_FIELD = "O_Com"; |
|||
|
|||
/** |
|||
* 读取shp文件,返回要素集合 |
|||
* @param shpPath shp文件路径 |
|||
* @return 要素集合,包含地理位置和属性信息 |
|||
*/ |
|||
public static List<Map<String, String>> analysisShpFile(String shpPath) { |
|||
List<Map<String, String>> resultList = new ArrayList<>(); |
|||
|
|||
try { |
|||
resultList=analysisShpFile(shpPath, "GBK"); |
|||
} catch (Exception e) { |
|||
log.error("无法使用支持的字符编码读取shp文件: {}", e.getMessage()); |
|||
} |
|||
|
|||
return resultList; |
|||
} |
|||
|
|||
/** |
|||
* 读取shp文件,返回要素集合 |
|||
* @param shpInputStream shp文件输入流 |
|||
* @return 要素集合,包含地理位置和属性信息 |
|||
*/ |
|||
public static List<Map<String, String>> analysisShpFile(InputStream shpInputStream) { |
|||
List<Map<String, String>> resultList = new ArrayList<>(); |
|||
|
|||
try { |
|||
resultList = analysisShpFile(shpInputStream, "GBK"); |
|||
} catch (Exception e) { |
|||
log.error("无法使用支持的字符编码读取shp文件输入流: {}", e.getMessage()); |
|||
} |
|||
|
|||
return resultList; |
|||
} |
|||
|
|||
/** |
|||
* 读取shp文件的主要方法(仅支持ZIP输入流) |
|||
* |
|||
* @param shpInputStream shp文件ZIP输入流 |
|||
* @param charset 字符编码 |
|||
* @return 要素集合,包含地理位置和属性信息 |
|||
* @throws IllegalArgumentException 如果输入流不是ZIP格式 |
|||
*/ |
|||
public static List<Map<String, String>> analysisShpFile(InputStream shpInputStream, String charset) { |
|||
// 存储解析出的要素集合
|
|||
List<Map<String, String>> resultList = new ArrayList<>(); |
|||
File tempDir = null; |
|||
|
|||
try { |
|||
// 创建临时目录
|
|||
tempDir = Files.createTempDirectory("plough_shp_").toFile(); |
|||
tempDir.deleteOnExit(); // 额外保障
|
|||
|
|||
// 使用指定编码的ZipInputStream处理
|
|||
Charset zipCharset = Charset.forName(charset); |
|||
try (ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(shpInputStream), zipCharset)) { |
|||
ZipEntry entry; |
|||
boolean shpFound = false; |
|||
while ((entry = zipInputStream.getNextEntry()) != null) { |
|||
// 处理文件名编码问题
|
|||
log.info("文件名字:{}",entry.getName()); |
|||
File outputFile = new File(tempDir, entry.getName()); |
|||
|
|||
// 创建父目录
|
|||
if (entry.isDirectory()) { |
|||
outputFile.mkdirs(); |
|||
} else { |
|||
// 确保父目录存在
|
|||
outputFile.getParentFile().mkdirs(); |
|||
|
|||
// 写入文件
|
|||
try (FileOutputStream fos = new FileOutputStream(outputFile)) { |
|||
byte[] buffer = new byte[1024]; |
|||
int len; |
|||
while ((len = zipInputStream.read(buffer)) > 0) { |
|||
fos.write(buffer, 0, len); |
|||
} |
|||
} |
|||
|
|||
// 检查是否为SHP文件
|
|||
if (entry.getName().toLowerCase().endsWith(".shp")) { |
|||
shpFound = true; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// 如果没有找到SHP文件,抛出异常
|
|||
if (!shpFound) { |
|||
throw new FileNotFoundException("ZIP压缩包中未找到SHP文件"); |
|||
} |
|||
} catch (ZipException e) { |
|||
// 非ZIP输入流,抛出异常
|
|||
throw new IllegalArgumentException("输入流不是有效的ZIP格式", e); |
|||
} |
|||
|
|||
// 查找第一个.shp文件
|
|||
File shpFile = findFirstShpFile(tempDir); |
|||
if (shpFile == null) { |
|||
throw new FileNotFoundException("未找到SHP文件"); |
|||
} |
|||
|
|||
// 使用找到的SHP文件路径调用现有方法
|
|||
resultList = analysisShpFile(shpFile.getAbsolutePath(), charset); |
|||
|
|||
} catch (Exception e) { |
|||
log.error("处理SHP文件输入流失败: {}", e.getMessage(), e); |
|||
throw new RuntimeException("处理SHP文件失败", e); |
|||
} finally { |
|||
// 尝试删除临时目录及其内容
|
|||
if (tempDir != null && tempDir.exists()) { |
|||
deleteDirectory(tempDir); |
|||
} |
|||
//关闭流文件
|
|||
try { |
|||
shpInputStream.close(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
|
|||
return resultList; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 读取shp文件的主要方法 |
|||
* |
|||
* @param shpPath shp文件路径 |
|||
* @param charset 字符编码 |
|||
* @return 要素集合,包含地理位置和属性信息 |
|||
*/ |
|||
public static List<Map<String, String>> analysisShpFile(String shpPath, String charset) { |
|||
// 存储解析出的要素集合
|
|||
List<Map<String, String>> resultList = new ArrayList<>(); |
|||
|
|||
try { |
|||
// 1、验证文件在路径中是否存在
|
|||
File shpFile = new File(shpPath); |
|||
if (!shpFile.exists()) { |
|||
log.error("shp文件不存在:{} ", shpPath); |
|||
return resultList; |
|||
} |
|||
|
|||
// 2、设置GeoTools坐标的字符编码
|
|||
System.setProperty("org.geotools.referencing.charset", charset); |
|||
System.setProperty("org.geotools.shapefile.charset", charset); |
|||
|
|||
// 3、获取数据存储实例
|
|||
FileDataStore dataStore = FileDataStoreFinder.getDataStore(shpFile); |
|||
if (ObjectUtil.isEmpty(dataStore)) { |
|||
log.error("无法打开shape文件:{} ", shpPath); |
|||
return resultList; |
|||
} |
|||
|
|||
// 4、设置shp文件的DBF文件编码
|
|||
if (dataStore instanceof ShapefileDataStore) { |
|||
((ShapefileDataStore) dataStore).setCharset(Charset.forName(charset)); |
|||
} |
|||
|
|||
try { |
|||
// 5、获取要素源和要素集合
|
|||
SimpleFeatureSource featureSource = dataStore.getFeatureSource(); |
|||
SimpleFeatureCollection featureCollection = featureSource.getFeatures(); |
|||
String typeName = dataStore.getTypeNames()[0]; |
|||
CoordinateReferenceSystem sourceCRS = dataStore.getFeatureSource(typeName).getSchema().getCoordinateReferenceSystem(); |
|||
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326"); |
|||
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true); |
|||
|
|||
// 遍历处理每个要素
|
|||
try (SimpleFeatureIterator iterator = featureCollection.features()) { |
|||
while (iterator.hasNext()) { |
|||
SimpleFeature feature = iterator.next(); |
|||
Map<String, String> featureMap = new HashMap<>(); |
|||
|
|||
for (Property property : feature.getProperties()) { |
|||
String name = property.getName().toString(); |
|||
Object value = property.getValue(); |
|||
|
|||
// 处理几何数据
|
|||
try { |
|||
if (value instanceof Geometry) { |
|||
// 如果值本身就是Geometry类型,直接使用
|
|||
value = analysisGeometry((Geometry) value, transform); |
|||
} |
|||
} catch (Exception e) { |
|||
log.warn("Error processing geometry for property {}: {}", name, e.getMessage()); |
|||
} |
|||
|
|||
// 处理特殊字段
|
|||
if (name.startsWith(CHECK_FIELD)) { |
|||
Map<String, String> parsedValues = parseOComValue(value); |
|||
featureMap.putAll(parsedValues); |
|||
} else { |
|||
featureMap.put(name, value.toString()); |
|||
} |
|||
} |
|||
|
|||
resultList.add(featureMap); |
|||
} |
|||
} |
|||
} finally { |
|||
// 确保数据存储被正确关闭
|
|||
dataStore.dispose(); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
log.error("读取shape文件失败: {}", e.getMessage()); |
|||
} |
|||
|
|||
return resultList; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 解析O_Com字段值 |
|||
* |
|||
* @param oComValue O_Com字段值 |
|||
* @return 解析后的属性Map |
|||
*/ |
|||
private static Map<String, String> parseOComValue(Object oComValue) { |
|||
// 初始化返回结果Map
|
|||
Map<String, String> attributes = new HashMap<>(); |
|||
if (ObjectUtil.isEmpty(oComValue)) return attributes; |
|||
|
|||
// 预处理字符串,去除多余空格
|
|||
String comStr = oComValue.toString().trim(); |
|||
|
|||
try { |
|||
// 按分号分割键值对
|
|||
String[] pairs = comStr.split(";"); |
|||
for (String pair : pairs) { |
|||
pair = pair.trim(); |
|||
if (pair.isEmpty()) continue; |
|||
|
|||
// 解析键值对
|
|||
String[] keyValue = pair.split(":"); |
|||
if (keyValue.length == 2) { |
|||
// 清理键值中的引号
|
|||
String key = keyValue[0].trim().replace("\"", ""); |
|||
String value = keyValue[1].trim().replace("\"", ""); |
|||
|
|||
// 直接存储字符串值,不进行类型转换
|
|||
attributes.put(key, value); |
|||
} |
|||
} |
|||
} catch (Exception e) { |
|||
log.error("解析O_Com字段值失败: {}", e.getMessage()); |
|||
} |
|||
|
|||
return attributes; |
|||
} |
|||
|
|||
|
|||
private static String analysisGeometry(Geometry geometry, MathTransform transform) throws TransformException { |
|||
String resultStr = ""; |
|||
// 对每个 Polygon 进行坐标转换
|
|||
Geometry transformedGeometry = JTS.transform(geometry, transform); |
|||
MultiPolygon multiPolygon = (MultiPolygon) transformedGeometry; |
|||
Geometry unionGeometry = UnaryUnionOp.union(multiPolygon); |
|||
if (unionGeometry instanceof Polygon) { |
|||
Polygon polygon = (Polygon) unionGeometry; |
|||
resultStr = convertPolygonToWKT(polygon); |
|||
} |
|||
|
|||
return resultStr; |
|||
} |
|||
|
|||
|
|||
|
|||
private static String convertPolygonToWKT(Polygon polygon) { |
|||
StringBuffer polygonSb = new StringBuffer("GEOMETRYCOLLECTION(POLYGON(("); |
|||
|
|||
Coordinate[] coordinates = polygon.getCoordinates(); |
|||
for (int i = 0; i < coordinates.length; i++) { |
|||
Coordinate coord = coordinates[i]; |
|||
if (i > 0) polygonSb.append(","); |
|||
polygonSb.append(coord.y + " " + coord.x); |
|||
} |
|||
if(coordinates[0].x !=coordinates[coordinates.length-1].x){ |
|||
polygonSb.append(","+coordinates[0].y + " " + coordinates[0].x); |
|||
} |
|||
polygonSb.append(")))"); |
|||
return polygonSb.toString(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 递归删除目录 |
|||
* @param directory 要删除的目录 |
|||
*/ |
|||
private static void deleteDirectory(File directory) { |
|||
File[] files = directory.listFiles(); |
|||
if (files != null) { |
|||
for (File file : files) { |
|||
if (file.isDirectory()) { |
|||
deleteDirectory(file); |
|||
} else { |
|||
boolean deleted = file.delete(); |
|||
if (!deleted) { |
|||
log.warn("删除文件 {} 失败", file.getAbsolutePath()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
boolean dirDeleted = directory.delete(); |
|||
if (!dirDeleted) { |
|||
log.warn("删除目录 {} 失败", directory.getAbsolutePath()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 在指定目录中查找第一个.shp文件 |
|||
* @param directory 搜索目录 |
|||
* @return 找到的第一个.shp文件,未找到返回null |
|||
*/ |
|||
private static File findFirstShpFile(File directory) { |
|||
File[] files = directory.listFiles((dir, name) -> name.toLowerCase().endsWith(".shp")); |
|||
return files != null && files.length > 0 ? files[0] : null; |
|||
} |
|||
|
|||
|
|||
} |
@ -1,11 +0,0 @@ |
|||
<?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="org.dromara.business.mapper.BusinessPatrolAreasPointsMapper"> |
|||
<select id="listPatrolAreasPointByAreaId" resultType="org.dromara.business.domain.BusinessPatrolAreasPoints"> |
|||
select * from business_patrol_area_points po |
|||
where |
|||
po.del_flag = 0 |
|||
and po.area_id = #{areaId} |
|||
order by po.sort_number asc |
|||
</select> |
|||
</mapper> |
@ -1,9 +0,0 @@ |
|||
<?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="org.dromara.business.mapper.BusinessPatrolAreasUserMapper"> |
|||
<select id="listPatrolAreasUserByAreaId" resultType="org.dromara.business.domain.BusinessPatrolAreasUser"> |
|||
select * from business_patrol_area_users au |
|||
where au.del_flag = 0 |
|||
and au.area_id = #{areaId} |
|||
</select> |
|||
</mapper> |
@ -1,10 +0,0 @@ |
|||
<?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="org.dromara.business.mapper.BusinessPlatformInfoCodeMapper"> |
|||
<select id="listPlatformInfoCodeByPlatformInfoId" resultType="org.dromara.business.domain.BusinessPlatformInfoCode"> |
|||
select * from business_platform_info_code |
|||
where |
|||
del_flag = 0 |
|||
and platform_info_id = #{platformInfoId} |
|||
</select> |
|||
</mapper> |
@ -1,31 +0,0 @@ |
|||
<?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="org.dromara.business.mapper.BusinessPlatformInfoMapper"> |
|||
<resultMap id="listPlatformInfoMap" type="org.dromara.business.domain.BusinessPlatformInfo"> |
|||
<result column="id" property="id" jdbcType="VARCHAR"/> |
|||
<result column="platform_name" property="platformName" jdbcType="VARCHAR"/> |
|||
<result column="platform_type" property="platformType" jdbcType="VARCHAR"/> |
|||
<result column="image_url" property="imageUrl" jdbcType="VARCHAR"/> |
|||
<result column="image_app_url" property="imageAppUrl" jdbcType="VARCHAR"/> |
|||
<result column="sort" property="sort"/> |
|||
<result column="create_by" property="createBy" jdbcType="VARCHAR"/> |
|||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
|||
<collection column="{platformInfoId=id}" |
|||
property="platformInfoCodes" ofType="org.dromara.business.domain.BusinessPlatformInfoCode" |
|||
javaType="java.util.ArrayList" |
|||
select="org.dromara.business.mapper.BusinessPlatformInfoCodeMapper.listPlatformInfoCodeByPlatformInfoId"/> |
|||
</resultMap> |
|||
|
|||
<select id="listPlatformInfo" resultMap="listPlatformInfoMap"> |
|||
select * from business_platform_info |
|||
where |
|||
del_flag = 0 |
|||
<if test="condition.search != null and condition.search != ''"> |
|||
and (platform_name like concat(concat('%',#{condition.search}),'%') |
|||
or platform_type like concat(concat('%',#{condition.search}),'%') |
|||
) |
|||
</if> |
|||
order by sort asc |
|||
</select> |
|||
|
|||
</mapper> |
@ -1,5 +1,7 @@ |
|||
<?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="org.dromara.business.mapper.BusinessPatrolAreasPlatformMapper"> |
|||
<mapper namespace="org.dromara.business.mapper.BusinessVectorDictItemMapper"> |
|||
|
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,28 @@ |
|||
<?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="org.dromara.business.mapper.BusinessVectorDictMapper"> |
|||
|
|||
<resultMap id="fieldResultMap" type="org.dromara.business.domain.BusinessVectorDict"> |
|||
<id property="id" column="id"/> |
|||
<result property="dictCode" column="dictCode"/> |
|||
<collection property="fieldMappingsList" ofType="org.dromara.business.domain.BusinessVectorDictItem"> |
|||
<result property="id" column="dictItemId"/> |
|||
<result property="itemValue" column="mappingValue"/> |
|||
<result property="dictId" column="dictId"/> |
|||
</collection> |
|||
</resultMap> |
|||
|
|||
<select id="listVectorField" resultMap="fieldResultMap"> |
|||
SELECT |
|||
f.id AS id, |
|||
f.dict_code AS dictCode, |
|||
m.dict_id AS dictId, |
|||
m.id AS dictItemId, |
|||
m.item_value AS mappingValue |
|||
FROM |
|||
vector_field_dict f |
|||
LEFT JOIN |
|||
vector_field_dict_item m ON f.id = m.dict_id |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue