提交 f5c0f289 authored 作者: 张航's avatar 张航

添加了可以继续下载

上级 ec7edba1
......@@ -46,11 +46,14 @@ public class DownMap implements ApplicationRunner {
private int maxLv; // 最大层级
@Value("${map.Lv6.flag}")
private boolean flag; // 记录前六级是否打开下载
private boolean lvFlag; // 记录前六级是否打开下载
@Value("${map.download.append}")
private boolean appendFlag; // 是否是继续下载
@Override
public void run(ApplicationArguments args) throws Exception {
if (flag){
if (lvFlag){
return;
}
......@@ -163,11 +166,14 @@ public class DownMap implements ApplicationRunner {
try {
//高德地图(6:影像,7:矢量,8:影像路网)
imgUrl = CLStringUtil.getImgUrl(z, x, y);
File file = CLStringUtil.getFullFile(z, x, y);
File file = appendFlag ? CLStringUtil.getFullFileNotExist(z,x,y):CLStringUtil.getFullFile(z, x, y);
// 开始下载地图
HttpUtil.downImageByGet(imgUrl, file);
return imgUrl + " Success";
if (file != null){
HttpUtil.downImageByGet(imgUrl, file);
return imgUrl + " Success";
}
return imgUrl + " Loaded";
} catch (Exception e) {
//log.error(imgUrl + " Down Failed");
errResults.add("Failed: " + imgUrl + " ErrorMsg >> " + e.getMessage());
......
......@@ -64,6 +64,29 @@ public class CLStringUtil {
return FileUtil.file(fullFileName);
}
/**
* @param z
* @param x
* @param y
* @description: 根据传入的 z\x\y来创建本地图片路径
* @return: java.lang.String
* @author: zhanghang
* @date: 2020/4/2
**/
public static File getFullFileNotExist(Integer z, Integer x, Integer y) {
String fullFileName;
if (MAP_TYPE == "ArcGIS"){
fullFileName = getArcGISFullFile(z,x,y);
}else {
fullFileName = BASE_PATH + z + File.separator + x + File.separator + y + ".png";
}
File file = new File(fullFileName);
if (file.exists()){
return null;
}
return FileUtil.file(fullFileName);
}
/**
* @param z
......
......@@ -26,3 +26,6 @@ map.threadNum=1000
# 是否下载前6级(不能与其余的同时进行)
map.Lv6.flag=false
# 是否继续下载
map.download.append=false
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论