完成第一版的功能
This commit is contained in:
@@ -68,16 +68,14 @@ public class DataFileController {
|
|||||||
* @param dataFileQo 数据文件实体
|
* @param dataFileQo 数据文件实体
|
||||||
* @param leftFile 左影像文件
|
* @param leftFile 左影像文件
|
||||||
* @param rightFile 右影像文件
|
* @param rightFile 右影像文件
|
||||||
* @param token
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value="/add",method = RequestMethod.POST)
|
@RequestMapping(value="/add",method = RequestMethod.POST)
|
||||||
public String uploadDataFile(DataFileQo dataFileQo,
|
public String uploadDataFile(DataFileQo dataFileQo,
|
||||||
@RequestPart("leftFile") MultipartFile leftFile,
|
@RequestPart("leftFile") MultipartFile leftFile,
|
||||||
@RequestPart("rightFile") MultipartFile rightFile,
|
@RequestPart("rightFile") MultipartFile rightFile) {
|
||||||
@RequestHeader(value="Authorization") String token) {
|
|
||||||
if(dataFileQo.getFileName() == null){
|
if(dataFileQo.getFileName() == null){
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"文件参数不能为空!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"文件名称不能为空!",locale);
|
||||||
}
|
}
|
||||||
if(leftFile.isEmpty()){
|
if(leftFile.isEmpty()){
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"左影像文件为空!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"左影像文件为空!",locale);
|
||||||
@@ -86,8 +84,8 @@ public class DataFileController {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"右影像文件为空!",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,"右影像文件为空!",locale);
|
||||||
}
|
}
|
||||||
// 获取当前用户名
|
// 获取当前用户名
|
||||||
String userName = getTokenUserName(token);
|
//String userName = getTokenUserName(token);
|
||||||
ResultVo resVo = dataFileService.uploadDataFile(dataFileQo,leftFile,rightFile,userName);
|
ResultVo resVo = dataFileService.uploadDataFile(dataFileQo,leftFile,rightFile,"userName");
|
||||||
if(resVo.getResultCode()!=0){
|
if(resVo.getResultCode()!=0){
|
||||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,resVo.getResultMessage(),locale);
|
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL,resVo.getResultMessage(),locale);
|
||||||
}
|
}
|
||||||
|
@@ -9,11 +9,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.RegEx;
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 线程池执行
|
* 线程池执行
|
||||||
@@ -54,19 +51,14 @@ public class AsyncServiceImpl implements AsyncService {
|
|||||||
public void executeRunData(Integer id,String dataFileCode,String leftFilePath,String rightFilePath,String maxX,String maxY,String minX,String minY){
|
public void executeRunData(Integer id,String dataFileCode,String leftFilePath,String rightFilePath,String maxX,String maxY,String minX,String minY){
|
||||||
String[] params = {gsmExePath,"-l",leftFilePath,"-r",rightFilePath,"-o",gsmOutPath + dataFileCode,
|
String[] params = {gsmExePath,"-l",leftFilePath,"-r",rightFilePath,"-o",gsmOutPath + dataFileCode,
|
||||||
"--maxx",maxX,"--maxy",maxY,"--minx",minX,"--miny",minY};
|
"--maxx",maxX,"--maxy",maxY,"--minx",minX,"--miny",minY};
|
||||||
|
ProcessBuilder processBuilder = new ProcessBuilder(params);
|
||||||
|
processBuilder.redirectErrorStream(true);
|
||||||
|
processBuilder.inheritIO();
|
||||||
try {
|
try {
|
||||||
// 执行命令
|
// 执行命令
|
||||||
Process process = Runtime.getRuntime().exec(params);
|
Process process = processBuilder.start();
|
||||||
|
|
||||||
// 读取执行结果
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
|
||||||
String line;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
System.out.println(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 等待执行结束
|
// 等待执行结束
|
||||||
int exitCode = process.waitFor();
|
process.waitFor();
|
||||||
DataFileEntity dataFileEntity = dataFileDao.findById(id).get();
|
DataFileEntity dataFileEntity = dataFileDao.findById(id).get();
|
||||||
dataFileEntity.setRunFlag(2);
|
dataFileEntity.setRunFlag(2);
|
||||||
dataFileDao.save(dataFileEntity);
|
dataFileDao.save(dataFileEntity);
|
||||||
@@ -74,7 +66,7 @@ public class AsyncServiceImpl implements AsyncService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// 如果出现异常将文件的运行状态改为未运行
|
// 如果出现异常将文件的运行状态改为未运行
|
||||||
DataFileEntity dataFileEntity = dataFileDao.findById(id).get();
|
DataFileEntity dataFileEntity = dataFileDao.findById(id).get();
|
||||||
dataFileEntity.setRunFlag(0);
|
dataFileEntity.setRunFlag(3);
|
||||||
dataFileDao.save(dataFileEntity);
|
dataFileDao.save(dataFileEntity);
|
||||||
}
|
}
|
||||||
//不管运行结果怎么样都把文件锁去掉
|
//不管运行结果怎么样都把文件锁去掉
|
||||||
|
@@ -38,9 +38,6 @@ import static com.xkrs.microservice.util.ZipUtil.unZip;
|
|||||||
@CacheConfig(cacheNames = "DataFileServiceCache")
|
@CacheConfig(cacheNames = "DataFileServiceCache")
|
||||||
public class DataFileServiceImpl implements DataFileService {
|
public class DataFileServiceImpl implements DataFileService {
|
||||||
|
|
||||||
@Value("${my.TempFilePath}")
|
|
||||||
private String tempFilePath;
|
|
||||||
|
|
||||||
@Value("${my.FileServerPath}")
|
@Value("${my.FileServerPath}")
|
||||||
private String fileServerPath;
|
private String fileServerPath;
|
||||||
|
|
||||||
@@ -62,7 +59,6 @@ public class DataFileServiceImpl implements DataFileService {
|
|||||||
* 获取所有数据文件
|
* 获取所有数据文件
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<DataFileEntity> getAllDataFile(){
|
public Iterable<DataFileEntity> getAllDataFile(){
|
||||||
return dataFileDao.findAll();
|
return dataFileDao.findAll();
|
||||||
@@ -215,7 +211,6 @@ public class DataFileServiceImpl implements DataFileService {
|
|||||||
mapServiceDao.save(mapServiceEntityOne);
|
mapServiceDao.save(mapServiceEntityOne);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -32,7 +32,7 @@ spring.redis.lettuce.pool.min-idle = 1
|
|||||||
spring.redis.lettuce.shutdown-timeout = 0
|
spring.redis.lettuce.shutdown-timeout = 0
|
||||||
|
|
||||||
# 自定义Geoserver服务器地址
|
# 自定义Geoserver服务器地址
|
||||||
my.GeoserverAddress = http://localhost:9080/geoserver
|
my.GeoserverAddress = http://172.16.40.31:9080/geoserver
|
||||||
my.GeoUsername = admin
|
my.GeoUsername = admin
|
||||||
my.GeoPassword = geoserver
|
my.GeoPassword = geoserver
|
||||||
my.GeoWorkSpace = gsm_gui
|
my.GeoWorkSpace = gsm_gui
|
||||||
|
Reference in New Issue
Block a user