|
|
@@ -49,12 +49,10 @@ public class ThematicImpl implements ThematicService {
|
|
|
private FzssFxrwrzHandleService fzssFxrwrzHandleService;
|
|
|
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
private CadastreFileMapper cadastreFileMapper;
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public R<Object> list(String name, String rwlx, Integer page, Integer limit) {
|
|
|
try {
|
|
|
@@ -126,7 +124,7 @@ public class ThematicImpl implements ThematicService {
|
|
|
// 更新状态为运行中
|
|
|
thematicMapper.updateRwzt(uuid, "1");
|
|
|
//TODO command ProcessBuilder
|
|
|
- ProcessBuilder pb = new ProcessBuilder(pythonHome, finalPyPath,"","","","","");
|
|
|
+ ProcessBuilder pb = new ProcessBuilder(pythonHome, finalPyPath, "", "", "", "", "");
|
|
|
pb.redirectErrorStream(true);
|
|
|
Process process = null;
|
|
|
process = pb.start();
|
|
|
@@ -149,7 +147,7 @@ public class ThematicImpl implements ThematicService {
|
|
|
String[] args = cur.split("\\|\\|");
|
|
|
String id = StringUtils.getUUID();
|
|
|
// 处理文件路径
|
|
|
- args[1] = StringUtils.replaceEach(args[1], new String[]{"D:","\\"},new String[]{"","/"});
|
|
|
+ args[1] = StringUtils.replaceEach(args[1], new String[]{"D:", "\\"}, new String[]{"", "/"});
|
|
|
// 插入制图产品表
|
|
|
thematicMapper.addDetails(id, uuid, args[0], args[1], args[2]);
|
|
|
}
|
|
|
@@ -163,14 +161,12 @@ public class ThematicImpl implements ThematicService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
- return R.ok("制图任务创建成功!id:"+uuid);
|
|
|
+ return R.ok("制图任务创建成功!id:" + uuid);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
- public R<Object> launchStandard(String name, String ztfw, String fwlx,String blc,String bh) {
|
|
|
+ public R<Object> launchStandard(String name, String ztfw, String fwlx, String blc, String bh) {
|
|
|
String uuid = StringUtils.getUUID();
|
|
|
// 插入制图任务表
|
|
|
thematicMapper.addRw(uuid, name, "1", ztfw, "", "");
|
|
|
@@ -179,37 +175,42 @@ public class ThematicImpl implements ThematicService {
|
|
|
String tfhInfo = ""; //图幅号信息
|
|
|
String ewkt = "";
|
|
|
|
|
|
- if(fwlx.equals("1")){ //1行政区;2地籍区;3地籍子区;4.单个图幅,5.自定义范围
|
|
|
+ if (fwlx.equals("1")) { //1行政区;2地籍区;3地籍子区;4.单个图幅,5.自定义范围
|
|
|
tfhInfo = "3206.0-39385.5,3206.0-39386.0,3206.5-39384.5";
|
|
|
- }else if(fwlx.equals("2")){
|
|
|
+ } else if (fwlx.equals("2")) {
|
|
|
// 根据地籍区的编号获取
|
|
|
- Map<String,Object> map = cadastreFileMapper.selectTableDataByBsm("djq",bh);
|
|
|
- if(MapUtils.isNotEmpty(map)){
|
|
|
+ Map<String, Object> map = cadastreFileMapper.selectTableDataByBsm("djq", bh);
|
|
|
+ if (MapUtils.isNotEmpty(map)) {
|
|
|
ewkt = (String) map.get("geom2");
|
|
|
}
|
|
|
} else if (fwlx.equals("3")) {
|
|
|
// 根据地籍区的编号获取
|
|
|
- Map<String,Object> map = cadastreFileMapper.selectTableDataByBsm("djzq",bh);
|
|
|
- if(MapUtils.isNotEmpty(map)){
|
|
|
+ Map<String, Object> map = cadastreFileMapper.selectTableDataByBsm("djzq", bh);
|
|
|
+ if (MapUtils.isNotEmpty(map)) {
|
|
|
ewkt = (String) map.get("geom2");
|
|
|
}
|
|
|
- } else if (fwlx.equals("4")) {
|
|
|
- tfhInfo = "3206.0-39385.5,3206.0-39386.0,3206.5-39384.5";
|
|
|
- }else if (fwlx.equals("5")) {
|
|
|
- ewkt = ztfw;
|
|
|
+ } else if (fwlx.equals("4")) { //单个图幅
|
|
|
+ tfhInfo = bh;
|
|
|
+ } else if (fwlx.equals("5")) { //自定义范围
|
|
|
+ if (StringUtils.isNotBlank(ztfw)) {
|
|
|
+ if (!ztfw.contains("SRID=")) {
|
|
|
+ ztfw = "SRID=" + "4326" + ";" + ztfw;
|
|
|
+ }
|
|
|
+ ewkt = ztfw;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isBlank(tfhInfo) && StringUtils.isNotBlank(blc) && StringUtils.isNotBlank(ewkt)){
|
|
|
+ if (StringUtils.isBlank(tfhInfo) && StringUtils.isNotBlank(blc) && StringUtils.isNotBlank(ewkt)) {
|
|
|
String tableName = "";
|
|
|
- if("500".equals(blc)){
|
|
|
+ if ("500".equals(blc)) {
|
|
|
tableName = "tf_500";
|
|
|
- }else if("1000".equals(blc)){
|
|
|
+ } else if ("1000".equals(blc)) {
|
|
|
tableName = "tf_1000";
|
|
|
- }else if("2000".equals(blc)){
|
|
|
+ } else if ("2000".equals(blc)) {
|
|
|
tableName = "tf_2000";
|
|
|
}
|
|
|
- List<Map<String,Object>> intersectsResult = cadastreFileMapper.intersectsTableWkt(tableName,"",ewkt);
|
|
|
- if(CollectionUtils.isEmpty(intersectsResult)){
|
|
|
+ List<Map<String, Object>> intersectsResult = cadastreFileMapper.intersectsTableWkt(tableName, "", ewkt);
|
|
|
+ if (CollectionUtils.isEmpty(intersectsResult)) {
|
|
|
throw new ServiceException("该区域不在可制图范围内");
|
|
|
}
|
|
|
tfhInfo = intersectsResult.stream()
|
|
|
@@ -217,12 +218,12 @@ public class ThematicImpl implements ThematicService {
|
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.joining(","));
|
|
|
}
|
|
|
- if(StringUtils.isBlank(tfhInfo)){
|
|
|
+ if (StringUtils.isBlank(tfhInfo)) {
|
|
|
throw new ServiceException("查询不到图幅号");
|
|
|
}
|
|
|
|
|
|
// 判断需要执行的python脚本
|
|
|
- String tempPath = temppath+"专题图制作/地籍图/"+name+uuid+"/";
|
|
|
+ String tempPath = temppath + "专题图制作/地籍图/" + name + uuid + "/";
|
|
|
String tfh = tfhInfo; //图幅号
|
|
|
String finalPyPath = cadastralmapPy;
|
|
|
// 异步线程执行分析
|
|
|
@@ -232,7 +233,7 @@ public class ThematicImpl implements ThematicService {
|
|
|
// 更新状态为运行中
|
|
|
thematicMapper.updateRwzt(uuid, "1");
|
|
|
//TODO command ProcessBuilder
|
|
|
- ProcessBuilder pb = new ProcessBuilder(pythonHome, finalPyPath,blc,tempPath,tfh);
|
|
|
+ ProcessBuilder pb = new ProcessBuilder(pythonHome, finalPyPath, blc, tempPath, tfh);
|
|
|
pb.redirectErrorStream(true);
|
|
|
Process process = null;
|
|
|
process = pb.start();
|
|
|
@@ -255,7 +256,7 @@ public class ThematicImpl implements ThematicService {
|
|
|
String[] args = cur.split("\\|\\|");
|
|
|
String id = StringUtils.getUUID();
|
|
|
// 处理文件路径
|
|
|
- args[1] = StringUtils.replaceEach(args[1], new String[]{"D:","\\"},new String[]{"","/"});
|
|
|
+ args[1] = StringUtils.replaceEach(args[1], new String[]{"D:", "\\"}, new String[]{"", "/"});
|
|
|
// 插入制图产品表
|
|
|
thematicMapper.addDetails(id, uuid, args[0], args[1], args[2]);
|
|
|
}
|
|
|
@@ -269,18 +270,17 @@ public class ThematicImpl implements ThematicService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
- return R.ok("制图任务创建成功!id:"+uuid);
|
|
|
+ return R.ok("制图任务创建成功!id:" + uuid);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
- public R<Object> launchLand(String name, String ztry, String ztdw,String fwlx,String bh) {
|
|
|
+ public R<Object> launchLand(String name, String ztry, String ztdw, String fwlx, String bh) {
|
|
|
String uuid = StringUtils.getUUID();
|
|
|
// 插入制图任务表
|
|
|
- thematicMapper.addRw(uuid, name, "3", fwlx, ztry, ztdw);
|
|
|
+ thematicMapper.addRw(uuid, name, "3", "", ztry, ztdw);
|
|
|
fzssFxrwrzHandleService.insertFxrwrz(uuid, "宗地制图", "任务创建成功", "info");
|
|
|
- String tempPath = temppath+"专题图制作/宗地图/"+name+uuid+"/";
|
|
|
+ String tempPath = temppath + "专题图制作/宗地图/" + name + uuid + "/";
|
|
|
String finalPyPath = parcelmapPy;
|
|
|
String zdh = bh;
|
|
|
|
|
|
@@ -292,10 +292,10 @@ public class ThematicImpl implements ThematicService {
|
|
|
thematicMapper.updateRwzt(uuid, "1");
|
|
|
//TODO command ProcessBuilder
|
|
|
ProcessBuilder pb = null;
|
|
|
- if(StringUtils.isBlank(zdh)){ //全量制作,慎用
|
|
|
- pb = new ProcessBuilder(pythonHome,finalPyPath,tempPath,ztdw,ztry);
|
|
|
- }else {
|
|
|
- pb = new ProcessBuilder(pythonHome,finalPyPath,tempPath,ztdw,ztry,zdh);
|
|
|
+ if (StringUtils.isBlank(zdh)) { //全量制作,慎用
|
|
|
+ pb = new ProcessBuilder(pythonHome, finalPyPath, tempPath, ztdw, ztry);
|
|
|
+ } else {
|
|
|
+ pb = new ProcessBuilder(pythonHome, finalPyPath, tempPath, ztdw, ztry, zdh);
|
|
|
}
|
|
|
pb.redirectErrorStream(true);
|
|
|
Process process = null;
|
|
|
@@ -318,7 +318,7 @@ public class ThematicImpl implements ThematicService {
|
|
|
String[] args = cur.split("\\|\\|");
|
|
|
String id = StringUtils.getUUID();
|
|
|
// 处理文件路径
|
|
|
- args[1] = StringUtils.replaceEach(args[1], new String[]{"D:","\\"},new String[]{"","/"});
|
|
|
+ args[1] = StringUtils.replaceEach(args[1], new String[]{"D:", "\\"}, new String[]{"", "/"});
|
|
|
// 插入制图产品表
|
|
|
thematicMapper.addDetails(id, uuid, args[0], args[1], args[2]);
|
|
|
}
|
|
|
@@ -332,29 +332,119 @@ public class ThematicImpl implements ThematicService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|
|
|
- return R.ok("制图任务创建成功!id:"+uuid);
|
|
|
+ return R.ok("制图任务创建成功!id:" + uuid);
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //todo 自定义
|
|
|
+ @Override
|
|
|
+ public R<Object> launchCustom(String name, String ztfw, String ztbt, String ztry, String ztdw, String fwlx, String bh) {
|
|
|
+ String uuid = StringUtils.getUUID();
|
|
|
+ // 插入制图任务表 2---自定义制图
|
|
|
+ thematicMapper.addRw(uuid, name, "2", "2", ztfw, "");
|
|
|
+ fzssFxrwrzHandleService.insertFxrwrz(uuid, "自定义制图", "任务创建成功", "info");
|
|
|
+ //这里根据类型,获取比例尺相关表的图幅号:
|
|
|
+ String tfhInfo = ""; //图幅号信息
|
|
|
+ String ewkt = "";
|
|
|
|
|
|
+ if (fwlx.equals("1")) { //1行政区;2地籍区;3地籍子区;4.单个图幅,5.自定义范围
|
|
|
+ tfhInfo = "3206.0-39385.5,3206.0-39386.0,3206.5-39384.5";
|
|
|
+ } else if (fwlx.equals("2")) {
|
|
|
+ // 根据地籍区的编号获取
|
|
|
+ Map<String, Object> map = cadastreFileMapper.selectTableDataByBsm("djq", bh);
|
|
|
+ if (MapUtils.isNotEmpty(map)) {
|
|
|
+ ewkt = (String) map.get("geom2");
|
|
|
+ }
|
|
|
+ } else if (fwlx.equals("3")) {
|
|
|
+ // 根据地籍区的编号获取
|
|
|
+ Map<String, Object> map = cadastreFileMapper.selectTableDataByBsm("djzq", bh);
|
|
|
+ if (MapUtils.isNotEmpty(map)) {
|
|
|
+ ewkt = (String) map.get("geom2");
|
|
|
+ }
|
|
|
+ } else if (fwlx.equals("4")) { //单个图幅
|
|
|
+ tfhInfo = bh;
|
|
|
+ } else if (fwlx.equals("5")) { //自定义范围
|
|
|
+ if (StringUtils.isNotBlank(ztfw)) {
|
|
|
+ if (!ztfw.contains("SRID=")) {
|
|
|
+ ztfw = "SRID=" + "4326" + ";" + ztfw;
|
|
|
+ }
|
|
|
+ ewkt = ztfw;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ String blc = "500"; //todo 暂时固定500
|
|
|
+ if (StringUtils.isBlank(tfhInfo) && StringUtils.isNotBlank(blc) && StringUtils.isNotBlank(ewkt)) {
|
|
|
+ String tableName = "";
|
|
|
+ if ("500".equals(blc)) {
|
|
|
+ tableName = "tf_500";
|
|
|
+ } else if ("1000".equals(blc)) {
|
|
|
+ tableName = "tf_1000";
|
|
|
+ } else if ("2000".equals(blc)) {
|
|
|
+ tableName = "tf_2000";
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> intersectsResult = cadastreFileMapper.intersectsTableWkt(tableName, "", ewkt);
|
|
|
+ if (CollectionUtils.isEmpty(intersectsResult)) {
|
|
|
+ throw new ServiceException("该区域不在可制图范围内");
|
|
|
+ }
|
|
|
+ tfhInfo = intersectsResult.stream()
|
|
|
+ .map(s -> (String) s.get("tfh")) // 直接转为String
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(tfhInfo)) {
|
|
|
+ throw new ServiceException("查询不到图幅号");
|
|
|
+ }
|
|
|
|
|
|
+ // 判断需要执行的python脚本
|
|
|
+ String tempPath = temppath + "专题图制作/自定义/" + name + uuid + "/";
|
|
|
+ String tfh = tfhInfo; //图幅号
|
|
|
+ String finalPyPath = cadastralmapPy;
|
|
|
+ // 异步线程执行分析
|
|
|
+ FixedThreadUtil.FIXED_THREAD_POOL.execute(() -> {
|
|
|
+ try {
|
|
|
+ fzssFxrwrzHandleService.insertFxrwrz(uuid, "自定义制图", "开始制图任务。。。", "info");
|
|
|
+ // 更新状态为运行中
|
|
|
+ thematicMapper.updateRwzt(uuid, "1");
|
|
|
+ //TODO command ProcessBuilder
|
|
|
+ ProcessBuilder pb = new ProcessBuilder(pythonHome, finalPyPath, blc, tempPath, tfh);
|
|
|
+ pb.redirectErrorStream(true);
|
|
|
+ Process process = null;
|
|
|
+ process = pb.start();
|
|
|
+ fzssFxrwrzHandleService.insertFxrwrz(uuid, "自定义制图", "制图任务启动。。。", "info");
|
|
|
+ BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
|
|
+ String line;
|
|
|
+ ArrayList<String> datas = new ArrayList<>();
|
|
|
+ while ((line = reader.readLine()) != null) {
|
|
|
+ if (StringUtils.isNotEmpty(line)) {
|
|
|
+ if (line.contains("||")) {
|
|
|
+ datas.add(line.split("ERROR")[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (datas.size() > 0) {
|
|
|
+ // 更新状态为成功
|
|
|
+ thematicMapper.updateRwzt2(uuid, "2");
|
|
|
+ for (String cur : datas) {
|
|
|
+ String[] args = cur.split("\\|\\|");
|
|
|
+ String id = StringUtils.getUUID();
|
|
|
+ // 处理文件路径
|
|
|
+ args[1] = StringUtils.replaceEach(args[1], new String[]{"D:", "\\"}, new String[]{"", "/"});
|
|
|
+ // 插入制图产品表
|
|
|
+ thematicMapper.addDetails(id, uuid, args[0], args[1], args[2]);
|
|
|
+ }
|
|
|
+ fzssFxrwrzHandleService.insertFxrwrz(uuid, "自定义制图", "制图成功", "info");
|
|
|
+ } else {
|
|
|
+ // 更新状态为失败
|
|
|
+ thematicMapper.updateRwzt2(uuid, "3");
|
|
|
+ fzssFxrwrzHandleService.insertFxrwrz(uuid, "自定义制图", "制图失败", "info");
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return R.ok("制图任务创建成功!id:" + uuid);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|