Compare commits

..

No commits in common. "165dce67861a3b01a6e3fac1866ae27f66bc4d34" and "6a5c3f1fc0e7c40475825efe17e47d82d241e9d9" have entirely different histories.

6 changed files with 34 additions and 29 deletions

View File

@ -151,27 +151,31 @@ public class BaseAPIServiceImpl implements BaseAPIService {
return (lat >= minLat && lat <= maxLat && lon >= minLon && lon <= maxLon); return (lat >= minLat && lat <= maxLat && lon >= minLon && lon <= maxLon);
} }
@Override
public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) {
return eventServerProperties.getBaseHome() +
File.separator +
modelPath +
File.separator +
createBy +
File.separator +
engineeringName +
File.separator;
}
// @Override // @Override
// public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) { // public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) {
// return eventServerProperties.getBaseHome() + // return eventServerProperties.getBaseHome() +
// "/" + // File.separator +
// modelPath + // modelPath +
// "/" + // File.separator +
// createBy + // createBy +
// "/" + // File.separator +
// engineeringName + // engineeringName +
// "/"; // File.separator;
// } // }
@Override
public String buildEngineeringFilePath(String modelPath, String createBy, String engineeringName) {
return eventServerProperties.getBaseHome() +
// File.separator +
"/" +
modelPath +
// File.separator +
"/" +
createBy +
// File.separator +
"/" +
engineeringName +
"/";
// File.separator;
}
} }

View File

@ -133,7 +133,7 @@ public class CmaqServiceImpl extends ServiceImpl<CmaqMapper, Cmaq> implements Cm
public Result<String> genMcipTxtFile(String mcipPath, String emisPath, Cmaq cmaq, String sDate, Double lon, Double lat) { public Result<String> genMcipTxtFile(String mcipPath, String emisPath, Cmaq cmaq, String sDate, Double lon, Double lat) {
try { try {
List<String> gridDescFileValue = Files.readAllLines(get(mcipPath + "GRIDDESC.d03")); List<String> gridDescFileValue = Files.readAllLines(get("E:\\wm\\resultFile\\" + "GRIDDESC.d03"));
List<String> fileValues = Arrays.stream(gridDescFileValue.get(5).split(" ")).filter(s -> StringUtils.isNotBlank(s)).collect(Collectors.toList()); List<String> fileValues = Arrays.stream(gridDescFileValue.get(5).split(" ")).filter(s -> StringUtils.isNotBlank(s)).collect(Collectors.toList());
List<String> domainValues = new ArrayList<>(); List<String> domainValues = new ArrayList<>();
@ -172,7 +172,8 @@ public class CmaqServiceImpl extends ServiceImpl<CmaqMapper, Cmaq> implements Cm
public boolean getFileExists(String filePath){ public boolean getFileExists(String filePath){
String cmdResult = RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), String cmdResult = RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(),
"ls " + filePath); "ls " + filePath);
return !cmdResult.contains("没有那个文件或目录") || !cmdResult.contains("No such file or directory"); boolean succesfully = cmdResult.indexOf("没有那个文件或目录") < 0;
return succesfully;
} }
@Override @Override

View File

@ -64,8 +64,8 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
@Override @Override
public void initDir(Engineering engineering){ public void initDir(Engineering engineering){
String baseHome = eventServerProperties.getBaseHome() + File.separator; // String baseHome = eventServerProperties.getBaseHome() + File.separator;
// String baseHome = eventServerProperties.getBaseHome() + "/"; String baseHome = eventServerProperties.getBaseHome() + "/";
String ip = eventServerProperties.getIp(); String ip = eventServerProperties.getIp();
String username = eventServerProperties.getUsername(); String username = eventServerProperties.getUsername();
String password = eventServerProperties.getPassword(); String password = eventServerProperties.getPassword();

View File

@ -53,7 +53,7 @@ public class RunProcessController {
bizEngineering.setEventType(paramVO.getEventType()); bizEngineering.setEventType(paramVO.getEventType());
bizEngineering.setEnginStatus(2); bizEngineering.setEnginStatus(2);
engineeringService.updateById(bizEngineering); engineeringService.updateById(bizEngineering);
engineeringService.initDir(bizEngineering); // engineeringService.initDir(bizEngineering);
wrfService.updateWrfInfo(paramVO); wrfService.updateWrfInfo(paramVO);
cmaqService.updateCmaqInfo(paramVO); cmaqService.updateCmaqInfo(paramVO);
runProcessService.runAllExe(paramVO); runProcessService.runAllExe(paramVO);

View File

@ -17,6 +17,6 @@ public interface WrfService extends IService<Wrf> {
Result<String> updateWrfInfo(RunProcessParamVO paramVO); Result<String> updateWrfInfo(RunProcessParamVO paramVO);
String genWpsShell(String scriptsPath, String fileName, Wrf wrf) throws IOException; String genWpsShell(String scriptsPath, String fileName, Wrf wrf) throws IOException;
Result<String> runAllWrf(String engId, String scriptsPath, String workDirPath) throws IOException; Result<String> runAllWrf(String engId, String scriptsPath, String resultFilePath) throws IOException;
} }

View File

@ -115,9 +115,9 @@ public class WrfServiceImpl extends ServiceImpl<WrfMapper, Wrf> implements WrfSe
} }
@Override @Override
public Result<String> runAllWrf(String engId, String scriptsPath, String workDirPath) throws IOException { public Result<String> runAllWrf(String engId, String scriptsPath, String resultFilePath) throws IOException {
String cdShRunPath = "cd " + scriptsPath + ";"; String cdShRunPath = "cd " + scriptsPath + ";";
boolean wpsSuccess = runProjectWps(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wps.sh;./run_project_wps.sh", workDirPath); boolean wpsSuccess = runProjectWps(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wps.sh;./run_project_wps.sh", resultFilePath);
if (!wpsSuccess){ if (!wpsSuccess){
return Result.error("WPS模块运行异常请查看日志信息"); return Result.error("WPS模块运行异常请查看日志信息");
} }
@ -125,25 +125,25 @@ public class WrfServiceImpl extends ServiceImpl<WrfMapper, Wrf> implements WrfSe
RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(),
runPyPath(scriptsPath, "update_num_metgrid_levels.py", null)); runPyPath(scriptsPath, "update_num_metgrid_levels.py", null));
boolean wrfSuccess = runProjectWrf(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wrf.sh;./run_project_wrf.sh", workDirPath); boolean wrfSuccess = runProjectWrf(cdShRunPath + "source ~/.bash_profile;chmod +x run_project_wrf.sh;./run_project_wrf.sh", resultFilePath);
if (!wrfSuccess){ if (!wrfSuccess){
return Result.error("WRF模块运行异常请查看日志信息"); return Result.error("WRF模块运行异常请查看日志信息");
} }
return Result.ok(); return Result.ok();
} }
public boolean runProjectWps(String cmdString,String workDirPath) throws IOException { public boolean runProjectWps(String cmdString,String resultFilePath) throws IOException {
RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), cmdString); RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), cmdString);
String metgridLog = new String(readAllBytes(get(workDirPath + EventConstants.WRF_DIR+ "/metgrid.log"))); String metgridLog = new String(readAllBytes(get(resultFilePath + EventConstants.WRF_DIR+ "/metgrid.log")));
if(metgridLog.indexOf("Successful completion of program metgrid.exe") > 0){ if(metgridLog.indexOf("Successful completion of program metgrid.exe") > 0){
return true; return true;
} }
return false; return false;
} }
public boolean runProjectWrf(String cmdString,String workDirPath) throws IOException { public boolean runProjectWrf(String cmdString,String resultFilePath) throws IOException {
RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), cmdString); RemoteExecuteCommand.runRemoteLinuxCmd(eventServerProperties.getIp(), eventServerProperties.getUsername(), eventServerProperties.getPassword(), cmdString);
String wrfLog = new String(readAllBytes(get(workDirPath + EventConstants.WRF_DIR + "/rsl.out.0000"))); String wrfLog = new String(readAllBytes(get(resultFilePath + EventConstants.WRF_DIR + "/rsl.out.0000")));
if(wrfLog.indexOf("SUCCESS COMPLETE WRF") > 0){ if(wrfLog.indexOf("SUCCESS COMPLETE WRF") > 0){
return true; return true;
} }