| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 管道分析服务类 |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class PipelineService implements PipelineMapper { |
| | | @Autowired |
| | | PathHelper pathHelper; |
| | |
| | | return pipelineMapper.selectPipeAnalysis(tab, gid); |
| | | } |
| | | |
| | | /** |
| | | * 创建Zip包 |
| | | * |
| | | * @param ue 用户实体 |
| | | * @param map 管道分析数据集合 |
| | | * @param pwd 密码 |
| | | * @return 下载文件GUID |
| | | */ |
| | | public String createZipFile(UserEntity ue, Map<String, List<PipelineEntity>> map, String pwd) throws Exception { |
| | | String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); |
| | | String tempPath = pathHelper.getTempPath(tempName); |
| | |
| | | return rows > 0 ? downloadEntity.getGuid() : null; |
| | | } |
| | | |
| | | /** |
| | | * 创建GDB |
| | | */ |
| | | public static void createGdb(String filePath, Map<String, List<PipelineEntity>> map) throws Exception { |
| | | Driver driver = null; |
| | | DataSource dataSource = null; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建图层 |
| | | */ |
| | | private static Layer createLayer(DataSource dataSource, String tab, PipelineEntity pe) { |
| | | int geomType = pe.getWkt().contains("POINT") ? ogr.wkbMultiPoint : ogr.wkbMultiLineString; |
| | | |
| | |
| | | return dataSource.CreateLayer(tab, sr, geomType, null); |
| | | } |
| | | |
| | | /** |
| | | * 获取字段 |
| | | */ |
| | | private static void getFields(Class clazz, List<Field> list) { |
| | | try { |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置图层数据 |
| | | */ |
| | | private static void setLayerData(Layer layer, List<Field> fields, List<PipelineEntity> list) throws Exception { |
| | | for (PipelineEntity t : list) { |
| | | Feature f = new Feature(layer.GetLayerDefn()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加Zip文件 |
| | | */ |
| | | private void addZipFiles(ZipFile zip, ZipParameters params, File[] files) { |
| | | if (null == files || files.length == 0) { |
| | | return; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取下载实体类 |
| | | */ |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |