| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 标绘 |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class MarkService implements MarkMapper { |
| | | @Resource |
| | | MarkMapper markMapper; |
| | |
| | | return markMapper.updates(list); |
| | | } |
| | | |
| | | /** |
| | | * 下载ShapeFile文件 |
| | | * |
| | | * @param ue 用户实体 |
| | | * @param list 标绘JSON实体类集合 |
| | | * @return GUID |
| | | * @throws Exception 异常 |
| | | */ |
| | | public String downloadShp(UserEntity ue, List<MarkJsonEntity> list) throws Exception { |
| | | String path = pathHelper.getTempPath(); |
| | | createShapeFiles(ue, list, path); |
| | |
| | | return rows > 0 ? de.getGuid() : null; |
| | | } |
| | | |
| | | /** |
| | | * 创建shp文件 |
| | | */ |
| | | private String createShapeFiles(UserEntity ue, List<MarkJsonEntity> list, String path) { |
| | | List<MarkJsonEntity> points = getMarkByType(list, "POINT"); |
| | | if (points.size() > 0) { |
| | |
| | | return path; |
| | | } |
| | | |
| | | /** |
| | | * 获取shp目录 |
| | | */ |
| | | private String getShpDir(UserEntity ue, String parent) { |
| | | String path = parent + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()); |
| | | |
| | |
| | | return path; |
| | | } |
| | | |
| | | /** |
| | | * 获取标绘类型 |
| | | */ |
| | | private List<MarkJsonEntity> getMarkByType(List<MarkJsonEntity> list, String type) { |
| | | List<MarkJsonEntity> rs = new ArrayList<>(); |
| | | for (MarkJsonEntity mark : list) { |
| | |
| | | return rs; |
| | | } |
| | | |
| | | /** |
| | | * 获取zip路径 |
| | | */ |
| | | private String getZipPath() { |
| | | String path = pathHelper.getDownloadFullPath() + File.separator + StringHelper.YMDHMS2_FORMAT.format(new Date()) + ".zip"; |
| | | |
| | |
| | | return path; |
| | | } |
| | | |
| | | /** |
| | | * 获取下载实体类 |
| | | */ |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file) throws Exception { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | |
| | | return de; |
| | | } |
| | | |
| | | /** |
| | | * 获取下载文件路径 |
| | | */ |
| | | public String getDownloadFilePath(DownloadEntity de) { |
| | | return pathHelper.getConfig().getDownloadPath() + File.separator + de.getUrl(); |
| | | } |
| | | |
| | | /** |
| | | * 读取ShapeFile文件获取Mark实体类 |
| | | */ |
| | | public List<MarkJsonEntity> readShpForMarks(List<MetaFileEntity> list) { |
| | | String fileName = null; |
| | | for (MetaFileEntity mf : list) { |