| | |
| | | package com.lf.server.service.show; |
| | | |
| | | import com.lf.server.entity.all.BaseGeoEntity; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.data.DownloadEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.show.PipelineEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.mapper.data.DownloadMapper; |
| | | import com.lf.server.mapper.show.PipelineMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import net.lingala.zip4j.ZipFile; |
| | | import net.lingala.zip4j.model.FileHeader; |
| | | import net.lingala.zip4j.model.ZipParameters; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | |
| | | |
| | | import java.io.File; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | return pipelineMapper.selectPipeAnalysis(tab, gid); |
| | | } |
| | | |
| | | @Override |
| | | public List<PipelineEntity> selectAnalysisResult(String tab, Integer gid) { |
| | | return pipelineMapper.selectAnalysisResult(tab, gid); |
| | | } |
| | | |
| | | /** |
| | | * 创建Zip包 |
| | | * |
| | |
| | | * @return 下载文件GUID |
| | | */ |
| | | public String createZipFile(UserEntity ue, Map<String, List<PipelineEntity>> map, String pwd) throws Exception { |
| | | if (map.size() == 0) { |
| | | return null; |
| | | } |
| | | |
| | | String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); |
| | | String tempPath = pathHelper.getTempPath(tempName); |
| | | String filePath = tempPath + File.separator + tempName + ".gdb"; |
| | |
| | | try { |
| | | driver = ogr.GetDriverByName("FileGDB"); |
| | | if (null == driver) { |
| | | log.error("GdbHelper.createGdb.driver(FileGDB) is null."); |
| | | log.error("PipelineService.createGdb.driver(FileGDB) is null."); |
| | | return; |
| | | } |
| | | dataSource = driver.CreateDataSource(filePath, null); |
| | | if (null == dataSource) { |
| | | log.error("GdbHelper.createGdb.dataSource is null. " + filePath); |
| | | log.error("PipelineService.createGdb.dataSource is null. " + filePath); |
| | | return; |
| | | } |
| | | |
| | |
| | | Layer layer = null; |
| | | try { |
| | | List<PipelineEntity> list = map.get(key); |
| | | layer = createLayer(dataSource, key, list.get(0)); |
| | | layer = createLayer(dataSource, key.replace(".", "_"), list.get(0)); |
| | | |
| | | List<Field> fields = new ArrayList<>(); |
| | | getFields(PipelineEntity.class, fields); |
| | |
| | | try { |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | for (Field f : fields) { |
| | | if (StaticData.GDB_EXCLUDE_FIELDS.contains(f.getName())) { |
| | | if (StaticData.PIPE_EXCLUDE_FIELDS.contains(f.getName())) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | | // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析 |
| | | // 1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析,6-统计报告 |
| | | de.setType(5); |
| | | de.setSizes(FileHelper.sizeToMb(new File(file).length())); |
| | | de.setDepid(ue.getDepid()); |