1、工程管理添加用户分组
2、添加统一上传接口
This commit is contained in:
parent
e546731444
commit
bb54679b87
|
@ -252,6 +252,12 @@
|
|||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
<!-- ssh2远程连接 -->
|
||||
<dependency>
|
||||
<groupId>ch.ethz.ganymed</groupId>
|
||||
<artifactId>ganymed-ssh2</artifactId>
|
||||
<version>build210</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,242 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
/**
|
||||
* Created by hpp on 2017/6/5.
|
||||
*/
|
||||
|
||||
import ch.ethz.ssh2.Connection;
|
||||
import ch.ethz.ssh2.Session;
|
||||
import ch.ethz.ssh2.StreamGobbler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 远程执行linux的shell script
|
||||
* @author Ickes
|
||||
* @author2 hpp
|
||||
* @since V0.2
|
||||
*/
|
||||
public class RemoteExecuteCommand {
|
||||
//字符编码默认是utf-8
|
||||
private static String DEFAULTCHART="UTF-8";
|
||||
private static Connection conn;
|
||||
private String ip;
|
||||
private String userName;
|
||||
private String userPwd;
|
||||
|
||||
public RemoteExecuteCommand(String ip, String userName, String userPwd) {
|
||||
this.ip = ip;
|
||||
this.userName = userName;
|
||||
this.userPwd = userPwd;
|
||||
}
|
||||
|
||||
public RemoteExecuteCommand() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程登录linux的主机
|
||||
* @author Ickes
|
||||
* @since V0.1
|
||||
* @return
|
||||
* 登录成功返回true,否则返回false
|
||||
*/
|
||||
public Boolean login(){
|
||||
boolean flg=false;
|
||||
try {
|
||||
conn = new Connection(ip);
|
||||
conn.connect();//连接
|
||||
flg=conn.authenticateWithPassword(userName, userPwd);//认证
|
||||
if (flg){
|
||||
System.out.println("认证成功!");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return flg;
|
||||
}
|
||||
/**
|
||||
* @author Ickes
|
||||
* 远程执行shll脚本或者命令
|
||||
* @param cmd
|
||||
* 即将执行的命令
|
||||
* @return
|
||||
* 命令执行完后返回的结果值
|
||||
* @since V0.1
|
||||
*/
|
||||
public String execute(String cmd){
|
||||
String result="";
|
||||
try {
|
||||
if(login()){
|
||||
Session session= conn.openSession();//打开一个会话
|
||||
session.execCommand(cmd);//执行命令
|
||||
result=processStdout(session.getStdout(),DEFAULTCHART);
|
||||
//如果为得到标准输出为空,说明脚本执行出错了
|
||||
if(StringUtils.isBlank(result)){
|
||||
result=processStdout(session.getStderr(),DEFAULTCHART);
|
||||
}
|
||||
conn.close();
|
||||
session.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author Ickes
|
||||
* 远程执行shll脚本或者命令
|
||||
* @param cmd
|
||||
* 即将执行的命令
|
||||
* @return
|
||||
* 命令执行成功后返回的结果值,如果命令执行失败,返回空字符串,不是null
|
||||
* @since V0.1
|
||||
*/
|
||||
public String executeSuccess(String cmd){
|
||||
String result="";
|
||||
try {
|
||||
if(login()){
|
||||
Session session= conn.openSession();//打开一个会话
|
||||
session.execCommand(cmd);//执行命令
|
||||
result=processStdout(session.getStdout(),DEFAULTCHART);
|
||||
conn.close();
|
||||
session.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析脚本执行返回的结果集
|
||||
* @author Ickes
|
||||
* @param in 输入流对象
|
||||
* @param charset 编码
|
||||
* @since V0.1
|
||||
* @return
|
||||
* 以纯文本的格式返回
|
||||
*/
|
||||
public static String processStdout(InputStream in, String charset){
|
||||
InputStream stdout = new StreamGobbler(in);
|
||||
StringBuffer buffer = new StringBuffer();;
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(stdout,charset));
|
||||
String line=null;
|
||||
while((line=br.readLine()) != null){
|
||||
buffer.append(line+"\n");
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
//远程连接并执行多条linux命令
|
||||
public static List<String> runRemoteLinuxCmd(String linux_ip,String linux_username,String password, List<String> lines) {
|
||||
System.out.println("runRemoteLinuxCmds");
|
||||
//执行的命令返回结果
|
||||
List<String> resultList = new ArrayList<>();
|
||||
if(lines!=null && lines.size()>0 && StringUtils.isNotBlank(linux_ip) && StringUtils.isNotBlank(linux_username) && StringUtils.isNotBlank(password)){
|
||||
RemoteExecuteCommand remote = new RemoteExecuteCommand(linux_ip,linux_username,password);
|
||||
for (String cmd : lines) {
|
||||
System.out.println("cmdString:" + cmd);
|
||||
String execute = remote.execute(cmd);
|
||||
resultList.add(execute);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
//远程连接并执行单条linux命令
|
||||
public static String runRemoteLinuxCmd(String linux_ip,String linux_username,String password, String cmd) {
|
||||
System.out.println("cmdString:" + cmd);
|
||||
//执行的命令返回结果
|
||||
String executeResult = "";
|
||||
if(StringUtils.isNotBlank(cmd) && StringUtils.isNotBlank(linux_ip) && StringUtils.isNotBlank(linux_username) && StringUtils.isNotBlank(password)){
|
||||
RemoteExecuteCommand remote = new RemoteExecuteCommand(linux_ip,linux_username,password);
|
||||
executeResult = remote.execute(cmd);
|
||||
}
|
||||
return executeResult;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
RemoteExecuteCommand rec=new RemoteExecuteCommand("172.21.70.56", "oracle","123!@#qwe");
|
||||
//执行命令
|
||||
try {
|
||||
if(rec.login()){
|
||||
|
||||
System.out.println("=====第一个步骤=====");
|
||||
Session session= conn.openSession();//打开一个会话
|
||||
//TODO:多条命令
|
||||
session.execCommand("/usr/bin/gmt --version");//执行命令
|
||||
String result=processStdout(session.getStdout(),DEFAULTCHART);
|
||||
//如果为得到标准输出为空,说明脚本执行出错了
|
||||
if(StringUtils.isBlank(result)){
|
||||
System.out.println("脚本出错");
|
||||
result=processStdout(session.getStderr(),DEFAULTCHART);
|
||||
}
|
||||
System.out.println(result);
|
||||
session.close();
|
||||
|
||||
// System.out.println("=====第二个步骤=====");
|
||||
// Session session2= conn.openSession();//打开一个会话
|
||||
// //TODO:多条命令
|
||||
// session2.execCommand("cd /home/ubuntu/Desktop/music_rec/user_sim/result;cat xyy_result_m10d.json");//执行命令
|
||||
// String result2=processStdout(session2.getStdout(),DEFAULTCHART);
|
||||
// //如果为得到标准输出为空,说明脚本执行出错了
|
||||
// if(StringUtils.isBlank(result2)){
|
||||
// System.out.println("脚本出错");
|
||||
// result2=processStdout(session2.getStderr(),DEFAULTCHART);
|
||||
// }
|
||||
// System.out.println(result2);
|
||||
// session2.close();
|
||||
|
||||
|
||||
conn.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void setCharset(String charset) {
|
||||
DEFAULTCHART = charset;
|
||||
}
|
||||
public Connection getConn() {
|
||||
return conn;
|
||||
}
|
||||
public void setConn(Connection conn) {
|
||||
this.conn = conn;
|
||||
}
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
public String getUserPwd() {
|
||||
return userPwd;
|
||||
}
|
||||
public void setUserPwd(String userPwd) {
|
||||
this.userPwd = userPwd;
|
||||
}
|
||||
}
|
|
@ -39,11 +39,71 @@
|
|||
<artifactId>drag-free</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
<!-- 积木报表 mongo redis 支持包
|
||||
<!-- 读取 .nc 文件 -->
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>netcdf4</artifactId>
|
||||
<version>4.5.5</version>
|
||||
</dependency>
|
||||
<!-- csv操作包 -->
|
||||
<dependency>
|
||||
<groupId>com.opencsv</groupId>
|
||||
<artifactId>opencsv</artifactId>
|
||||
<version>4.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<version>0.1.54</version>
|
||||
</dependency>
|
||||
<!-- 积木报表 mongo redis 支持包
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.jimureport</groupId>
|
||||
<artifactId>jimureport-nosql-starter</artifactId>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- 读取 .nc 文件 -->
|
||||
<dependency>
|
||||
<groupId>edu.ucar</groupId>
|
||||
<artifactId>netcdf4</artifactId>
|
||||
<version>4.5.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.15</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.13</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,270 @@
|
|||
package org.jeecg.modules.project.bizCmaq.controller;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.project.bizCmaq.entity.BizCmaq;
|
||||
import org.jeecg.modules.project.bizCmaq.service.IBizCmaqService;
|
||||
import static java.nio.file.Files.readAllBytes;
|
||||
import static java.nio.file.Paths.get;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.service.IBizWrfService;
|
||||
import org.jeecg.modules.project.util.CmdUtil;
|
||||
import org.jeecg.modules.project.util.SFTPUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import ucar.ma2.Array;
|
||||
import ucar.ma2.Index;
|
||||
import ucar.nc2.NetcdfFile;
|
||||
import ucar.nc2.Variable;
|
||||
import ucar.nc2.dataset.NetcdfDataset;
|
||||
|
||||
/**
|
||||
* @Description: CMAQ
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="CMAQ")
|
||||
@RestController
|
||||
@RequestMapping("/bizCmaq")
|
||||
@Slf4j
|
||||
public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService> {
|
||||
@Autowired
|
||||
private IBizCmaqService bizCmaqService;
|
||||
@Autowired
|
||||
private IBizWrfService bizWrfService;
|
||||
|
||||
|
||||
// private String cshPath = "C:\\Users\\13673\\Documents\\WeChat Files\\wxid_v7skypcxmgno22\\FileStorage\\File\\2022-12\\run_cctm_Bench_tem.csh";
|
||||
// private String cmaqPath = "C:\\Users\\13673\\Documents\\WeChat Files\\wxid_v7skypcxmgno22\\FileStorage\\File\\2022-12\\run_cctm_Bench_2016_12SE1.csh";
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param bizCmaq
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "CMAQ-分页列表查询")
|
||||
@ApiOperation(value="CMAQ-分页列表查询", notes="CMAQ-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<BizCmaq>> queryPageList(BizCmaq bizCmaq,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BizCmaq> queryWrapper = QueryGenerator.initQueryWrapper(bizCmaq, req.getParameterMap());
|
||||
Page<BizCmaq> page = new Page<BizCmaq>(pageNo, pageSize);
|
||||
IPage<BizCmaq> pageList = bizCmaqService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getCmaqNCFileInfo")
|
||||
public Result<List<List<Double[]>>> getCmaqNCFileInfo(int layer) {
|
||||
List<List<Double[]>> resultAll = bizCmaqService.getNCFileInfo(layer);
|
||||
if(resultAll == null || resultAll.isEmpty()){
|
||||
Result.error("请运行CMAQ程序!");
|
||||
}
|
||||
return Result.OK(resultAll);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bizCmaq
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "CMAQ-添加")
|
||||
@ApiOperation(value="CMAQ-添加", notes="CMAQ-添加")
|
||||
//@RequiresPermissions("bizCmaq:biz_cmaq:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BizCmaq bizCmaq) {
|
||||
BizWrf wrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizCmaq.getEngineeringId()));
|
||||
bizCmaq.setColsN(Double.valueOf(wrf.getWe()) -3 + "");
|
||||
bizCmaq.setRowsN(Double.valueOf(wrf.getSn()) -3 + "");
|
||||
bizCmaq.setWrfLcRefLat(wrf.getRefLat());
|
||||
bizCmaqService.saveOrUpdate(bizCmaq);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bizCmaq
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "CMAQ-编辑")
|
||||
@ApiOperation(value="CMAQ-编辑", notes="CMAQ-编辑")
|
||||
//@RequiresPermissions("bizCmaq:biz_cmaq:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BizCmaq bizCmaq) {
|
||||
bizCmaqService.updateById(bizCmaq);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "CMAQ-通过id删除")
|
||||
@ApiOperation(value="CMAQ-通过id删除", notes="CMAQ-通过id删除")
|
||||
//@RequiresPermissions("bizCmaq:biz_cmaq:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bizCmaqService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "CMAQ-批量删除")
|
||||
@ApiOperation(value="CMAQ-批量删除", notes="CMAQ-批量删除")
|
||||
//@RequiresPermissions("bizCmaq:biz_cmaq:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.bizCmaqService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "CMAQ-通过id查询")
|
||||
@ApiOperation(value="CMAQ-通过id查询", notes="CMAQ-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BizCmaq> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BizCmaq bizCmaq = bizCmaqService.getById(id);
|
||||
if(bizCmaq==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bizCmaq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询cmaq参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "wrf-查询cmaq参数")
|
||||
@ApiOperation(value="wrf-查询cmaq参数", notes="wrf-查询cmaq参数")
|
||||
@GetMapping(value = "/getCmaqParam")
|
||||
public Result<BizCmaq> getCmaqParam(String engineeringId) {
|
||||
BizCmaq bizCmaq = bizCmaqService.getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,engineeringId));
|
||||
if(bizCmaq==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
BizWrf wrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizCmaq.getEngineeringId()));
|
||||
if(wrf != null){
|
||||
bizCmaq.setColsN(Double.valueOf(wrf.getWe()) -3 + "");
|
||||
bizCmaq.setRowsN(Double.valueOf(wrf.getSn()) -3 + "");
|
||||
bizCmaq.setWrfLcRefLat(wrf.getRefLat());
|
||||
}
|
||||
return Result.OK(bizCmaq);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/runMcipShell")
|
||||
public Result<?> runMcipShell(String engineeringId) {
|
||||
boolean result = bizCmaqService.runMcipShell(engineeringId);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/runIconShell")
|
||||
public Result<?> runIconShell(String engineeringId) {
|
||||
boolean result = bizCmaqService.runIconShell(engineeringId);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/runBconShell")
|
||||
public Result<?> runBconShell(String engineeringId) {
|
||||
boolean result = bizCmaqService.runBconShell(engineeringId);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/runCctmShell")
|
||||
public Result<?> runCctmShell(String engineeringId) {
|
||||
boolean result = bizCmaqService.runCctmShell(engineeringId);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param bizCmaq
|
||||
*/
|
||||
//@RequiresPermissions("bizCmaq:biz_cmaq:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BizCmaq bizCmaq) {
|
||||
return super.exportXls(request, bizCmaq, BizCmaq.class, "CMAQ");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("bizCmaq:biz_cmaq:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BizCmaq.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
package org.jeecg.modules.project.bizCmaq.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: CMAQ
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("biz_cmaq")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="biz_cmaq对象", description="CMAQ")
|
||||
public class BizCmaq implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**start_date*/
|
||||
@Excel(name = "start_date", width = 15)
|
||||
@ApiModelProperty(value = "start_date")
|
||||
private String startDate;
|
||||
/**end_date*/
|
||||
@Excel(name = "end_date", width = 15)
|
||||
@ApiModelProperty(value = "end_date")
|
||||
private String endDate;
|
||||
/**sttime*/
|
||||
@Excel(name = "sttime", width = 15)
|
||||
@ApiModelProperty(value = "sttime")
|
||||
private String sttime;
|
||||
/**nsteps*/
|
||||
@Excel(name = "nsteps", width = 15)
|
||||
@ApiModelProperty(value = "nsteps")
|
||||
private String nsteps;
|
||||
/**tstep*/
|
||||
@Excel(name = "tstep", width = 15)
|
||||
@ApiModelProperty(value = "tstep")
|
||||
private String tstep;
|
||||
/**ctm_maxsync*/
|
||||
@Excel(name = "ctm_maxsync", width = 15)
|
||||
@ApiModelProperty(value = "ctm_maxsync")
|
||||
private String ctmMaxsync;
|
||||
/**ctm_minsync*/
|
||||
@Excel(name = "ctm_minsync", width = 15)
|
||||
@ApiModelProperty(value = "ctm_minsync")
|
||||
private String ctmMinsync;
|
||||
/**sigma_sync_top*/
|
||||
@Excel(name = "sigma_sync_top", width = 15)
|
||||
@ApiModelProperty(value = "sigma_sync_top")
|
||||
private String sigmaSyncTop;
|
||||
/**ctm_adv_cfl*/
|
||||
@Excel(name = "ctm_adv_cfl", width = 15)
|
||||
@ApiModelProperty(value = "ctm_adv_cfl")
|
||||
private String ctmAdvCfl;
|
||||
/**ctm_ocean_chem*/
|
||||
@Excel(name = "ctm_ocean_chem", width = 15)
|
||||
@ApiModelProperty(value = "ctm_ocean_chem")
|
||||
private String ctmOceanChem;
|
||||
/**ctm_wb_dust*/
|
||||
@Excel(name = "ctm_wb_dust", width = 15)
|
||||
@ApiModelProperty(value = "ctm_wb_dust")
|
||||
private String ctmWbDust;
|
||||
/**ctm_ltng_no*/
|
||||
@Excel(name = "ctm_ltng_no", width = 15)
|
||||
@ApiModelProperty(value = "ctm_ltng_no")
|
||||
private String ctmLtngNo;
|
||||
/**kzmin*/
|
||||
@Excel(name = "kzmin", width = 15)
|
||||
@ApiModelProperty(value = "kzmin")
|
||||
private String kzmin;
|
||||
/**ctm_mosaic*/
|
||||
@Excel(name = "ctm_mosaic", width = 15)
|
||||
@ApiModelProperty(value = "ctm_mosaic")
|
||||
private String ctmMosaic;
|
||||
/**ctm_fst*/
|
||||
@Excel(name = "ctm_fst", width = 15)
|
||||
@ApiModelProperty(value = "ctm_fst")
|
||||
private String ctmFst;
|
||||
/**px_version*/
|
||||
@Excel(name = "px_version", width = 15)
|
||||
@ApiModelProperty(value = "px_version")
|
||||
private String pxVersion;
|
||||
/**clm_version*/
|
||||
@Excel(name = "clm_version", width = 15)
|
||||
@ApiModelProperty(value = "clm_version")
|
||||
private String clmVersion;
|
||||
/**noah_version*/
|
||||
@Excel(name = "noah_version", width = 15)
|
||||
@ApiModelProperty(value = "noah_version")
|
||||
private String noahVersion;
|
||||
/**ctm_abflux*/
|
||||
@Excel(name = "ctm_abflux", width = 15)
|
||||
@ApiModelProperty(value = "ctm_abflux")
|
||||
private String ctmAbflux;
|
||||
/**ctm_bidi_fert_nh3*/
|
||||
@Excel(name = "ctm_bidi_fert_nh3", width = 15)
|
||||
@ApiModelProperty(value = "ctm_bidi_fert_nh3")
|
||||
private String ctmBidiFertNh3;
|
||||
/**ctm_hgbidi*/
|
||||
@Excel(name = "ctm_hgbidi", width = 15)
|
||||
@ApiModelProperty(value = "ctm_hgbidi")
|
||||
private String ctmHgbidi;
|
||||
/**ctm_sfc_hono*/
|
||||
@Excel(name = "ctm_sfc_hono", width = 15)
|
||||
@ApiModelProperty(value = "ctm_sfc_hono")
|
||||
private String ctmSfcHono;
|
||||
/**ctm_grav_setl*/
|
||||
@Excel(name = "ctm_grav_setl", width = 15)
|
||||
@ApiModelProperty(value = "ctm_grav_setl")
|
||||
private String ctmGravSetl;
|
||||
/**ctm_biogemis*/
|
||||
@Excel(name = "ctm_biogemis", width = 15)
|
||||
@ApiModelProperty(value = "ctm_biogemis")
|
||||
private String ctmBiogemis;
|
||||
/**icpath*/
|
||||
@Excel(name = "icpath", width = 15)
|
||||
@ApiModelProperty(value = "icpath")
|
||||
private String icpath;
|
||||
/**bcpath*/
|
||||
@Excel(name = "bcpath", width = 15)
|
||||
@ApiModelProperty(value = "bcpath")
|
||||
private String bcpath;
|
||||
/**emispath*/
|
||||
@Excel(name = "emispath", width = 15)
|
||||
@ApiModelProperty(value = "emispath")
|
||||
private String emispath;
|
||||
/**emispath2*/
|
||||
@Excel(name = "emispath2", width = 15)
|
||||
@ApiModelProperty(value = "emispath2")
|
||||
private String emispath2;
|
||||
/**in_ptpath*/
|
||||
@Excel(name = "in_ptpath", width = 15)
|
||||
@ApiModelProperty(value = "in_ptpath")
|
||||
private String inPtpath;
|
||||
/**in_ltpath*/
|
||||
@Excel(name = "in_ltpath", width = 15)
|
||||
@ApiModelProperty(value = "in_ltpath")
|
||||
private String inLtpath;
|
||||
/**metpath*/
|
||||
@Excel(name = "metpath", width = 15)
|
||||
@ApiModelProperty(value = "metpath")
|
||||
private String metpath;
|
||||
/**lupath*/
|
||||
@Excel(name = "lupath", width = 15)
|
||||
@ApiModelProperty(value = "lupath")
|
||||
private String lupath;
|
||||
/**szpath*/
|
||||
@Excel(name = "szpath", width = 15)
|
||||
@ApiModelProperty(value = "szpath")
|
||||
private String szpath;
|
||||
/**fileName*/
|
||||
@Excel(name = "fileName", width = 15)
|
||||
@ApiModelProperty(value = "fileName")
|
||||
private String fileName;
|
||||
@Excel(name = "x0", width = 15)
|
||||
@ApiModelProperty(value = "x0")
|
||||
private String x0;
|
||||
@Excel(name = "y0", width = 15)
|
||||
@ApiModelProperty(value = "y0")
|
||||
private String y0;
|
||||
@Excel(name = "colsN", width = 15)
|
||||
@ApiModelProperty(value = "colsN")
|
||||
private String colsN;
|
||||
@Excel(name = "rowsN", width = 15)
|
||||
@ApiModelProperty(value = "rowsN")
|
||||
private String rowsN;
|
||||
@Excel(name = "wrfLcRefLat", width = 15)
|
||||
@ApiModelProperty(value = "wrfLcRefLat")
|
||||
private String wrfLcRefLat;
|
||||
@Excel(name = "engineeringId", width = 15)
|
||||
@ApiModelProperty(value = "engineeringId")
|
||||
private String engineeringId;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.project.bizCmaq.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.project.bizCmaq.entity.BizCmaq;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: CMAQ
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BizCmaqMapper extends BaseMapper<BizCmaq> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.bizCmaq.mapper.BizCmaqMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,30 @@
|
|||
package org.jeecg.modules.project.bizCmaq.service;
|
||||
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import org.jeecg.modules.project.bizCmaq.entity.BizCmaq;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: CMAQ
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBizCmaqService extends IService<BizCmaq> {
|
||||
|
||||
List<List<Double[]>> getNCFileInfo(int layer);
|
||||
|
||||
boolean runMcipShell(String engineeringId);
|
||||
|
||||
boolean runIconShell(String engineeringId);
|
||||
|
||||
boolean runBconShell(String engineeringId);
|
||||
|
||||
boolean runCctmShell(String engineeringId);
|
||||
|
||||
List<String> getVariableNames();
|
||||
}
|
|
@ -0,0 +1,458 @@
|
|||
package org.jeecg.modules.project.bizCmaq.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.modules.project.bizCmaq.entity.BizCmaq;
|
||||
import org.jeecg.modules.project.bizCmaq.mapper.BizCmaqMapper;
|
||||
import org.jeecg.modules.project.bizCmaq.service.IBizCmaqService;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import org.jeecg.modules.project.bizOpenfoam.service.IBizOpenfoamService;
|
||||
import org.jeecg.modules.project.bizWrf.service.IBizWrfService;
|
||||
import org.jeecg.modules.project.util.CmdUtil;
|
||||
import org.jeecg.modules.project.util.SFTPUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.mapper.BizWrfMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import ucar.ma2.Array;
|
||||
import ucar.ma2.Index;
|
||||
import ucar.nc2.NetcdfFile;
|
||||
import ucar.nc2.Variable;
|
||||
import ucar.nc2.dataset.NetcdfDataset;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static java.nio.file.Files.readAllBytes;
|
||||
import static java.nio.file.Paths.get;
|
||||
|
||||
/**
|
||||
* @Description: CMAQ
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> implements IBizCmaqService {
|
||||
|
||||
@Autowired
|
||||
private BizWrfMapper bizWrfMapper;
|
||||
@Autowired
|
||||
private IBizWrfService bizWrfService;
|
||||
@Autowired
|
||||
private IBizOpenfoamService bizOpenfoamService;
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
@Value("${spring.CMAQ.cmaqLocalShellHome}")
|
||||
private String cmaqLocalShellHome;
|
||||
@Value("${spring.CMAQ.outputLocalPath}")
|
||||
private String outputLocalPath;
|
||||
@Value("${spring.CMAQ.cshTemFielPath}")
|
||||
private String cshTemFielPath;
|
||||
@Value("${spring.CMAQ.pythonPath}")
|
||||
private String pythonPath;
|
||||
@Value("${spring.WRF.wrfLocalPrefix}")
|
||||
private String wrfLocalPrefix;
|
||||
@Value("${spring.Linux.ip}")
|
||||
private String ip;
|
||||
@Value("${spring.Linux.username}")
|
||||
private String username;
|
||||
@Value("${spring.Linux.password}")
|
||||
private String password;
|
||||
@Value("${spring.Linux.port}")
|
||||
private Integer port;
|
||||
|
||||
private String genMcipsShell(String allRunPath, String startTime, String endTime,Integer domain,String ncols,String nrows) throws IOException, SftpException {
|
||||
String fileName = "all_run_mcip.csh";
|
||||
String data = new String(readAllBytes(get(cshTemFielPath + "all_run_mcip_tem.csh")));
|
||||
data = data
|
||||
.replace("#{RUN_PATH}", allRunPath)
|
||||
.replace("#{START_DATE}", startTime)
|
||||
.replace("#{END_DATE}", endTime)
|
||||
.replace("#{domain}", domain+"")
|
||||
.replace("#{NCOLS_ARR}", ncols)
|
||||
.replace("#{NROWS_ARR}", nrows);
|
||||
String targetFilePath = cmaqLocalShellHome + "MCIP/" + fileName;
|
||||
FileUtil.writeString(data, targetFilePath, "UTF-8");
|
||||
sftpUpload(targetFilePath,allRunPath + "CMAQ/PREP/mcip/scripts/", fileName);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public String genIconShell(String allRunPath,String startTime,String endTime,Integer domain){
|
||||
String fileName = "all_run_icon.csh";
|
||||
try {
|
||||
String data = new String(readAllBytes(get(cshTemFielPath + "all_run_icon_tem.csh")));
|
||||
data = data.replace("#{RUN_PATH}", allRunPath).replace("#{START_DATE}", startTime).replace("#{END_DATE}", endTime).replace("#{domain}", domain+"");
|
||||
// todo sftp 上传
|
||||
String targetFilePath = cmaqLocalShellHome + "ICON/" + fileName;
|
||||
FileUtil.writeString(data, targetFilePath, "UTF-8");
|
||||
sftpUpload(targetFilePath,allRunPath + "CMAQ/PREP/icon/scripts/", fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public String genBconShell(String allRunPath,String startTime,String endTime,Integer domain) {
|
||||
String fileName = "all_run_bcon.csh";
|
||||
try {
|
||||
String data = new String(readAllBytes(get(cshTemFielPath + "all_run_bcon_tem.csh")));
|
||||
data = data.replace("#{RUN_PATH}", allRunPath).replace("#{START_DATE}", startTime).replace("#{END_DATE}", endTime).replace("#{domain}", domain + "");
|
||||
// todo sftp 上传
|
||||
String targetFilePath = cmaqLocalShellHome + "BCON/" + fileName;
|
||||
FileUtil.writeString(data, targetFilePath, "UTF-8");
|
||||
sftpUpload(targetFilePath, allRunPath + "CMAQ/PREP/bcon/scripts/", fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public String genCctmShell(String allRunPath, String startDate, String endDate, String stTime, String nSteps, String tStep) {
|
||||
String fileName = "run_cctm_2016.csh";
|
||||
try {
|
||||
String data = new String(readAllBytes(get(cshTemFielPath + "run_cctm_2016_tem.csh")));
|
||||
data = data.replace("#{START_DATE}", startDate).replace("#{END_DATE}", endDate).replace("#{STTIME}", stTime)
|
||||
.replace("#{NSTEPS}", nSteps).replace("#{TSTEP}", tStep);
|
||||
// todo sftp 上传
|
||||
String targetFilePath = cmaqLocalShellHome + "CCTM/" + fileName;
|
||||
FileUtil.writeString(data, targetFilePath, "UTF-8");
|
||||
sftpUpload(targetFilePath,allRunPath + "CMAQ/CCTM/scripts/",fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runMcipShell(String engineeringId) {
|
||||
BizCmaq cmaq = getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,engineeringId));
|
||||
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
|
||||
String allRunPath = baseHome + wrf.getCreateBy() + wrf.getEngineeringId() + "/" + wrf.getTimeStamp() + "/";
|
||||
try {
|
||||
// todo step1 mcip
|
||||
String mcipFileName = genMcipsShell(allRunPath,wrf.getStartTime().substring(0, 10),wrf.getEndTime().substring(0, 10),wrf.getMaxDom(),cmaq.getColsN(),cmaq.getRowsN());
|
||||
// todo 执行mcip.csh
|
||||
runCmd(allRunPath + "CMAQ/","PREP/mcip",mcipFileName);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runIconShell(String engineeringId) {
|
||||
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
String allRunPath = baseHome + wrf.getCreateBy() + wrf.getEngineeringId() + "/" + wrf.getTimeStamp() + "/";
|
||||
try {
|
||||
// todo step2 icon
|
||||
String iconFileName = genIconShell(allRunPath,wrf.getStartTime().substring(0, 10),wrf.getEndTime().substring(0, 10),wrf.getMaxDom());
|
||||
// todo 执行icon.csh
|
||||
runCmd(allRunPath + "CMAQ/","PREP/icon",iconFileName);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runBconShell(String engineeringId) {
|
||||
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
String allRunPath = baseHome + wrf.getCreateBy() + wrf.getEngineeringId() + "/" + wrf.getTimeStamp() + "/";
|
||||
try {
|
||||
// todo step2 bcon
|
||||
String iconFileName = genBconShell(allRunPath,wrf.getStartTime().substring(0, 10),wrf.getEndTime().substring(0, 10),wrf.getMaxDom());
|
||||
// todo 执行bcon.csh
|
||||
runCmd(allRunPath + "CMAQ/","PREP/bcon",iconFileName);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean runGeneratePy(String emisBenchCmd,String METCRO3DCmd,String outputCmd) {
|
||||
String runCmd = String.format("cd %s;./python %sgenerate.py %s %s %s",pythonPath + "rtm/bin/",pythonPath,emisBenchCmd,METCRO3DCmd,outputCmd);
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean runSetvaluePy(String type,String value,String emisOutputCmd,String outputCmd,int x,int y,Integer layer) {
|
||||
String runCmd = String.format("cd %s;./python %ssetvalue.py %s %s %s %s %s %s %s",pythonPath + "rtm/bin/",pythonPath,type,value,emisOutputCmd,outputCmd,x,y,layer);
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean runCctmShell(String engineeringId) {
|
||||
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
BizCmaq cmaq = getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,engineeringId));
|
||||
BizOpenfoam openfoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId, engineeringId));
|
||||
String allRunPath = baseHome + wrf.getCreateBy() + wrf.getEngineeringId() + "/" + wrf.getTimeStamp() + "/";
|
||||
|
||||
String ymdFormat = "yyyy-MM-dd";
|
||||
String yymdFormat = "yyMMdd";
|
||||
String format = "yyyy-MM-dd_hh:mm:ss";
|
||||
DateTime startTime = DateUtil.parse(wrf.getStartTime(), format);
|
||||
DateTime endTime = DateUtil.parse(wrf.getEndTime(), format);
|
||||
long startTimeSecs = startTime.getTime();
|
||||
long endTimeSecs = endTime.getTime();
|
||||
long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
String newStartTime = DateUtil.format(new Date(startTimeSecs + oneDaySecs), ymdFormat);
|
||||
String newEndTime = DateUtil.format(new Date(endTimeSecs - oneDaySecs), ymdFormat);
|
||||
|
||||
String emisBenchPath = String.format("%sCMAQ/data/input/emis/",allRunPath);
|
||||
String emisBenchNcName = "emis_mole_tem.nc";
|
||||
try {
|
||||
sftpUpload(cshTemFielPath + emisBenchNcName, emisBenchPath , emisBenchNcName);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SftpException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (Integer i = 0; i < wrf.getMaxDom(); i++) {
|
||||
for (long tmpSecs = startTimeSecs; tmpSecs < endTimeSecs; tmpSecs += oneDaySecs) {
|
||||
String outputNcName = String.format("emis_mole_d0%s_%s_tem.nc",i+1,DateUtil.format(new Date(tmpSecs), yymdFormat));
|
||||
|
||||
String METCRO3DPath = String.format("%sCMAQ/data/input/mcip/",allRunPath);
|
||||
String METCRO3DNcName = String.format("METCRO3D_d0%s_%s.nc",i+1,DateUtil.format(new Date(tmpSecs), yymdFormat));
|
||||
runGeneratePy(emisBenchPath + emisBenchNcName,METCRO3DPath + METCRO3DNcName,emisBenchPath + outputNcName);
|
||||
|
||||
List<String> coAndPecInfo = bizOpenfoamService.getCoAndPecInfo(wrf);
|
||||
String coNcName = String.format("co_emis_d0%s_%s.nc",i+1,DateUtil.format(new Date(tmpSecs), yymdFormat));
|
||||
String perNcName = String.format("emis_d0%s_%s.nc",i+1,DateUtil.format(new Date(tmpSecs), yymdFormat));
|
||||
runSetvaluePy("CO",coAndPecInfo.get(0),emisBenchPath + outputNcName,emisBenchPath + coNcName,wrf.getXIndex(),wrf.getYIndex(),openfoam.getLayer());
|
||||
runSetvaluePy("PEC",coAndPecInfo.get(1),emisBenchPath + coNcName,emisBenchPath + perNcName,wrf.getXIndex(),wrf.getYIndex(),openfoam.getLayer());
|
||||
}
|
||||
}
|
||||
try {
|
||||
// todo step2 cctm
|
||||
String cctmFileName = genCctmShell(allRunPath,newStartTime,newEndTime,cmaq.getSttime(), cmaq.getNsteps(), cmaq.getTstep());
|
||||
// todo 执行cctm.csh
|
||||
runCmd(allRunPath + "CMAQ/","CCTM",cctmFileName);
|
||||
String ncName = "CCTM_ACONC_v532_2016_12SE1_"+newStartTime.replace("-","")+".nc";
|
||||
String ncLocalName = "CCTM_ACONC_v532_2016_12SE1_"+DateUtil.format(new Date(startTimeSecs), ymdFormat).replace("-","")+".nc";
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "CMAQ/data/output/v532_2016_12SE1/",ncName,outputLocalPath + ncLocalName);
|
||||
sftpUtil.logout();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<List<Double[]>> getNCFileInfo(int layer){
|
||||
List<List<Double[]>> resultAll = new ArrayList<>();
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
BizEngineering bizEngineeringByState = bizEngineeringService.getBizEngineeringByState();
|
||||
BizCmaq bizCmaq = this.baseMapper.selectOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,bizEngineeringByState.getId()));
|
||||
if(bizCmaq != null) {
|
||||
|
||||
NetcdfFile griddot2d = NetcdfDataset.open("C:\\Users\\13673\\Desktop\\某源\\Nuclear\\file\\wrfout_d01_2016-07-01_00_00_00");
|
||||
NetcdfFile ncfile = NetcdfDataset.open("C:\\Users\\13673\\Desktop\\某源\\Nuclear\\file\\CCTM_ACONC_v532_2016_12SE1_20160701.nc");
|
||||
// String ncName = "CCTM_ACONC_v532_2016_12SE1_" + sdf.format(sdf.parse(bizCmaq.getStartDate())).replace("-", "") + ".nc";
|
||||
// NetcdfFile ncfile = NetcdfDataset.open(outputLocalPath + ncName);
|
||||
// BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId, bizEngineeringByState.getId()));
|
||||
// String ncNameWrf = "wrfout_d01_" + bizWrf.getStartTime();
|
||||
// NetcdfFile griddot2d = NetcdfDataset.open(wrfLocalPrefix + ncNameWrf);
|
||||
List<List<List<Double>>> coAllList = getNCByName(ncfile, "CO", layer);
|
||||
List<List<List<Double>>> no2AllList = getNCByName(ncfile, "NO2", layer);
|
||||
List<List<List<Double>>> no3AllList = getNCByName(ncfile, "NO3", layer);
|
||||
List<List<List<Double>>> xlatAllList = getNCByName(griddot2d, "XLAT", layer);
|
||||
List<List<List<Double>>> xlongAllList = getNCByName(griddot2d, "XLONG", layer);
|
||||
|
||||
for (int l = 0; l < coAllList.size(); l++) {
|
||||
List<Double[]> result = new ArrayList<>();
|
||||
for (int i = 0; i < coAllList.get(l).size(); i++) {
|
||||
List<Double> xlats = xlatAllList.get(0).get(i);
|
||||
List<Double> xlongs = xlongAllList.get(0).get(i);
|
||||
List<Double> cos = coAllList.get(l).get(i);
|
||||
List<Double> no2s = no2AllList.get(l).get(i);
|
||||
List<Double> no3s = no3AllList.get(l).get(i);
|
||||
for (int j = 0; j < cos.size(); j++) {
|
||||
Double[] resultArray = new Double[5];
|
||||
resultArray[0] = xlongs.get(j);
|
||||
resultArray[1] = xlats.get(j);
|
||||
resultArray[2] = cos.get(j);
|
||||
resultArray[3] = no2s.get(j);
|
||||
resultArray[4] = no3s.get(j);
|
||||
result.add(resultArray);
|
||||
}
|
||||
}
|
||||
resultAll.add(result);
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultAll;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getVariableNames(){
|
||||
List<String> variableNames = new ArrayList<>();
|
||||
BizEngineering bizEngineeringByState = bizEngineeringService.getBizEngineeringByState();
|
||||
BizCmaq bizCmaq = this.baseMapper.selectOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,bizEngineeringByState.getId()));
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId, bizEngineeringByState.getId()));
|
||||
|
||||
String ymdFormat = "yyyy-MM-dd";
|
||||
String format = "yyyy-MM-dd_hh:mm:ss";
|
||||
DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
long startTimeSecs = startTime.getTime();
|
||||
long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
|
||||
if(bizCmaq != null) {
|
||||
// NetcdfFile ncfile = NetcdfDataset.open("C:\\Users\\13673\\Desktop\\Nuclear\\file\\CCTM_ACONC_v532_intel_Bench_2016_12SE1_20160702.nc");
|
||||
String newStartTime = DateUtil.format(new Date(startTimeSecs + oneDaySecs), ymdFormat);
|
||||
String ncName = "CCTM_ACONC_v532_2016_12SE1_" + newStartTime.replace("-", "") + ".nc";
|
||||
try {
|
||||
NetcdfFile ncfile = NetcdfDataset.open(outputLocalPath + ncName);
|
||||
List<Variable> variables = ncfile.getVariables();
|
||||
variables.forEach(li ->{
|
||||
variableNames.add(li.getShortName());
|
||||
});
|
||||
return variableNames;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void runCmd(String allRunPath,String type,String fileName){
|
||||
String runCmd = "cd " + allRunPath + type+"/scripts/;chmod +x " + fileName + ";./" + fileName;
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
}
|
||||
|
||||
private List<String> everyDay(String beginTime, String endTime) {
|
||||
List<String> allDate = new ArrayList();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
|
||||
Date dBegin = null;
|
||||
Date dEnd = null;
|
||||
try {
|
||||
dBegin = sdf.parse(beginTime);
|
||||
dEnd = sdf.parse(endTime);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
allDate.add(sdf.format(dBegin));
|
||||
Calendar calBegin = Calendar.getInstance();
|
||||
// 使用给定的 Date 设置此 Calendar 的时间
|
||||
calBegin.setTime(dBegin);
|
||||
Calendar calEnd = Calendar.getInstance();
|
||||
// 使用给定的 Date 设置此 Calendar 的时间
|
||||
calEnd.setTime(dEnd);
|
||||
// 测试此日期是否在指定日期之后
|
||||
while (dEnd.after(calBegin.getTime())) {
|
||||
// 根据日历的规则,为给定的日历字段添加或减去指定的时间量
|
||||
calBegin.add(Calendar.DAY_OF_MONTH, 1);
|
||||
allDate.add(sdf.format(calBegin.getTime()));
|
||||
}
|
||||
return allDate;
|
||||
}
|
||||
|
||||
public void sftpUpload(String file,String cshFilePath,String fileName) throws FileNotFoundException, SftpException {
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
sftpUtil.upload(cshFilePath,fileName,inputStream);
|
||||
sftpUtil.logout();
|
||||
}
|
||||
|
||||
public static List<List<List<Double>>> getNCByName(NetcdfFile ncfile, String name,int layer){
|
||||
Variable variable = ncfile.findVariable(name);
|
||||
List<List<List<Double>>> resultAll = new ArrayList<>();
|
||||
|
||||
// 读取nc数据到数组
|
||||
Array data = null;
|
||||
try {
|
||||
data = variable.read();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 获取参数和索引,其中shape的前三个参数分别是时间、纬度、经度
|
||||
int[] shape = data.getShape();
|
||||
Index index = data.getIndex();
|
||||
|
||||
// 将三维数组降维,并用String数组提取数据
|
||||
// 按时间
|
||||
// 按维度
|
||||
if(shape.length == 3){
|
||||
// 将三维数组降维,并用String数组提取数据
|
||||
// 按时间
|
||||
// 按维度
|
||||
for (int i = 0; i < shape[0]; i++) {
|
||||
List<List<Double>> resultPiece = new ArrayList<>();
|
||||
for (int j = 0; j < shape[1]; j++) {
|
||||
List<Double> strings = new ArrayList<>();
|
||||
// 按经度
|
||||
for (int k = 0; k < shape[2]; k++) {
|
||||
// 按照对应索引获取数据并转换为string类型添加到数组中
|
||||
Double dval = Math.round(data.getDouble(index.set(i, j, k)) * 1000) /1000d;
|
||||
strings.add(dval);
|
||||
}
|
||||
resultPiece.add(strings);
|
||||
}
|
||||
resultAll.add(resultPiece);
|
||||
}
|
||||
}else{
|
||||
for (int i = 0; i < shape[0]; i++) {
|
||||
List<List<Double>> resultPiece = new ArrayList<>();
|
||||
for (int j = 0; j < shape[2]; j++) {
|
||||
List<Double> strings = new ArrayList<>();
|
||||
// 按经度
|
||||
for (int k = 0; k < shape[3]; k++) {
|
||||
// 按照对应索引获取数据并转换为string类型添加到数组中
|
||||
Double dval = 0.0;
|
||||
if(name.equals("LATD") || name.equals("LOND")){
|
||||
dval = Math.round(data.getFloat(index.set(i, layer, j, k)) * 10000) /10000d;
|
||||
}else{
|
||||
try {
|
||||
dval = Math.round(data.getDouble(index.set(i, layer, j, k)) * 10000000) /10000000d;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
strings.add(dval);
|
||||
}
|
||||
resultPiece.add(strings);
|
||||
}
|
||||
resultAll.add(resultPiece);
|
||||
}
|
||||
}
|
||||
return resultAll;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String runCmd = "C:\\hky-work\\python\\emis\\python.exe C:\\hky-work\\python\\generate.py C:\\hky-work\\python\\emis_mole_all_20160701_cb6_bench.nc C:\\hky-work\\python\\METCRO3D_d01_160701.nc C:\\hky-work\\python\\a.nc";
|
||||
// String runCmd = "cmd.exe /c start diskmgmt.msc";
|
||||
System.out.println(CmdUtil.execCmd(runCmd));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,363 @@
|
|||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('CMAQ')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
:scroll="{x:true}"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
class="j-table-force-nowrap"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<biz-cmaq-modal ref="modalForm" @ok="modalFormOk"></biz-cmaq-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import '@/assets/less/TableExpand.less'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import BizCmaqModal from './modules/BizCmaqModal'
|
||||
|
||||
export default {
|
||||
name: 'BizCmaqList',
|
||||
mixins:[JeecgListMixin, mixinDevice],
|
||||
components: {
|
||||
BizCmaqModal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: 'CMAQ管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
{
|
||||
title:'start_date',
|
||||
align:"center",
|
||||
dataIndex: 'startDate'
|
||||
},
|
||||
{
|
||||
title:'end_date',
|
||||
align:"center",
|
||||
dataIndex: 'endDate'
|
||||
},
|
||||
{
|
||||
title:'sttime',
|
||||
align:"center",
|
||||
dataIndex: 'sttime'
|
||||
},
|
||||
{
|
||||
title:'nsteps',
|
||||
align:"center",
|
||||
dataIndex: 'nsteps'
|
||||
},
|
||||
{
|
||||
title:'tstep',
|
||||
align:"center",
|
||||
dataIndex: 'tstep'
|
||||
},
|
||||
{
|
||||
title:'ctm_maxsync',
|
||||
align:"center",
|
||||
dataIndex: 'ctmMaxsync'
|
||||
},
|
||||
{
|
||||
title:'ctm_minsync',
|
||||
align:"center",
|
||||
dataIndex: 'ctmMinsync'
|
||||
},
|
||||
{
|
||||
title:'sigma_sync_top',
|
||||
align:"center",
|
||||
dataIndex: 'sigmaSyncTop'
|
||||
},
|
||||
{
|
||||
title:'ctm_adv_cfl',
|
||||
align:"center",
|
||||
dataIndex: 'ctmAdvCfl'
|
||||
},
|
||||
{
|
||||
title:'ctm_ocean_chem',
|
||||
align:"center",
|
||||
dataIndex: 'ctmOceanChem'
|
||||
},
|
||||
{
|
||||
title:'ctm_wb_dust',
|
||||
align:"center",
|
||||
dataIndex: 'ctmWbDust'
|
||||
},
|
||||
{
|
||||
title:'ctm_ltng_no',
|
||||
align:"center",
|
||||
dataIndex: 'ctmLtngNo'
|
||||
},
|
||||
{
|
||||
title:'kzmin',
|
||||
align:"center",
|
||||
dataIndex: 'kzmin'
|
||||
},
|
||||
{
|
||||
title:'ctm_mosaic',
|
||||
align:"center",
|
||||
dataIndex: 'ctmMosaic'
|
||||
},
|
||||
{
|
||||
title:'ctm_fst',
|
||||
align:"center",
|
||||
dataIndex: 'ctmFst'
|
||||
},
|
||||
{
|
||||
title:'px_version',
|
||||
align:"center",
|
||||
dataIndex: 'pxVersion'
|
||||
},
|
||||
{
|
||||
title:'clm_version',
|
||||
align:"center",
|
||||
dataIndex: 'clmVersion'
|
||||
},
|
||||
{
|
||||
title:'noah_version',
|
||||
align:"center",
|
||||
dataIndex: 'noahVersion'
|
||||
},
|
||||
{
|
||||
title:'ctm_abflux',
|
||||
align:"center",
|
||||
dataIndex: 'ctmAbflux'
|
||||
},
|
||||
{
|
||||
title:'ctm_bidi_fert_nh3',
|
||||
align:"center",
|
||||
dataIndex: 'ctmBidiFertNh3'
|
||||
},
|
||||
{
|
||||
title:'ctm_hgbidi',
|
||||
align:"center",
|
||||
dataIndex: 'ctmHgbidi'
|
||||
},
|
||||
{
|
||||
title:'ctm_sfc_hono',
|
||||
align:"center",
|
||||
dataIndex: 'ctmSfcHono'
|
||||
},
|
||||
{
|
||||
title:'ctm_grav_setl',
|
||||
align:"center",
|
||||
dataIndex: 'ctmGravSetl'
|
||||
},
|
||||
{
|
||||
title:'ctm_biogemis',
|
||||
align:"center",
|
||||
dataIndex: 'ctmBiogemis'
|
||||
},
|
||||
{
|
||||
title:'icpath',
|
||||
align:"center",
|
||||
dataIndex: 'icpath'
|
||||
},
|
||||
{
|
||||
title:'bcpath',
|
||||
align:"center",
|
||||
dataIndex: 'bcpath'
|
||||
},
|
||||
{
|
||||
title:'emispath',
|
||||
align:"center",
|
||||
dataIndex: 'emispath'
|
||||
},
|
||||
{
|
||||
title:'emispath2',
|
||||
align:"center",
|
||||
dataIndex: 'emispath2'
|
||||
},
|
||||
{
|
||||
title:'in_ptpath',
|
||||
align:"center",
|
||||
dataIndex: 'inPtpath'
|
||||
},
|
||||
{
|
||||
title:'in_ltpath',
|
||||
align:"center",
|
||||
dataIndex: 'inLtpath'
|
||||
},
|
||||
{
|
||||
title:'metpath',
|
||||
align:"center",
|
||||
dataIndex: 'metpath'
|
||||
},
|
||||
{
|
||||
title:'lupath',
|
||||
align:"center",
|
||||
dataIndex: 'lupath'
|
||||
},
|
||||
{
|
||||
title:'szpath',
|
||||
align:"center",
|
||||
dataIndex: 'szpath'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/bizCmaq/bizCmaq/list",
|
||||
delete: "/bizCmaq/bizCmaq/delete",
|
||||
deleteBatch: "/bizCmaq/bizCmaq/deleteBatch",
|
||||
exportXlsUrl: "/bizCmaq/bizCmaq/exportXls",
|
||||
importExcelUrl: "bizCmaq/bizCmaq/importExcel",
|
||||
|
||||
},
|
||||
dictOptions:{},
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initDictConfig(){
|
||||
},
|
||||
getSuperFieldList(){
|
||||
let fieldList=[];
|
||||
fieldList.push({type:'string',value:'startDate',text:'start_date',dictCode:''})
|
||||
fieldList.push({type:'string',value:'endDate',text:'end_date',dictCode:''})
|
||||
fieldList.push({type:'string',value:'sttime',text:'sttime',dictCode:''})
|
||||
fieldList.push({type:'string',value:'nsteps',text:'nsteps',dictCode:''})
|
||||
fieldList.push({type:'string',value:'tstep',text:'tstep',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmMaxsync',text:'ctm_maxsync',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmMinsync',text:'ctm_minsync',dictCode:''})
|
||||
fieldList.push({type:'string',value:'sigmaSyncTop',text:'sigma_sync_top',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmAdvCfl',text:'ctm_adv_cfl',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmOceanChem',text:'ctm_ocean_chem',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmWbDust',text:'ctm_wb_dust',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmLtngNo',text:'ctm_ltng_no',dictCode:''})
|
||||
fieldList.push({type:'string',value:'kzmin',text:'kzmin',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmMosaic',text:'ctm_mosaic',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmFst',text:'ctm_fst',dictCode:''})
|
||||
fieldList.push({type:'string',value:'pxVersion',text:'px_version',dictCode:''})
|
||||
fieldList.push({type:'string',value:'clmVersion',text:'clm_version',dictCode:''})
|
||||
fieldList.push({type:'string',value:'noahVersion',text:'noah_version',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmAbflux',text:'ctm_abflux',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmBidiFertNh3',text:'ctm_bidi_fert_nh3',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmHgbidi',text:'ctm_hgbidi',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmSfcHono',text:'ctm_sfc_hono',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmGravSetl',text:'ctm_grav_setl',dictCode:''})
|
||||
fieldList.push({type:'string',value:'ctmBiogemis',text:'ctm_biogemis',dictCode:''})
|
||||
fieldList.push({type:'string',value:'icpath',text:'icpath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'bcpath',text:'bcpath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'emispath',text:'emispath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'emispath2',text:'emispath2',dictCode:''})
|
||||
fieldList.push({type:'string',value:'inPtpath',text:'in_ptpath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'inLtpath',text:'in_ltpath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'metpath',text:'metpath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'lupath',text:'lupath',dictCode:''})
|
||||
fieldList.push({type:'string',value:'szpath',text:'szpath',dictCode:''})
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
|
@ -0,0 +1,26 @@
|
|||
-- 注意:该页面对应的前台目录为views/bizCmaq文件夹下
|
||||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
|
||||
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
|
||||
VALUES ('2022121909458100390', NULL, 'CMAQ', '/bizCmaq/bizCmaqList', 'bizCmaq/BizCmaqList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0);
|
||||
|
||||
-- 权限控制sql
|
||||
-- 新增
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121909458100391', '2022121909458100390', '添加CMAQ', NULL, NULL, 0, NULL, NULL, 2, 'bizCmaq:biz_cmaq:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 编辑
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121909458100392', '2022121909458100390', '编辑CMAQ', NULL, NULL, 0, NULL, NULL, 2, 'bizCmaq:biz_cmaq:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121909458100393', '2022121909458100390', '删除CMAQ', NULL, NULL, 0, NULL, NULL, 2, 'bizCmaq:biz_cmaq:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 批量删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121909458100394', '2022121909458100390', '批量删除CMAQ', NULL, NULL, 0, NULL, NULL, 2, 'bizCmaq:biz_cmaq:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导出excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121909458100395', '2022121909458100390', '导出excel_CMAQ', NULL, NULL, 0, NULL, NULL, 2, 'bizCmaq:biz_cmaq:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导入excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121909458100396', '2022121909458100390', '导入excel_CMAQ', NULL, NULL, 0, NULL, NULL, 2, 'bizCmaq:biz_cmaq:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 21:45:39', NULL, NULL, 0, 0, '1', 0);
|
|
@ -0,0 +1,264 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="start_date" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startDate">
|
||||
<a-input v-model="model.startDate" placeholder="请输入start_date" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="end_date" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endDate">
|
||||
<a-input v-model="model.endDate" placeholder="请输入end_date" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="sttime" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sttime">
|
||||
<a-input v-model="model.sttime" placeholder="请输入sttime" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="nsteps" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nsteps">
|
||||
<a-input v-model="model.nsteps" placeholder="请输入nsteps" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="tstep" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tstep">
|
||||
<a-input v-model="model.tstep" placeholder="请输入tstep" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_maxsync" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmMaxsync">
|
||||
<a-input v-model="model.ctmMaxsync" placeholder="请输入ctm_maxsync" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_minsync" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmMinsync">
|
||||
<a-input v-model="model.ctmMinsync" placeholder="请输入ctm_minsync" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="sigma_sync_top" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sigmaSyncTop">
|
||||
<a-input v-model="model.sigmaSyncTop" placeholder="请输入sigma_sync_top" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_adv_cfl" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmAdvCfl">
|
||||
<a-input v-model="model.ctmAdvCfl" placeholder="请输入ctm_adv_cfl" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_ocean_chem" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmOceanChem">
|
||||
<a-input v-model="model.ctmOceanChem" placeholder="请输入ctm_ocean_chem" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_wb_dust" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmWbDust">
|
||||
<a-input v-model="model.ctmWbDust" placeholder="请输入ctm_wb_dust" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_ltng_no" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmLtngNo">
|
||||
<a-input v-model="model.ctmLtngNo" placeholder="请输入ctm_ltng_no" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="kzmin" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kzmin">
|
||||
<a-input v-model="model.kzmin" placeholder="请输入kzmin" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_mosaic" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmMosaic">
|
||||
<a-input v-model="model.ctmMosaic" placeholder="请输入ctm_mosaic" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_fst" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmFst">
|
||||
<a-input v-model="model.ctmFst" placeholder="请输入ctm_fst" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="px_version" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pxVersion">
|
||||
<a-input v-model="model.pxVersion" placeholder="请输入px_version" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="clm_version" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="clmVersion">
|
||||
<a-input v-model="model.clmVersion" placeholder="请输入clm_version" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="noah_version" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="noahVersion">
|
||||
<a-input v-model="model.noahVersion" placeholder="请输入noah_version" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_abflux" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmAbflux">
|
||||
<a-input v-model="model.ctmAbflux" placeholder="请输入ctm_abflux" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_bidi_fert_nh3" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmBidiFertNh3">
|
||||
<a-input v-model="model.ctmBidiFertNh3" placeholder="请输入ctm_bidi_fert_nh3" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_hgbidi" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmHgbidi">
|
||||
<a-input v-model="model.ctmHgbidi" placeholder="请输入ctm_hgbidi" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_sfc_hono" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmSfcHono">
|
||||
<a-input v-model="model.ctmSfcHono" placeholder="请输入ctm_sfc_hono" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_grav_setl" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmGravSetl">
|
||||
<a-input v-model="model.ctmGravSetl" placeholder="请输入ctm_grav_setl" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ctm_biogemis" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ctmBiogemis">
|
||||
<a-input v-model="model.ctmBiogemis" placeholder="请输入ctm_biogemis" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="icpath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="icpath">
|
||||
<a-input v-model="model.icpath" placeholder="请输入icpath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="bcpath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bcpath">
|
||||
<a-input v-model="model.bcpath" placeholder="请输入bcpath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="emispath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="emispath">
|
||||
<a-input v-model="model.emispath" placeholder="请输入emispath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="emispath2" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="emispath2">
|
||||
<a-input v-model="model.emispath2" placeholder="请输入emispath2" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="in_ptpath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inPtpath">
|
||||
<a-input v-model="model.inPtpath" placeholder="请输入in_ptpath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="in_ltpath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inLtpath">
|
||||
<a-input v-model="model.inLtpath" placeholder="请输入in_ltpath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="metpath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="metpath">
|
||||
<a-input v-model="model.metpath" placeholder="请输入metpath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="lupath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lupath">
|
||||
<a-input v-model="model.lupath" placeholder="请输入lupath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="szpath" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="szpath">
|
||||
<a-input v-model="model.szpath" placeholder="请输入szpath" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</j-form-container>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: 'BizCmaqForm',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
//表单禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
model:{
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
validatorRules: {
|
||||
},
|
||||
url: {
|
||||
add: "/bizCmaq/bizCmaq/add",
|
||||
edit: "/bizCmaq/bizCmaq/edit",
|
||||
queryById: "/bizCmaq/bizCmaq/queryById"
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
return this.disabled
|
||||
},
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit(this.modelDefault);
|
||||
},
|
||||
edit (record) {
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
submitForm () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,84 @@
|
|||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:width="width"
|
||||
placement="right"
|
||||
:closable="false"
|
||||
@close="close"
|
||||
destroyOnClose
|
||||
:visible="visible">
|
||||
<biz-cmaq-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></biz-cmaq-form>
|
||||
<div class="drawer-footer">
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
|
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BizCmaqForm from './BizCmaqForm'
|
||||
|
||||
export default {
|
||||
name: 'BizCmaqModal',
|
||||
components: {
|
||||
BizCmaqForm
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
width:800,
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
});
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** Button按钮间距 */
|
||||
.ant-btn {
|
||||
margin-left: 30px;
|
||||
margin-bottom: 30px;
|
||||
float: right;
|
||||
}
|
||||
.drawer-footer{
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 16px;
|
||||
text-align: right;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,60 @@
|
|||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<biz-cmaq-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></biz-cmaq-form>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BizCmaqForm from './BizCmaqForm'
|
||||
export default {
|
||||
name: 'BizCmaqModal',
|
||||
components: {
|
||||
BizCmaqForm
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:'',
|
||||
width:800,
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,121 @@
|
|||
package org.jeecg.modules.project.bizEngineering.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.service.IBizWrfService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags="BizEngineering")
|
||||
@RestController
|
||||
@RequestMapping("/bizEngineering")
|
||||
@Slf4j
|
||||
public class BizEngineeringController {
|
||||
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
|
||||
/**
|
||||
* 查询工程
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<BizEngineering>> list() {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<BizEngineering> bizEngineerings = bizEngineeringService.list(new LambdaQueryWrapper<BizEngineering>().
|
||||
eq(BizEngineering::getCreateBy,sysUser.getUsername()).
|
||||
orderByDesc(BizEngineering::getCreateTime));
|
||||
if(bizEngineerings == null || bizEngineerings.isEmpty()) {
|
||||
String engPath= String.format("%s%s",baseHome,sysUser.getUsername());
|
||||
BizEngineering bizEngineering = new BizEngineering();
|
||||
bizEngineering.setCreateBy(sysUser.getUsername());
|
||||
bizEngineering.setCreateTime(new Date());
|
||||
bizEngineering.setEngineeringName("系统自动创建工程");
|
||||
bizEngineering.setEngineeringPath(engPath);
|
||||
bizEngineering.setSceneType(0);
|
||||
bizEngineeringService.save(bizEngineering);
|
||||
bizEngineerings.add(bizEngineering);
|
||||
}
|
||||
for (BizEngineering bizEngineering : bizEngineerings) {
|
||||
bizEngineering.setEngineeringPath(bizEngineering.getEngineeringPath() + "/" + bizEngineering.getId());
|
||||
}
|
||||
return Result.OK(bizEngineerings);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bizEngineering
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "BizEngineering-添加")
|
||||
@ApiOperation(value="BizEngineering-添加", notes="BizEngineering-添加")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BizEngineering bizEngineering) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String engPath= String.format("%s%s",baseHome,sysUser.getUsername());
|
||||
bizEngineering.setEngineeringPath(engPath);
|
||||
bizEngineeringService.save(bizEngineering);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bizEngineering
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "BizEngineering-编辑")
|
||||
@ApiOperation(value="BizEngineering-编辑", notes="BizEngineering-编辑")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:add")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<String> edit(@RequestBody BizEngineering bizEngineering) {
|
||||
bizEngineeringService.updateById(bizEngineering);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param bizEngineering
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "BizEngineering-编辑")
|
||||
// @ApiOperation(value="BizEngineering-编辑", notes="BizEngineering-编辑")
|
||||
// //@RequiresPermissions("bizWrf:biz_wrf:add")
|
||||
// @PostMapping(value = "/updateStateById")
|
||||
// public Result<String> updateStateById(String id) {
|
||||
// bizEngineeringService.updateById(bizEngineering);
|
||||
// return Result.OK("编辑成功!");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询选中工程
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getBizEngineeringByState")
|
||||
public Result<BizEngineering> getBizEngineeringByState() {
|
||||
return Result.ok(bizEngineeringService.getBizEngineeringByState());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.jeecg.modules.project.bizEngineering.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class BizEngineering {
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**工程名称*/
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String engineeringName;
|
||||
/**场景类型*/
|
||||
@ApiModelProperty(value = "场景类型")
|
||||
private Integer sceneType;
|
||||
/**
|
||||
* 工程存放地址(baseHome/userName)前端显示时,需要拼接工程ID
|
||||
* */
|
||||
@ApiModelProperty(value = "工程存放地址")
|
||||
private String engineeringPath;
|
||||
/**工程选中状态*/
|
||||
@ApiModelProperty(value = "工程选中状态")
|
||||
private int engineeringState;
|
||||
/**备注*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.modules.project.bizEngineering.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface BizEngineeringMapper extends BaseMapper<BizEngineering> {
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package org.jeecg.modules.project.bizEngineering.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
|
||||
public interface IBizEngineeringService extends IService<BizEngineering> {
|
||||
BizEngineering getBizEngineeringByState();
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package org.jeecg.modules.project.bizEngineering.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.bizEngineering.mapper.BizEngineeringMapper;
|
||||
import org.jeecg.modules.project.bizEngineering.service.IBizEngineeringService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BizEngineeringServiceImpl extends ServiceImpl<BizEngineeringMapper, BizEngineering> implements IBizEngineeringService {
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
|
||||
@Override
|
||||
public BizEngineering getBizEngineeringByState(){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<BizEngineering> bizEngineerings = this.baseMapper.selectList(new LambdaQueryWrapper<BizEngineering>().
|
||||
eq(BizEngineering::getCreateBy,sysUser.getUsername()).
|
||||
orderByDesc(BizEngineering::getCreateTime));
|
||||
if(bizEngineerings == null || bizEngineerings.isEmpty()) {
|
||||
String engPath= String.format("%s%s",baseHome,sysUser.getUsername());
|
||||
BizEngineering bizEngineering = new BizEngineering();
|
||||
bizEngineering.setCreateBy(sysUser.getUsername());
|
||||
bizEngineering.setCreateTime(new Date());
|
||||
bizEngineering.setEngineeringName("系统自动创建工程");
|
||||
bizEngineering.setEngineeringPath(engPath);
|
||||
bizEngineering.setSceneType(0);
|
||||
this.baseMapper.insert(bizEngineering);
|
||||
return bizEngineering;
|
||||
}
|
||||
return bizEngineerings.get(0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,326 @@
|
|||
package org.jeecg.modules.project.bizOpenfoam.controller;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.opencsv.CSVWriter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import org.jeecg.modules.project.bizOpenfoam.service.IBizOpenfoamService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.mapper.BizWrfMapper;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import ucar.ma2.Array;
|
||||
import ucar.ma2.Index;
|
||||
import ucar.nc2.Attribute;
|
||||
import ucar.nc2.NetcdfFile;
|
||||
import ucar.nc2.Variable;
|
||||
import ucar.nc2.dataset.NetcdfDataset;
|
||||
|
||||
import static java.nio.file.Files.readAllBytes;
|
||||
import static java.nio.file.Paths.get;
|
||||
|
||||
/**
|
||||
* @Description: openFoam
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="openFoam")
|
||||
@RestController
|
||||
@RequestMapping("/bizOpenfoam")
|
||||
@Slf4j
|
||||
public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpenfoamService> {
|
||||
@Autowired
|
||||
private IBizOpenfoamService bizOpenfoamService;
|
||||
@Autowired
|
||||
private BizWrfMapper bizWrfMapper;
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
@Value("${spring.CMAQ.cshTemFielPath}")
|
||||
private String cshTemFielPath;
|
||||
@Value("${spring.Linux.ip}")
|
||||
private String ip;
|
||||
@Value("${spring.Linux.username}")
|
||||
private String username;
|
||||
@Value("${spring.Linux.password}")
|
||||
private String password;
|
||||
@Value("${spring.Linux.port}")
|
||||
private Integer port;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param bizOpenfoam
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "openFoam-分页列表查询")
|
||||
@ApiOperation(value="openFoam-分页列表查询", notes="openFoam-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<BizOpenfoam>> queryPageList(BizOpenfoam bizOpenfoam,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BizOpenfoam> queryWrapper = QueryGenerator.initQueryWrapper(bizOpenfoam, req.getParameterMap());
|
||||
Page<BizOpenfoam> page = new Page<BizOpenfoam>(pageNo, pageSize);
|
||||
IPage<BizOpenfoam> pageList = bizOpenfoamService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bizOpenfoam
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "openFoam-添加")
|
||||
@ApiOperation(value="openFoam-添加", notes="openFoam-添加")
|
||||
//@RequiresPermissions("bizOpenfoam:biz_openfoam:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<BizOpenfoam> add(@RequestBody BizOpenfoam bizOpenfoam) {
|
||||
bizOpenfoamService.saveOrUpdate(bizOpenfoam);
|
||||
return Result.OK(bizOpenfoam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bizOpenfoam
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "openFoam-编辑")
|
||||
@ApiOperation(value="openFoam-编辑", notes="openFoam-编辑")
|
||||
//@RequiresPermissions("bizOpenfoam:biz_openfoam:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BizOpenfoam bizOpenfoam) {
|
||||
bizOpenfoamService.updateById(bizOpenfoam);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询openfoam参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "wrf-查询openfoam参数")
|
||||
@ApiOperation(value="wrf-查询openfoam参数", notes="wrf-查询openfoam参数")
|
||||
@GetMapping(value = "/getOpenFoamParam")
|
||||
public Result<BizOpenfoam> getOpenFoamParam(String engineeringId) {
|
||||
BizOpenfoam bizOpenfoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId,engineeringId));
|
||||
if(bizOpenfoam == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bizOpenfoam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/runOpenFoamByUserId")
|
||||
public String runOpenFoam(String engineeringId) throws IOException {
|
||||
BizOpenfoam openfoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId,engineeringId));
|
||||
String openFoamPath = baseHome + "OpenFOAM/openfoam-8/run/" + openfoam.getCreateBy() + "/" + engineeringId;
|
||||
String runCmd = String.format("cd %s;%s;",openFoamPath,openfoam.getFoam());
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
return "运行成功";
|
||||
}
|
||||
|
||||
public double[][][] resolveOpenFoamResult(int startLine,int x,int y,int z,String openFoamPath,String param) throws IOException {
|
||||
String stepFileName = bizOpenfoamService.getStepFileName(openFoamPath);
|
||||
if(StringUtils.isBlank(param)){
|
||||
param = "c1";
|
||||
}
|
||||
Path p = Paths.get( openFoamPath + "/" + stepFileName + "/" + param);
|
||||
List<String> lines = Files.readAllLines(p);
|
||||
double[][][] result = new double[x][y][z];
|
||||
if(lines != null && !lines.isEmpty()) {
|
||||
try {
|
||||
for(int k=0;k<z;k++){
|
||||
for(int j=0;j<y;j++){
|
||||
for(int i=0;i<x;i++){
|
||||
result[i][j][k] = Double.parseDouble(lines.get(startLine + i+j*x+k*y*x));
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getOpenFoamResult")
|
||||
public double[][][] getOpenFoamResult(String dir,String param,String engineeringId) throws IOException {
|
||||
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
|
||||
String openFoamPath = baseHome + "OpenFOAM/openfoam-8/run/" + wrf.getCreateBy() + "/" + engineeringId;
|
||||
// String openFoamPath = "C:\\Users\\13673\\Desktop\\Nuclear\\file\\openfoam\\bak\\cylinder_U";
|
||||
String systemPath = openFoamPath + "/system/";
|
||||
|
||||
String [] hexArray = null;
|
||||
List<String> blockMeshDictFileInfos = Files.readAllLines(Paths.get(systemPath + "blockMeshDict"));
|
||||
for (String info : blockMeshDictFileInfos) {
|
||||
if(info.indexOf("hex") > 0){
|
||||
int index1 = info.indexOf("(");
|
||||
int index2 = info.indexOf("(", index1 + 1);
|
||||
int index3 = info.indexOf(")", index2 + 1);
|
||||
hexArray = info.substring(index2+1, index3).split(" ");
|
||||
}
|
||||
}
|
||||
|
||||
int xSize = Integer.valueOf(hexArray[0]);
|
||||
int ySize = Integer.valueOf(hexArray[1]);
|
||||
int zSize = Integer.valueOf(hexArray[2]);
|
||||
|
||||
int resampleIndex = 3;
|
||||
double[][][] smallRes = new double[2*(xSize/resampleIndex)][ySize/resampleIndex][2*(zSize/resampleIndex)];
|
||||
|
||||
double[][][] res1 = resolveOpenFoamResult(22,xSize,ySize,zSize,openFoamPath,param);
|
||||
double[][][] res2 = resolveOpenFoamResult(22 + xSize*ySize*zSize,xSize,ySize,zSize,openFoamPath,param);
|
||||
double[][][] res3 = resolveOpenFoamResult(22 + 2*xSize*ySize*zSize,xSize,ySize,zSize,openFoamPath,param);
|
||||
double[][][] res4 = resolveOpenFoamResult(22 + 3*xSize*ySize*zSize,xSize,ySize,zSize,openFoamPath,param);
|
||||
for(int i=resampleIndex-2;i<xSize;i=i+resampleIndex){
|
||||
for(int j=resampleIndex-2;j<ySize;j=j+resampleIndex){
|
||||
for(int k=resampleIndex-2;k<zSize;k=k+resampleIndex){
|
||||
smallRes[i/resampleIndex][j/resampleIndex][k/resampleIndex] = res1[i][j][k];
|
||||
smallRes[xSize/resampleIndex + i/resampleIndex][j/resampleIndex][k/resampleIndex] = res2[i][j][k];
|
||||
smallRes[i/resampleIndex][j/resampleIndex][zSize/resampleIndex + k/resampleIndex] = res3[i][j][k];
|
||||
smallRes[xSize/resampleIndex + i/resampleIndex][j/resampleIndex][zSize/resampleIndex + k/resampleIndex] = res4[i][j][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return smallRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/genInitFile")
|
||||
public boolean genInitFile(String uValue,String vValue,String windFieldValue,String pValue,String tValue,String engineeringId) {
|
||||
BizEngineering bizEngineering = bizEngineeringService.getById(engineeringId);
|
||||
String openFoamPath = baseHome + "OpenFOAM/openfoam-8/run/" + bizEngineering.getCreateBy() + "/" + engineeringId;
|
||||
String resultFilePath = openFoamPath + "/0/";
|
||||
try {
|
||||
String uFileValue = new String(Files.readAllBytes(Paths.get(cshTemFielPath + "U")));
|
||||
String pFileValue = new String(Files.readAllBytes(Paths.get(cshTemFielPath + "p")));
|
||||
String tFileValue = new String(Files.readAllBytes(Paths.get(cshTemFielPath + "T")));
|
||||
FileUtil.writeString(uFileValue.replace("#{value}", String.format("(%s %s %s)",uValue,vValue,windFieldValue)), resultFilePath + "U", "UTF-8");
|
||||
FileUtil.writeString(pFileValue.replace("#{value}", pValue), resultFilePath + "p", "UTF-8");
|
||||
FileUtil.writeString(tFileValue.replace("#{value}", tValue), resultFilePath + "T", "UTF-8");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bizOpenfoam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/saveOpenFoamConfig")
|
||||
public String saveOpenFoamConfig(@RequestBody BizOpenfoam bizOpenfoam) {
|
||||
try {
|
||||
String openFoamPath = baseHome + "OpenFOAM/openfoam-8/run/";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, "rm -rf " + openFoamPath + bizOpenfoam.getCreateBy() + "/" +bizOpenfoam.getEngineeringId());
|
||||
String runCmd = String.format("cp -r %scylinder_U %s%s/%s",openFoamPath,openFoamPath,bizOpenfoam.getCreateBy(),bizOpenfoam.getEngineeringId());
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
String controlDictFilePath = openFoamPath + bizOpenfoam.getCreateBy() + "/" + bizOpenfoam.getEngineeringId() + "/system/controlDict";
|
||||
Path controlDictPath = Paths.get(controlDictFilePath);
|
||||
List<String> controlDicts = Files.readAllLines(controlDictPath);
|
||||
List<String> result = new ArrayList<>();
|
||||
for (String controlDict : controlDicts) {
|
||||
if(controlDict.indexOf("application ") > 0){
|
||||
controlDict = "application "+bizOpenfoam.getApplication()+";";
|
||||
}
|
||||
if(controlDict.indexOf("startTime ") > 0){
|
||||
controlDict = "startTime "+bizOpenfoam.getStartTime()+";";
|
||||
}
|
||||
if(controlDict.indexOf("endTime ") > 0){
|
||||
controlDict = "endTime "+bizOpenfoam.getEndTime()+";";
|
||||
}
|
||||
if(controlDict.indexOf("deltaT ") > 0){
|
||||
controlDict = "deltaT "+bizOpenfoam.getDeltat()+";";
|
||||
}
|
||||
if(controlDict.indexOf("writeInterval ") > 0){
|
||||
controlDict = "writeInterval "+bizOpenfoam.getWriteinterval()+";";
|
||||
}
|
||||
result.add(controlDict);
|
||||
}
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(controlDictFilePath);
|
||||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fileOutputStream));
|
||||
for (String res : result) {
|
||||
bw.write(res);
|
||||
bw.newLine();
|
||||
}
|
||||
bw.flush();
|
||||
bw.close();
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package org.jeecg.modules.project.bizOpenfoam.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: openFoam
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("biz_openfoam")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="biz_openfoam对象", description="openFoam")
|
||||
public class BizOpenfoam implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**foamclass*/
|
||||
@Excel(name = "foamclass", width = 15)
|
||||
@ApiModelProperty(value = "foamclass")
|
||||
private String foamclass;
|
||||
/**foam*/
|
||||
@Excel(name = "foam", width = 15)
|
||||
@ApiModelProperty(value = "foam")
|
||||
private String foam;
|
||||
/**application*/
|
||||
@Excel(name = "application", width = 15)
|
||||
@ApiModelProperty(value = "application")
|
||||
private String application;
|
||||
/**start_time*/
|
||||
@Excel(name = "start_time", width = 15)
|
||||
@ApiModelProperty(value = "start_time")
|
||||
private String startTime;
|
||||
/**end_time*/
|
||||
@Excel(name = "end_time", width = 15)
|
||||
@ApiModelProperty(value = "end_time")
|
||||
private String endTime;
|
||||
/**deltat*/
|
||||
@Excel(name = "deltat", width = 15)
|
||||
@ApiModelProperty(value = "deltat")
|
||||
private String deltat;
|
||||
/**writeInterval*/
|
||||
@Excel(name = "writeInterval", width = 15)
|
||||
@ApiModelProperty(value = "writeInterval")
|
||||
private String writeinterval;
|
||||
/**layer*/
|
||||
@Excel(name = "layer", width = 15)
|
||||
@ApiModelProperty(value = "layer")
|
||||
private Integer layer;
|
||||
/**lat*/
|
||||
@Excel(name = "lat", width = 15)
|
||||
@ApiModelProperty(value = "lat")
|
||||
private String lat;
|
||||
/**lon*/
|
||||
@Excel(name = "lon", width = 15)
|
||||
@ApiModelProperty(value = "lon")
|
||||
private String lon;
|
||||
/**equivalent*/
|
||||
@Excel(name = "equivalent", width = 15)
|
||||
@ApiModelProperty(value = "equivalent")
|
||||
private String equivalent;
|
||||
@Excel(name = "engineeringId", width = 15)
|
||||
@ApiModelProperty(value = "engineeringId")
|
||||
private String engineeringId;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.project.bizOpenfoam.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: openFoam
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BizOpenfoamMapper extends BaseMapper<BizOpenfoam> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.bizOpenfoam.mapper.BizOpenfoamMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecg.modules.project.bizOpenfoam.service;
|
||||
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: openFoam
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBizOpenfoamService extends IService<BizOpenfoam> {
|
||||
|
||||
List<String> getCoAndPecInfo(BizWrf wrf);
|
||||
String getStepFileName(String systemPath);
|
||||
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
package org.jeecg.modules.project.bizOpenfoam.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import org.jeecg.modules.project.bizOpenfoam.mapper.BizOpenfoamMapper;
|
||||
import org.jeecg.modules.project.bizOpenfoam.service.IBizOpenfoamService;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.mapper.BizWrfMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Description: openFoam
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BizOpenfoamServiceImpl extends ServiceImpl<BizOpenfoamMapper, BizOpenfoam> implements IBizOpenfoamService {
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
|
||||
@Override
|
||||
public List<String> getCoAndPecInfo(BizWrf wrf) {
|
||||
String openFoamPath = baseHome + "OpenFOAM/openfoam-8/run/" + wrf.getEngineeringId();
|
||||
|
||||
String stepFileName = getStepFileName(openFoamPath);
|
||||
try {
|
||||
String [] hexArray = null;
|
||||
List<String> blockMeshDictFileInfos = Files.readAllLines(Paths.get(openFoamPath + "/system/" + "blockMeshDict"));
|
||||
for (String info : blockMeshDictFileInfos) {
|
||||
if(info.indexOf("hex") > 0){
|
||||
int index1 = info.indexOf("(");
|
||||
int index2 = info.indexOf("(", index1 + 1);
|
||||
int index3 = info.indexOf(")", index2 + 1);
|
||||
hexArray = info.substring(index2+1, index3).split(" ");
|
||||
}
|
||||
}
|
||||
int count = Integer.valueOf(hexArray[0]) * Integer.valueOf(hexArray[1]) * Integer.valueOf(hexArray[2]) * 4;
|
||||
List<String> c1Lines = Files.readAllLines(Paths.get(openFoamPath + "/" + stepFileName + "/c1"));
|
||||
List<String> c2Lines = Files.readAllLines(Paths.get(openFoamPath + "/" + stepFileName + "/c2"));
|
||||
List<Double> c1Values = new ArrayList<>();
|
||||
List<Double> c2Values = new ArrayList<>();
|
||||
for (int i = 22; i < count; i++) {
|
||||
c1Values.add(Double.valueOf(c1Lines.get(i)));
|
||||
c2Values.add(Double.valueOf(c2Lines.get(i)));
|
||||
}
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(c1Values.stream().mapToDouble( Double :: valueOf ).average().getAsDouble()+"");
|
||||
result.add(c2Values.stream().mapToDouble( Double :: valueOf ).average().getAsDouble()+"");
|
||||
return result;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStepFileName(String systemPath){
|
||||
List<String> folderNames = getFolderNames(systemPath);
|
||||
List<Double> stepFileNames = new ArrayList<>();
|
||||
for (String folderName : folderNames) {
|
||||
if(isNumeric(folderName)){
|
||||
stepFileNames.add(Double.valueOf(folderName));
|
||||
}
|
||||
}
|
||||
Collections.reverse(stepFileNames);
|
||||
String stepFileName = stepFileNames.get(0) + "";
|
||||
File file = new File( systemPath + "/" + stepFileName);
|
||||
if (!file.exists()) {
|
||||
stepFileName = stepFileName.substring(0,stepFileName.length() - 2);
|
||||
}
|
||||
return stepFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是不是double型
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static boolean isNumeric(String str){
|
||||
Pattern pattern = Pattern.compile("[0-9]+[.]{0,1}[0-9]*[dD]{0,1}");
|
||||
Matcher isNum = pattern.matcher(str);
|
||||
if( !isNum.matches() ){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到文件名称
|
||||
*
|
||||
* @param path 路径
|
||||
* @return {@link List}<{@link String}>
|
||||
*/
|
||||
private List<String> getFolderNames(String path) {
|
||||
List<String> folderNames = new ArrayList<>();
|
||||
File folder = new File(path);
|
||||
File[] listOfFiles = folder.listFiles();
|
||||
|
||||
for (File file : listOfFiles) {
|
||||
if (file.isDirectory()) {
|
||||
folderNames.add(file.getName());
|
||||
}
|
||||
}
|
||||
return folderNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到文件名称
|
||||
*
|
||||
* @param file 文件
|
||||
* @param fileNames 文件名
|
||||
* @return {@link List}<{@link String}>
|
||||
*/
|
||||
private List<String> getFileNames(File file, List<String> fileNames) {
|
||||
File[] files = file.listFiles();
|
||||
for (File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
getFileNames(f, fileNames);
|
||||
} else {
|
||||
fileNames.add(f.getName());
|
||||
}
|
||||
}
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
package org.jeecg.modules.project.bizUploadFile.controller;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.project.bizUploadFile.entity.BizUploadFile;
|
||||
import org.jeecg.modules.project.bizUploadFile.service.BizUploadFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: BizUpload
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="BizUpload")
|
||||
@RestController
|
||||
@RequestMapping("/bizUploadFile")
|
||||
@Slf4j
|
||||
public class BizUpdateFileController extends JeecgController<BizUploadFile, BizUploadFileService> {
|
||||
|
||||
@Autowired
|
||||
private BizUploadFileService bizUploadFileService;
|
||||
|
||||
@Value("${spring.WRF.wpsLocalPrefix}")
|
||||
private String wpsLocalPrefix;
|
||||
|
||||
@PostMapping(value = "/uploadFile")
|
||||
public boolean uploadFile(@RequestParam String relevanceId, @RequestParam Integer type, @RequestParam List<MultipartFile> files) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
try{
|
||||
// String localFilePrefix = wpsLocalPrefix + loginUser.getUsername() + "/" + relevanceId + "/";
|
||||
String localFilePrefix = "D:\\upload\\" + loginUser.getUsername() + "/" + relevanceId + "/";
|
||||
if (!FileUtil.exist(localFilePrefix)) {
|
||||
FileUtil.mkdir(localFilePrefix);
|
||||
}
|
||||
bizUploadFileService.save(relevanceId,loginUser.getUsername(),type, files);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/downloadFile")
|
||||
public boolean downloadFile(@RequestParam String relevanceId,@RequestParam Integer type) {
|
||||
List<BizUploadFile> bizUploadFiles = bizUploadFileService.list(new LambdaQueryWrapper<BizUploadFile>().
|
||||
eq(BizUploadFile::getRelevanceId, relevanceId).eq(BizUploadFile::getType, type));
|
||||
try{
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载并保存文件
|
||||
*
|
||||
* @return {@code String}
|
||||
*//*
|
||||
public String downloadAndSaveFile(@RequestParam String relevanceId,@RequestParam Integer type) {
|
||||
try {
|
||||
List<BizUploadFile> bizUploadFiles = bizUploadFileService.list(new LambdaQueryWrapper<BizUploadFile>().
|
||||
eq(BizUploadFile::getRelevanceId, relevanceId).eq(BizUploadFile::getType, type));
|
||||
if(bizUploadFiles == null || bizUploadFiles.isEmpty()){
|
||||
return
|
||||
}
|
||||
URL fileUrl = new URL(bizUploadFiles);
|
||||
HttpURLConnection connection = (HttpURLConnection) fileUrl.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
String fileName = generateFileNameWithTimestamp(originalFileName);
|
||||
String savePath = generateSavePath(fileName);
|
||||
|
||||
try (InputStream inputStream = connection.getInputStream();
|
||||
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(savePath))) {
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
return convertToReturnPath(savePath);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("Error: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
*//**
|
||||
* 生成文件名字和时间戳
|
||||
*
|
||||
* @param originalFileName 原始文件名字
|
||||
* @return {@code String}
|
||||
*//*
|
||||
private String generateFileNameWithTimestamp(String originalFileName) {
|
||||
String timestamp = getCurrentTimestamp();
|
||||
int dotIndex = originalFileName.lastIndexOf(".");
|
||||
String extension = "";
|
||||
if (dotIndex != -1) {
|
||||
extension = originalFileName.substring(dotIndex);
|
||||
originalFileName = originalFileName.substring(0, dotIndex);
|
||||
}
|
||||
return originalFileName + "_" + timestamp + extension;
|
||||
}
|
||||
|
||||
*//**
|
||||
* 生成保存路径
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @return {@code String}
|
||||
*//*
|
||||
private String generateSavePath(String fileName) {
|
||||
Date currentDate = new Date();
|
||||
SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
|
||||
SimpleDateFormat monthFormat = new SimpleDateFormat("MM");
|
||||
SimpleDateFormat dayFormat = new SimpleDateFormat("dd");
|
||||
|
||||
String year = yearFormat.format(currentDate);
|
||||
String month = monthFormat.format(currentDate);
|
||||
String day = dayFormat.format(currentDate);
|
||||
|
||||
String filePath = defaultBaseDir + "/upload/" + year + "/" + month + "/" + day + "/";
|
||||
return filePath + fileName;
|
||||
}
|
||||
|
||||
*//**
|
||||
* 转换返回路径
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @return {@code String}
|
||||
*//*
|
||||
private String convertToReturnPath(String filePath) {
|
||||
String relativePath = filePath.replace(defaultBaseDir, "/profile");
|
||||
return relativePath.replace("\\", "/");
|
||||
}
|
||||
|
||||
*//**
|
||||
* 获得当前时间戳
|
||||
*
|
||||
* @return {@code String}
|
||||
*//*
|
||||
public String getCurrentTimestamp() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
Date currentDate = new Date();
|
||||
return dateFormat.format(currentDate);
|
||||
}*/
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.jeecg.modules.project.bizUploadFile.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BizUploadFile implements Serializable {
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
/**主表id*/
|
||||
private String relevanceId;
|
||||
/**文件名称*/
|
||||
private String fileName;
|
||||
/**文件路径*/
|
||||
private String filePath;
|
||||
/**文件全路径*/
|
||||
private String fileFullPath;
|
||||
private Integer type;
|
||||
/**文件大小*/
|
||||
private long fileSize;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JSONField(serialize = false)
|
||||
private List<MultipartFile> files;
|
||||
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userName;
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package org.jeecg.modules.project.bizUploadFile.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.project.bizUploadFile.entity.BizUploadFile;
|
||||
|
||||
public interface BizUploadFileMapper extends BaseMapper<BizUploadFile> {
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.jeecg.modules.project.bizUploadFile.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.project.bizUploadFile.entity.BizUploadFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BizUploadFileService extends IService<BizUploadFile> {
|
||||
|
||||
void save(String trainingId,String userName, Integer type, List<MultipartFile> fileList);
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.jeecg.modules.project.bizUploadFile.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jeecg.modules.project.bizUploadFile.entity.BizUploadFile;
|
||||
import org.jeecg.modules.project.bizUploadFile.mapper.BizUploadFileMapper;
|
||||
import org.jeecg.modules.project.bizUploadFile.service.BizUploadFileService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class BizUploadFileServiceImpl extends ServiceImpl<BizUploadFileMapper, BizUploadFile> implements BizUploadFileService {
|
||||
|
||||
@Value("${spring.WRF.wpsLocalPrefix}")
|
||||
private String wpsLocalPrefix;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(String relevanceId,String userName, Integer type, List<MultipartFile> fileList) {
|
||||
try {
|
||||
for (MultipartFile file : fileList) {
|
||||
BizUploadFile bizUploadFile = new BizUploadFile();
|
||||
bizUploadFile.setRelevanceId(relevanceId);
|
||||
bizUploadFile.setCreateTime(new Date());
|
||||
String filename = file.getOriginalFilename();
|
||||
bizUploadFile.setFileName(filename);
|
||||
bizUploadFile.setFileSize(file.getSize());
|
||||
bizUploadFile.setType(type);
|
||||
// 文件地址
|
||||
String dbDir = userName + "/" + relevanceId;
|
||||
bizUploadFile.setFilePath(dbDir);
|
||||
// 全路径
|
||||
String descDir = "";
|
||||
wpsLocalPrefix = "D:\\upload\\";
|
||||
if(type == 1){
|
||||
descDir = wpsLocalPrefix + userName + "/" + relevanceId;
|
||||
}else if (type == 1){
|
||||
descDir = wpsLocalPrefix + userName + "/" + relevanceId;
|
||||
}else{
|
||||
descDir = wpsLocalPrefix + userName + "/" + relevanceId;
|
||||
}
|
||||
bizUploadFile.setFileFullPath(descDir);
|
||||
//删除之前导入的相同类型数据
|
||||
this.getBaseMapper().delete(new LambdaQueryWrapper<BizUploadFile>().
|
||||
eq(BizUploadFile::getRelevanceId,relevanceId).
|
||||
eq(BizUploadFile::getType,type).
|
||||
eq(BizUploadFile::getFileName,filename));
|
||||
// 插入数据
|
||||
this.getBaseMapper().insert(bizUploadFile);
|
||||
// 生成本地文件
|
||||
saveFile(descDir, filename, file.getInputStream());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveFile(String descDir, String filename, InputStream inputStream) throws Exception {
|
||||
// 文件夹
|
||||
File folder = new File(descDir);
|
||||
if (!folder.exists()) {
|
||||
folder.mkdirs();
|
||||
}
|
||||
// 文件地址
|
||||
String filePath = descDir + "//" + filename;
|
||||
File newFile = new File(filePath);
|
||||
|
||||
OutputStream os = new BufferedOutputStream(new FileOutputStream(newFile));
|
||||
// 复制文件数据
|
||||
IOUtils.copy(inputStream, os);
|
||||
os.close();
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,774 @@
|
|||
package org.jeecg.modules.project.bizWrf.controller;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.project.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.bizOpenfoam.entity.BizOpenfoam;
|
||||
import org.jeecg.modules.project.bizOpenfoam.service.IBizOpenfoamService;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.service.IBizWrfService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.modules.project.util.CmdUtil;
|
||||
import org.jeecg.modules.project.util.SFTPUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import ucar.ma2.Array;
|
||||
import ucar.ma2.Index;
|
||||
import ucar.nc2.NetcdfFile;
|
||||
import ucar.nc2.ProxyReader;
|
||||
import ucar.nc2.Variable;
|
||||
import ucar.nc2.dataset.NetcdfDataset;
|
||||
|
||||
import static java.nio.file.Files.readAllBytes;
|
||||
import static java.nio.file.Paths.get;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="wrf")
|
||||
@RestController
|
||||
@RequestMapping("/bizWrf")
|
||||
@Slf4j
|
||||
public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
||||
@Autowired
|
||||
private IBizWrfService bizWrfService;
|
||||
@Autowired
|
||||
private IBizOpenfoamService bizOpenfoamService;
|
||||
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
@Value("${spring.WRF.wpsLocalPrefix}")
|
||||
private String wpsLocalPrefix;
|
||||
@Value("${spring.WRF.wrfLocalPrefix}")
|
||||
private String wrfLocalPrefix;
|
||||
@Value("${spring.CMAQ.cshTemFielPath}")
|
||||
private String cshTemFielPath;
|
||||
@Value("${spring.WRF.geog_data_path}")
|
||||
private String geog_data_path;
|
||||
@Value("${spring.WRF.fnldataPath}")
|
||||
private String fnldataPath;
|
||||
@Value("${spring.Linux.ip}")
|
||||
private String ip;
|
||||
@Value("${spring.Linux.username}")
|
||||
private String username;
|
||||
@Value("${spring.Linux.password}")
|
||||
private String password;
|
||||
@Value("${spring.Linux.port}")
|
||||
private Integer port;
|
||||
|
||||
|
||||
|
||||
// private String wpsPrefix = "C:\\Users\\13673\\Desktop\\Nuclear\\file\\";
|
||||
// private String wrfPrefix = "C:\\Users\\13673\\Desktop\\Nuclear\\file\\";
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param bizWrf
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "wrf-分页列表查询")
|
||||
@ApiOperation(value="wrf-分页列表查询", notes="wrf-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<BizWrf>> queryPageList(BizWrf bizWrf,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BizWrf> queryWrapper = QueryGenerator.initQueryWrapper(bizWrf, req.getParameterMap());
|
||||
Page<BizWrf> page = new Page<BizWrf>(pageNo, pageSize);
|
||||
IPage<BizWrf> pageList = bizWrfService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bizWrf
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "wrf-添加")
|
||||
@ApiOperation(value="wrf-添加", notes="wrf-添加")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BizWrf bizWrf) {
|
||||
bizWrf.setTimeStamp(new Date().getTime()+"");
|
||||
// bizWrf.setTimeStamp("1673629673050");
|
||||
bizWrf.setDy(bizWrf.getDx());
|
||||
|
||||
// 1纬度=111.1949km
|
||||
// SN方向网格数为 纬度差*111.1949/dx(米)
|
||||
// WE方向网格数为 111.1949*cos(中心纬度)*经度差/dx
|
||||
|
||||
Double latM = 111194.9;
|
||||
Double sn = Math.abs(Double.valueOf(bizWrf.getLat1()) - Double.valueOf(bizWrf.getLat2())) * latM / Double.valueOf(bizWrf.getDx());
|
||||
bizWrf.setSn(String.format("%.0f",Math.ceil(sn)));
|
||||
Double we = latM * Math.cos(Math.toRadians(Double.valueOf(bizWrf.getRefLat()))) * Math.abs(Double.valueOf(bizWrf.getLon1()) - Double.valueOf(bizWrf.getLon2())) / Double.valueOf(bizWrf.getDx());
|
||||
bizWrf.setWe(String.format("%.0f",(Math.ceil(we))));
|
||||
|
||||
|
||||
bizWrfService.saveOrUpdate(bizWrf);
|
||||
String newAllRunPath = String.format("%s%s/%s/", baseHome, bizWrf.getCreateBy(),bizWrf.getEngineeringId());
|
||||
File file = new File(newAllRunPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdir();
|
||||
}
|
||||
String runCmd = String.format("cp -r %sAll_Run %s", baseHome, newAllRunPath + bizWrf.getTimeStamp());
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
saveWpsFile(bizWrf);
|
||||
saveInputFile(bizWrf);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
public void saveWpsFile(BizWrf bizWrf){
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/" + bizWrf.getTimeStamp() + "/";
|
||||
String localFilePrefix = wpsLocalPrefix + "/" + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/";
|
||||
String fileName = "namelist.wps";
|
||||
try {
|
||||
String startStr = "";
|
||||
String endStr = "";
|
||||
if (ObjectUtil.isNotEmpty(bizWrf.getMaxDom())){
|
||||
Integer max = bizWrf.getMaxDom();
|
||||
for (int i = 0; i < max; i++) {
|
||||
startStr += String.format("'%s',",bizWrf.getStartTime());
|
||||
endStr += String.format("'%s',",bizWrf.getEndTime());
|
||||
}
|
||||
}else {
|
||||
startStr = String.format("'%s',",bizWrf.getStartData());
|
||||
endStr = String.format("'%s',",bizWrf.getEndData());
|
||||
}
|
||||
String data = new String(readAllBytes(get(cshTemFielPath + "namelistTem.wps")));
|
||||
data = data.replace("#{wrf_core}", bizWrf.getWrfCore())
|
||||
.replace("#{max_dom}", bizWrf.getMaxDom()+"")
|
||||
.replace("#{start_date}", startStr)
|
||||
.replace("#{end_date}", endStr)
|
||||
.replace("#{parent_grid_ratio}", bizWrf.getParentGridRatio())
|
||||
.replace("#{i_parent_start}", bizWrf.getParentStartI())
|
||||
.replace("#{j_parent_start}", bizWrf.getParentStartJ())
|
||||
.replace("#{e_we}", bizWrf.getWe())
|
||||
.replace("#{e_sn}", bizWrf.getSn())
|
||||
.replace("#{geog_data_res}", bizWrf.getGeogDataRes())
|
||||
.replace("#{dx}", bizWrf.getDx())
|
||||
.replace("#{dy}", bizWrf.getDy())
|
||||
.replace("#{map_proj}", bizWrf.getMapProj())
|
||||
.replace("#{ref_lat}", bizWrf.getRefLat())
|
||||
.replace("#{ref_lon}", bizWrf.getRefLon())
|
||||
.replace("#{truelat1}", bizWrf.getTruelat1())
|
||||
.replace("#{truelat2}", bizWrf.getTruelat2())
|
||||
.replace("#{stand_lon}", bizWrf.getStandLon())
|
||||
.replace("#{geog_data_path}", geog_data_path)
|
||||
.replace("#{opt_output_from_metgrid_path}",allRunPath+"WRF/run");
|
||||
// todo sftp 上传
|
||||
FileUtil.writeString(data, localFilePrefix + fileName, "UTF-8");
|
||||
sftpUpload(localFilePrefix + fileName, allRunPath + "WPS", fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void saveInputFile(BizWrf bizWrf){
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/" + bizWrf.getTimeStamp() + "/";
|
||||
String localFilePrefix = wpsLocalPrefix + "/" + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/";
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
|
||||
Calendar startCal = Calendar.getInstance();
|
||||
startCal.setTime(sdf.parse(bizWrf.getStartTime()));
|
||||
Calendar endCal = Calendar.getInstance();
|
||||
endCal.setTime(sdf.parse(bizWrf.getEndTime()));
|
||||
|
||||
String startYear = "";
|
||||
String startMonth = "";
|
||||
String startDay = "";
|
||||
String startHour = "";
|
||||
String endYear = "";
|
||||
String endMonth = "";
|
||||
String endDay = "";
|
||||
String endHour = "";
|
||||
String inputFromFile = "";
|
||||
String historyInterval = "";
|
||||
String framesPerOutfile = "";
|
||||
if (ObjectUtil.isNotEmpty(bizWrf.getMaxDom())){
|
||||
Integer max = bizWrf.getMaxDom();
|
||||
for (int i = 0; i < max; i++) {
|
||||
startYear += String.format("%s,",startCal.get(Calendar.YEAR));
|
||||
startMonth += String.format("%s,",String.format("%0" + 2 + "d", startCal.get(Calendar.MONTH)+1));
|
||||
startDay += String.format("%s,",String.format("%0" + 2 + "d", startCal.get(Calendar.DATE)));
|
||||
startHour += String.format("%s,",String.format("%0" + 2 + "d", startCal.get(Calendar.HOUR_OF_DAY)));
|
||||
endYear += String.format("%s,",startCal.get(Calendar.YEAR));
|
||||
endMonth += String.format("%s,",String.format("%0" + 2 + "d", endCal.get(Calendar.MONTH)+1));
|
||||
endDay += String.format("%s,",String.format("%0" + 2 + "d", endCal.get(Calendar.DATE)));
|
||||
endHour += String.format("%s,",String.format("%0" + 2 + "d", endCal.get(Calendar.HOUR_OF_DAY)));
|
||||
inputFromFile += ".true.,";
|
||||
historyInterval += "60,";
|
||||
framesPerOutfile += "24,";
|
||||
}
|
||||
}else {
|
||||
startYear = String.format("%s,",startCal.get(Calendar.YEAR));
|
||||
startMonth = String.format("%s,",String.format("%0" + 2 + "d", startCal.get(Calendar.MONTH)+1));
|
||||
startDay = String.format("%s,",String.format("%0" + 2 + "d", startCal.get(Calendar.DATE)));
|
||||
startHour = String.format("%s,",String.format("%0" + 2 + "d", startCal.get(Calendar.HOUR_OF_DAY)));
|
||||
endYear = String.format("%s,",startCal.get(Calendar.YEAR));
|
||||
endMonth = String.format("%s,",String.format("%0" + 2 + "d", endCal.get(Calendar.MONTH)+1));
|
||||
endDay = String.format("%s,",String.format("%0" + 2 + "d", endCal.get(Calendar.DATE)));
|
||||
endHour = String.format("%s,",String.format("%0" + 2 + "d", endCal.get(Calendar.HOUR_OF_DAY)));
|
||||
inputFromFile += ".true.,";
|
||||
historyInterval += "60,";
|
||||
framesPerOutfile += "24,";
|
||||
}
|
||||
|
||||
String fileName = "namelist.input";
|
||||
String data = new String(readAllBytes(get(cshTemFielPath + "namelistTem.input")));
|
||||
data = data.replace("#{run_days}", bizWrf.getRunDays())
|
||||
.replace("#{run_hours}", bizWrf.getRunHours())
|
||||
.replace("#{run_minutes}", bizWrf.getRunMinutes())
|
||||
.replace("#{run_seconds}", bizWrf.getRunSeconds())
|
||||
.replace("#{start_year}", startYear)
|
||||
.replace("#{start_month}", startMonth)
|
||||
.replace("#{start_day}", startDay)
|
||||
.replace("#{start_hour}", startHour)
|
||||
.replace("#{end_year}", endYear)
|
||||
.replace("#{end_month}", endMonth)
|
||||
.replace("#{end_day}", endDay)
|
||||
.replace("#{end_hour}", endHour)
|
||||
.replace("#{input_from_file}", inputFromFile)
|
||||
.replace("#{history_interval}", historyInterval)
|
||||
.replace("#{frames_per_outfile}", framesPerOutfile)
|
||||
.replace("#{time_step}", bizWrf.getTimeStep())
|
||||
.replace("#{max_dom}", bizWrf.getMaxDom()+"")
|
||||
.replace("#{e_we}", bizWrf.getWe())
|
||||
.replace("#{e_sn}", bizWrf.getSn())
|
||||
.replace("#{e_vert}", bizWrf.getVert())
|
||||
.replace("#{dx}", bizWrf.getDx())
|
||||
.replace("#{dy}", bizWrf.getDy())
|
||||
.replace("#{i_parent_start}", bizWrf.getParentStartI())
|
||||
.replace("#{j_parent_start}", bizWrf.getParentStartJ())
|
||||
.replace("#{parent_grid_ratio}", bizWrf.getParentGridRatio());
|
||||
// todo sftp 上传
|
||||
FileUtil.writeString(data, localFilePrefix + fileName, "UTF-8");
|
||||
sftpUpload(localFilePrefix + fileName, allRunPath + "WRF/run", fileName);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SftpException e) {
|
||||
e.printStackTrace();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行WPS
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/runWps")
|
||||
public Result<String> runWps(String timeStamp) throws IOException {
|
||||
String engineeringId = bizEngineeringService.getBizEngineeringByState().getId();
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/" + bizWrf.getTimeStamp() + "/";
|
||||
String localFilePrefix = wpsLocalPrefix + "/" + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/";
|
||||
|
||||
String format = "yyyy-MM-dd_hh:mm:ss";
|
||||
String ymdFormat = "yyyy-MM-dd";
|
||||
DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
DateTime endTime = DateUtil.parse(bizWrf.getEndTime(), format);
|
||||
long startTimeSecs = startTime.getTime();
|
||||
long endTimeSecs = endTime.getTime();
|
||||
long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
StringBuffer runLinkGrib = new StringBuffer();
|
||||
for (long tmpSecs = startTimeSecs; tmpSecs <= endTimeSecs; tmpSecs += oneDaySecs) {
|
||||
runLinkGrib.append(fnldataPath).append("fnl_").append(DateUtil.format(new Date(tmpSecs), ymdFormat).replace("-","")).append("* ");
|
||||
}
|
||||
|
||||
String cdWPS = "cd " + allRunPath + "WPS;";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWPS + "./geogrid.exe");
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWPS + "./link_grib.csh " + runLinkGrib + ";cp ungrib/Variable_Tables/Vtable.GFS Vtable");
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWPS + "./ungrib.exe");
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWPS + "./metgrid.exe");
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WPS","metgrid.log",localFilePrefix + "metgrid.log");
|
||||
sftpUtil.logout();
|
||||
String metgridLog = new String(readAllBytes(get(localFilePrefix + "metgrid.log")));
|
||||
if(metgridLog.indexOf("Successful completion of program metgrid.exe") > 0){
|
||||
return Result.OK(metgridLog);
|
||||
}
|
||||
return Result.error(metgridLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/runWrf")
|
||||
public Result<String> runWrf(String timeStamp) throws IOException {
|
||||
String engineeringId = bizEngineeringService.getBizEngineeringByState().getId();
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/" + bizWrf.getTimeStamp() + "/";
|
||||
String localFilePrefix = wpsLocalPrefix + "/" + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/";
|
||||
|
||||
String cdWRF = "cd " + allRunPath + "WRF/run;";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWRF + "ulimit -s unlimited;./real.exe >&real.log");
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWRF + "ulimit -s unlimited;./wrf.exe >&wrf.log");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WRF/run","wrf.log",localFilePrefix + "wrf.log");
|
||||
String wrfLog = new String(readAllBytes(get(localFilePrefix + "wrf.log")));
|
||||
// sftpUtil.download(allRunPath + "WRF/run","rsl.out.0000",localFilePrefix + "rsl.out.0000");
|
||||
// String wrfLog = new String(readAllBytes(get(localFilePrefix + "rsl.out.0000")));
|
||||
if(wrfLog.indexOf("SUCCESS COMPLETE WRF") > 0){
|
||||
String format = "yyyy-MM-dd_HH:mm:ss";
|
||||
DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
String newStartTime = DateUtil.format(new Date(startTime.getTime() + oneDaySecs), format);
|
||||
String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
sftpUtil.download(allRunPath + "WRF/run/",ncNameWrf,localFilePrefix + ncNameWrf);
|
||||
sftpUtil.logout();
|
||||
return Result.OK("SUCCESS COMPLETE WRF");
|
||||
}else{
|
||||
sftpUtil.logout();
|
||||
}
|
||||
// String format = "yyyy-MM-dd_HH:mm:ss";
|
||||
// DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
// long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
// String newStartTime = DateUtil.format(new Date(startTime.getTime() + oneDaySecs), format);
|
||||
// String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
// sftpUtil.download(allRunPath + "WRF/run/",ncNameWrf,wrfLocalPrefix + ncNameWrf);
|
||||
// sftpUtil.logout();
|
||||
// return Result.OK("SUCCESS COMPLETE WRF");
|
||||
return Result.error(wrfLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getRunWrfLog")
|
||||
public Result<String> getRunWrfLog(String timeStamp) {
|
||||
try {
|
||||
String engineeringId = bizEngineeringService.getBizEngineeringByState().getId();
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/" + bizWrf.getTimeStamp() + "/";
|
||||
String localFilePrefix = wpsLocalPrefix + "/" + bizWrf.getCreateBy() + bizWrf.getEngineeringId() + "/";
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
// sftpUtil.download(allRunPath + "WRF/run/","rsl.out.0000",wrfLocalPrefix + "rsl.out.0000");
|
||||
sftpUtil.download(allRunPath + "WRF/run","wrf.log",localFilePrefix + "wrf.log");
|
||||
sftpUtil.logout();
|
||||
String wrfLog = new String(readAllBytes(get(localFilePrefix + "wrf.log")));
|
||||
// String wrfLog = new String(readAllBytes(get("C:\\Users\\13673\\Desktop\\Nuclear\\file\\wrf.log")));
|
||||
return Result.OK(wrfLog);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.error("文件不存在!");
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getNCFileInfo")
|
||||
public Result<List<List<Double[]>>> getNCFileInfo(int layer) {
|
||||
List<List<Double[]>> resultAll = new ArrayList<>();
|
||||
List<List<Double[]>> resultSample = new ArrayList<>();
|
||||
int column = 0;
|
||||
BizEngineering bizEngineeringByState = bizEngineeringService.getBizEngineeringByState();
|
||||
try {
|
||||
NetcdfFile ncfile = NetcdfDataset.open("C:\\Users\\13673\\Desktop\\某源\\Nuclear\\file\\wrfout_d01_2016-07-01_00_00_00");
|
||||
// BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizEngineeringByState.getId()));
|
||||
// String format = "yyyy-MM-dd_HH:mm:ss";
|
||||
// DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
// long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
// String newStartTime = DateUtil.format(new Date(startTime.getTime() + oneDaySecs), format);
|
||||
// String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
// NetcdfFile ncfile = NetcdfDataset.open(wrfLocalPrefix + ncNameWrf);
|
||||
List<List<List<Double>>> xlatAllList = getNCByName(ncfile, "XLAT",layer);
|
||||
List<List<List<Double>>> xlongAllList = getNCByName(ncfile, "XLONG",layer);
|
||||
List<List<List<Double>>> uAllList = getNCByName(ncfile, "U",layer);
|
||||
List<List<List<Double>>> vAllList = getNCByName(ncfile, "V",layer);
|
||||
|
||||
for (int l=0; l<xlatAllList.size();l++) {
|
||||
List<Double[]> result = new ArrayList<>();
|
||||
List<Double> usList = new ArrayList<>();
|
||||
List<Double> vsList = new ArrayList<>();
|
||||
for (int i = 0;i < xlatAllList.get(l).size(); i++) {
|
||||
List<Double> xlats = xlatAllList.get(l).get(i);
|
||||
List<Double> xlongs = xlongAllList.get(l).get(i);
|
||||
List<Double> us = uAllList.get(l).get(i);
|
||||
List<Double> vs = vAllList.get(l).get(i);
|
||||
column = xlats.size();
|
||||
|
||||
for (int j = 0;j < xlats.size(); j++) {
|
||||
Double[] resultArray = new Double[4];
|
||||
resultArray[0] = xlongs.get(j);
|
||||
resultArray[1] = xlats.get(j);
|
||||
resultArray[2] = us.get(j);
|
||||
resultArray[3] = vs.get(j);
|
||||
usList.add(us.get(j));
|
||||
vsList.add(vs.get(j));
|
||||
// resultArray[2] = Math.toDegrees(Math.round(Math.atan(Double.valueOf(us.get(j)) / Double.valueOf(vs.get(j))) * 10) / 10f);
|
||||
// resultArray[3] = Math.sqrt(Double.valueOf(us.get(j)) * Double.valueOf(us.get(j)) + Double.valueOf(vs.get(j)) * Double.valueOf(vs.get(j)));
|
||||
result.add(resultArray);
|
||||
}
|
||||
}
|
||||
|
||||
if(result != null && !result.isEmpty()){
|
||||
resultAll.add(result);
|
||||
}
|
||||
}
|
||||
return Result.OK(resultAll);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getNCTerrainInfo")
|
||||
public Result<List<List<Double[]>>> getNCTerrainInfo() {
|
||||
List<List<Double[]>> resultAll = new ArrayList<>();
|
||||
List<List<Double[]>> resultSample = new ArrayList<>();
|
||||
int column = 0;
|
||||
BizEngineering bizEngineeringByState = bizEngineeringService.getBizEngineeringByState();
|
||||
try {
|
||||
NetcdfFile ncfile = NetcdfDataset.open("C:\\Users\\13673\\Desktop\\某源\\Nuclear\\file\\wrfout_d01_2016-07-01_00_00_00");
|
||||
// BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizEngineeringByState.getId()));
|
||||
// String format = "yyyy-MM-dd_HH:mm:ss";
|
||||
// DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
// long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
// String newStartTime = DateUtil.format(new Date(startTime.getTime() + oneDaySecs), format);
|
||||
// String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
// NetcdfFile ncfile = NetcdfDataset.open(wrfLocalPrefix + ncNameWrf);
|
||||
List<List<List<Double>>> hgtAllList = getNCByName(ncfile, "HGT",0);
|
||||
List<List<List<Double>>> xlatAllList = getNCByName(ncfile, "XLAT",0);
|
||||
List<List<List<Double>>> xlongAllList = getNCByName(ncfile, "XLONG",0);
|
||||
for (int l=0;l<xlatAllList.size();l++) {
|
||||
List<Double[]> result = new ArrayList<>();
|
||||
for (int i = 0; i < hgtAllList.get(l).size(); i++) {
|
||||
List<Double> hgts = hgtAllList.get(l).get(i);
|
||||
List<Double> xlats = xlatAllList.get(l).get(i);
|
||||
List<Double> xlongs = xlongAllList.get(l).get(i);
|
||||
column = xlats.size();
|
||||
for (int j = 0; j < hgts.size(); j++) {
|
||||
Double[] resultArray = new Double[3];
|
||||
resultArray[0] = xlongs.get(j);
|
||||
resultArray[1] = xlats.get(j);
|
||||
resultArray[2] = hgts.get(j);
|
||||
result.add(resultArray);
|
||||
}
|
||||
}
|
||||
resultAll.add(result);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Result.error("未找到WRF输出文件");
|
||||
}
|
||||
return Result.OK(resultAll);
|
||||
}
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getNCPointInfo")
|
||||
public Result<Map<String,String>> getNCPointInfo(String lon,String lat) {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
BizEngineering bizEngineeringByState = bizEngineeringService.getBizEngineeringByState();
|
||||
try {
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizEngineeringByState.getId()));
|
||||
BizOpenfoam bizOpenFoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId, bizWrf.getEngineeringId()));
|
||||
int layer = 0;
|
||||
if(bizOpenFoam != null && bizOpenFoam.getLayer() != null){
|
||||
layer = bizOpenFoam.getLayer();
|
||||
}
|
||||
// NetcdfFile ncfile = NetcdfDataset.open("C:\\Users\\13673\\Desktop\\Nuclear\\file\\new_wrfout_d01_2016-06-30_00_00_00");
|
||||
|
||||
String format = "yyyy-MM-dd_HH:mm:ss";
|
||||
DateTime startTime = DateUtil.parse(bizWrf.getStartTime(), format);
|
||||
long oneDaySecs = 60 * 60 * 24 * 1000;
|
||||
String newStartTime = DateUtil.format(new Date(startTime.getTime() + oneDaySecs), format);
|
||||
String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
NetcdfFile ncfile = NetcdfDataset.open(wrfLocalPrefix + ncNameWrf);
|
||||
List<List<List<Double>>> uAllList = getNCByName(ncfile, "U",0);
|
||||
List<List<List<Double>>> vAllList = getNCByName(ncfile, "V",0);
|
||||
List<List<List<Double>>> pAllList = getNCByName(ncfile, "P",0);
|
||||
List<List<List<Double>>> tAllList = getNCByName(ncfile, "T",0);
|
||||
|
||||
Variable xlatVariable = ncfile.findVariable("XLAT");
|
||||
//时间、纬度、经度
|
||||
int[] shape = xlatVariable.getShape();
|
||||
double latticeWidth = Math.abs(Math.round((Double.valueOf(bizWrf.getLon2()) - Double.valueOf(bizWrf.getLon1())) / (shape[2] - 1) * 10000) / 10000d);
|
||||
Integer lonLatticeIndex = (int)(Math.abs(Math.ceil((Double.valueOf(Double.valueOf(lon)) - Double.valueOf(bizWrf.getLon1()) + (latticeWidth / 2)) / latticeWidth)));
|
||||
double latticeHeight = Math.abs(Math.round((Double.valueOf(bizWrf.getLat2()) - Double.valueOf(bizWrf.getLat1())) / (shape[1] - 1) * 10000) / 10000d);
|
||||
Integer latLatticeIndex = (int)(Math.abs(Math.ceil((Double.valueOf(lat) - Double.valueOf(bizWrf.getLat2()) + (latticeHeight / 2)) / latticeHeight)));
|
||||
// Integer upsideDownLatIndex = vAllList.get(layer).size()-latLatticeIndex;
|
||||
Integer upsideDownLatIndex = latLatticeIndex;
|
||||
if(lonLatticeIndex > Integer.valueOf(bizWrf.getWe())){
|
||||
lonLatticeIndex = Integer.valueOf(bizWrf.getWe());
|
||||
}
|
||||
|
||||
if(upsideDownLatIndex > Integer.valueOf(bizWrf.getSn())){
|
||||
upsideDownLatIndex = Integer.valueOf(bizWrf.getSn());
|
||||
}
|
||||
|
||||
bizWrf.setXIndex(lonLatticeIndex);
|
||||
bizWrf.setYIndex(upsideDownLatIndex);
|
||||
bizWrfService.saveOrUpdate(bizWrf);
|
||||
|
||||
Double uValue = uAllList.get(layer).get(upsideDownLatIndex).get(lonLatticeIndex);
|
||||
Double vValue = vAllList.get(layer).get(upsideDownLatIndex).get(lonLatticeIndex);
|
||||
map.put("uValue",String.format("%.2f",uValue));
|
||||
map.put("vValue",String.format("%.2f",vValue));
|
||||
map.put("windFieldValue",String.format("%.2f",Math.sqrt(Double.valueOf(uValue * Double.valueOf(uValue) + Double.valueOf(vValue) * Double.valueOf(vValue)))));
|
||||
map.put("pValue",String.format("%.2f",pAllList.get(0).get(upsideDownLatIndex).get(lonLatticeIndex)));
|
||||
map.put("tValue",String.format("%.2f",tAllList.get(0).get(upsideDownLatIndex).get(lonLatticeIndex)));
|
||||
map.put("timeStamp",bizWrf.getTimeStamp());
|
||||
return Result.ok(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.error("获取标点信息失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bizWrf
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "wrf-编辑")
|
||||
@ApiOperation(value="wrf-编辑", notes="wrf-编辑")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BizWrf bizWrf) {
|
||||
bizWrfService.updateById(bizWrf);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "wrf-通过id删除")
|
||||
@ApiOperation(value="wrf-通过id删除", notes="wrf-通过id删除")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bizWrfService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "wrf-批量删除")
|
||||
@ApiOperation(value="wrf-批量删除", notes="wrf-批量删除")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.bizWrfService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "wrf-通过id查询")
|
||||
@ApiOperation(value="wrf-通过id查询", notes="wrf-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BizWrf> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BizWrf bizWrf = bizWrfService.getById(id);
|
||||
if(bizWrf==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bizWrf);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询wrf参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "wrf-查询wrf参数")
|
||||
@ApiOperation(value="wrf-查询wrf参数", notes="wrf-查询wrf参数")
|
||||
@GetMapping(value = "/getWrfParam")
|
||||
public Result<BizWrf> getWrfParam(String engineeringId) {
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
if(bizWrf==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bizWrf);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param bizWrf
|
||||
*/
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BizWrf bizWrf) {
|
||||
return super.exportXls(request, bizWrf, BizWrf.class, "wrf");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BizWrf.class);
|
||||
}
|
||||
|
||||
public static List<List<List<Double>>> getNCByName(NetcdfFile ncfile, String name,int layer){
|
||||
Variable variable = ncfile.findVariable(name);
|
||||
List<List<List<Double>>> resultAll = new ArrayList<>();
|
||||
// 读取nc数据到数组
|
||||
Array data = null;
|
||||
try {
|
||||
data = variable.read();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 获取参数和索引,其中shape的前三个参数分别是时间、纬度、经度
|
||||
int[] shape = data.getShape();
|
||||
Index index = data.getIndex();
|
||||
|
||||
if(shape.length == 3){
|
||||
// 将三维数组降维,并用String数组提取数据
|
||||
// 按时间
|
||||
// 按维度
|
||||
for (int i = 0; i < shape[0]; i++) {
|
||||
List<List<Double>> resultPiece = new ArrayList<>();
|
||||
for (int j = 0; j < shape[1]; j++) {
|
||||
List<Double> strings = new ArrayList<>();
|
||||
// 按经度
|
||||
for (int k = 0; k < shape[2]; k++) {
|
||||
// 按照对应索引获取数据并转换为string类型添加到数组中
|
||||
Double dval = Math.round(data.getFloat(index.set(i, j, k)) * 1000) /1000d;
|
||||
strings.add(dval);
|
||||
}
|
||||
resultPiece.add(strings);
|
||||
}
|
||||
resultAll.add(resultPiece);
|
||||
}
|
||||
}else{
|
||||
// 将三维数组降维,并用String数组提取数据
|
||||
// 按时间
|
||||
// 按维度
|
||||
for (int i = 0; i < shape[0]; i++) {
|
||||
List<List<Double>> resultPiece = new ArrayList<>();
|
||||
for (int j = 0; j < shape[2]; j++) {
|
||||
List<Double> strings = new ArrayList<>();
|
||||
// 按经度
|
||||
for (int k = 0; k < shape[3]; k++) {
|
||||
// 按照对应索引获取数据并转换为string类型添加到数组中
|
||||
Double dval = Math.round(data.getFloat(index.set(i,layer, j, k)) * 1000) /1000d;
|
||||
strings.add(dval);
|
||||
}
|
||||
resultPiece.add(strings);
|
||||
}
|
||||
resultAll.add(resultPiece);
|
||||
}
|
||||
}
|
||||
return resultAll;
|
||||
}
|
||||
|
||||
public String getAllRunPath(){
|
||||
String engineeringId = bizEngineeringService.getBizEngineeringByState().getId();
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
return baseHome + bizWrf.getEngineeringId() + "/" + bizWrf.getTimeStamp() + "/";
|
||||
}
|
||||
|
||||
public void sftpUpload(String file,String cshFilePath,String fileName) throws FileNotFoundException, SftpException {
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
sftpUtil.upload(cshFilePath,fileName,inputStream);
|
||||
sftpUtil.logout();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ParseException {
|
||||
double latticeWidth = Math.abs(Math.round((Double.valueOf("-89.28") - Double.valueOf("-104.88")) / 102 * 10000) / 10000d);
|
||||
double lonLatticeIndex = Math.abs(Math.ceil((Double.valueOf("-91.54") - Double.valueOf("-104.88")) / latticeWidth));
|
||||
double latticeHeight = Math.abs(Math.round((Double.valueOf("35.50") - Double.valueOf("44.47")) / 82 * 10000) / 10000d);
|
||||
double latLatticeIndex = Math.abs(Math.ceil((Double.valueOf("42.24") - Double.valueOf("44.47")) / latticeHeight));
|
||||
System.out.println(lonLatticeIndex+"-"+latLatticeIndex);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,208 @@
|
|||
package org.jeecg.modules.project.bizWrf.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("biz_wrf")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="biz_wrf对象", description="wrf")
|
||||
public class BizWrf implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**start_time*/
|
||||
@Excel(name = "start_time", width = 15)
|
||||
@ApiModelProperty(value = "start_time")
|
||||
private String startTime;
|
||||
/**end_time*/
|
||||
@Excel(name = "end_time", width = 15)
|
||||
@ApiModelProperty(value = "end_time")
|
||||
private String endTime;
|
||||
/**run_days*/
|
||||
@Excel(name = "run_days", width = 15)
|
||||
@ApiModelProperty(value = "run_days")
|
||||
private String runDays;
|
||||
/**run_hours*/
|
||||
@Excel(name = "run_hours", width = 15)
|
||||
@ApiModelProperty(value = "run_hours")
|
||||
private String runHours;
|
||||
/**run_minutes*/
|
||||
@Excel(name = "run_minutes", width = 15)
|
||||
@ApiModelProperty(value = "run_minutes")
|
||||
private String runMinutes;
|
||||
/**run_seconds*/
|
||||
@Excel(name = "run_seconds", width = 15)
|
||||
@ApiModelProperty(value = "run_seconds")
|
||||
private String runSeconds;
|
||||
/**interval_seconds*/
|
||||
@Excel(name = "interval_seconds", width = 15)
|
||||
@ApiModelProperty(value = "interval_seconds")
|
||||
private String intervalSeconds;
|
||||
/**history_interval*/
|
||||
@Excel(name = "history_interval", width = 15)
|
||||
@ApiModelProperty(value = "history_interval")
|
||||
private String historyInterval;
|
||||
/**frames_per_outfile*/
|
||||
@Excel(name = "frames_per_outfile", width = 15)
|
||||
@ApiModelProperty(value = "frames_per_outfile")
|
||||
private String framesPerOutfile;
|
||||
/**time_step*/
|
||||
@Excel(name = "time_step", width = 15)
|
||||
@ApiModelProperty(value = "time_step")
|
||||
private String timeStep;
|
||||
/**we*/
|
||||
@Excel(name = "we", width = 15)
|
||||
@ApiModelProperty(value = "we")
|
||||
private String we;
|
||||
/**sn*/
|
||||
@Excel(name = "sn", width = 15)
|
||||
@ApiModelProperty(value = "sn")
|
||||
private String sn;
|
||||
/**vert*/
|
||||
@Excel(name = "vert", width = 15)
|
||||
@ApiModelProperty(value = "vert")
|
||||
private String vert;
|
||||
/**dx*/
|
||||
@Excel(name = "dx", width = 15)
|
||||
@ApiModelProperty(value = "dx")
|
||||
private String dx;
|
||||
/**dy*/
|
||||
@Excel(name = "dy", width = 15)
|
||||
@ApiModelProperty(value = "dy")
|
||||
private String dy;
|
||||
/**physics_suite*/
|
||||
@Excel(name = "physics_suite", width = 15)
|
||||
@ApiModelProperty(value = "physics_suite")
|
||||
private String physicsSuite;
|
||||
/**start_data*/
|
||||
@Excel(name = "start_data", width = 15)
|
||||
@ApiModelProperty(value = "start_data")
|
||||
private String startData;
|
||||
/**end_data*/
|
||||
@Excel(name = "end_data", width = 15)
|
||||
@ApiModelProperty(value = "end_data")
|
||||
private String endData;
|
||||
/**map_proj*/
|
||||
@Excel(name = "map_proj", width = 15)
|
||||
@ApiModelProperty(value = "map_proj")
|
||||
private String mapProj;
|
||||
/**ref_lat*/
|
||||
@Excel(name = "ref_lat", width = 15)
|
||||
@ApiModelProperty(value = "ref_lat")
|
||||
private String refLat;
|
||||
/**ref_lon*/
|
||||
@Excel(name = "ref_lon", width = 15)
|
||||
@ApiModelProperty(value = "ref_lon")
|
||||
private String refLon;
|
||||
/**truelat1*/
|
||||
@Excel(name = "truelat1", width = 15)
|
||||
@ApiModelProperty(value = "truelat1")
|
||||
private String truelat1;
|
||||
/**truelat2*/
|
||||
@Excel(name = "truelat2", width = 15)
|
||||
@ApiModelProperty(value = "truelat2")
|
||||
private String truelat2;
|
||||
/**stand_lon*/
|
||||
@Excel(name = "stand_lon", width = 15)
|
||||
@ApiModelProperty(value = "stand_lon")
|
||||
private String standLon;
|
||||
/**lat1*/
|
||||
@Excel(name = "lat1", width = 15)
|
||||
@ApiModelProperty(value = "lat1")
|
||||
private String lat1;
|
||||
/**lon1*/
|
||||
@Excel(name = "lon1", width = 15)
|
||||
@ApiModelProperty(value = "lon1")
|
||||
private String lon1;
|
||||
/**lat2*/
|
||||
@Excel(name = "lat2", width = 15)
|
||||
@ApiModelProperty(value = "lat2")
|
||||
private String lat2;
|
||||
/**lon2*/
|
||||
@Excel(name = "lon2", width = 15)
|
||||
@ApiModelProperty(value = "lon2")
|
||||
private String lon2;
|
||||
@Excel(name = "engineeringId", width = 15)
|
||||
@ApiModelProperty(value = "engineeringId")
|
||||
private String engineeringId;
|
||||
@Excel(name = "xIndex", width = 15)
|
||||
@ApiModelProperty(value = "xIndex")
|
||||
private int xIndex;
|
||||
@Excel(name = "yIndex", width = 15)
|
||||
@ApiModelProperty(value = "yIndex")
|
||||
private int yIndex;
|
||||
;
|
||||
/*
|
||||
add 23/01/10
|
||||
*/
|
||||
@Excel(name = "wrf_core", width = 15)
|
||||
@ApiModelProperty(value = "wrf_core")
|
||||
private String wrfCore;
|
||||
|
||||
@Excel(name = "max_dom", width = 15)
|
||||
@ApiModelProperty(value = "max_dom")
|
||||
private Integer maxDom;
|
||||
|
||||
@Excel(name = "parent_grid_ratio", width = 15)
|
||||
@ApiModelProperty(value = "parent_grid_ratio")
|
||||
private String parentGridRatio;
|
||||
|
||||
@Excel(name = "parent_start_i", width = 15)
|
||||
@ApiModelProperty(value = "parent_start_i")
|
||||
private String parentStartI;
|
||||
|
||||
@Excel(name = "parent_start_j", width = 15)
|
||||
@ApiModelProperty(value = "parent_start_j")
|
||||
private String parentStartJ;
|
||||
|
||||
@Excel(name = "geog_data_res", width = 15)
|
||||
@ApiModelProperty(value = "geog_data_res")
|
||||
private String geogDataRes;
|
||||
|
||||
@Excel(name = "timeStamp", width = 15)
|
||||
@ApiModelProperty(value = "timeStamp")
|
||||
private String timeStamp;
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.project.bizWrf.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface BizWrfMapper extends BaseMapper<BizWrf> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.modules.demo.bizWrf.mapper.BizWrfMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.project.bizWrf.service;
|
||||
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBizWrfService extends IService<BizWrf> {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.project.bizWrf.service.impl;
|
||||
|
||||
import org.jeecg.modules.project.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.bizWrf.mapper.BizWrfMapper;
|
||||
import org.jeecg.modules.project.bizWrf.service.IBizWrfService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-12-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> implements IBizWrfService {
|
||||
|
||||
}
|
|
@ -0,0 +1,309 @@
|
|||
<template>
|
||||
<a-card :bordered="false">
|
||||
<!-- 查询区域 -->
|
||||
<div class="table-page-search-wrapper">
|
||||
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
||||
<a-row :gutter="24">
|
||||
</a-row>
|
||||
</a-form>
|
||||
</div>
|
||||
<!-- 查询区域-END -->
|
||||
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button type="primary" icon="download" @click="handleExportXls('wrf')">导出</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
|
||||
<a-button type="primary" icon="import">导入</a-button>
|
||||
</a-upload>
|
||||
<!-- 高级查询区域 -->
|
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
|
||||
</a-dropdown>
|
||||
</div>
|
||||
|
||||
<!-- table区域-begin -->
|
||||
<div>
|
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
|
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
|
||||
</div>
|
||||
|
||||
<a-table
|
||||
ref="table"
|
||||
size="middle"
|
||||
:scroll="{x:true}"
|
||||
bordered
|
||||
rowKey="id"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
:loading="loading"
|
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
|
||||
class="j-table-force-nowrap"
|
||||
@change="handleTableChange">
|
||||
|
||||
<template slot="htmlSlot" slot-scope="text">
|
||||
<div v-html="text"></div>
|
||||
</template>
|
||||
<template slot="imgSlot" slot-scope="text,record">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
|
||||
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
|
||||
</template>
|
||||
<template slot="fileSlot" slot-scope="text">
|
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
|
||||
<a-button
|
||||
v-else
|
||||
:ghost="true"
|
||||
type="primary"
|
||||
icon="download"
|
||||
size="small"
|
||||
@click="downloadFile(text)">
|
||||
下载
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
|
||||
<a-divider type="vertical" />
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="handleDetail(record)">详情</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<biz-wrf-modal ref="modalForm" @ok="modalFormOk"></biz-wrf-modal>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import '@/assets/less/TableExpand.less'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
import BizWrfModal from './modules/BizWrfModal'
|
||||
|
||||
export default {
|
||||
name: 'BizWrfList',
|
||||
mixins:[JeecgListMixin, mixinDevice],
|
||||
components: {
|
||||
BizWrfModal
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
description: 'wrf管理页面',
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '',
|
||||
key:'rowIndex',
|
||||
width:60,
|
||||
align:"center",
|
||||
customRender:function (t,r,index) {
|
||||
return parseInt(index)+1;
|
||||
}
|
||||
},
|
||||
{
|
||||
title:'start_time',
|
||||
align:"center",
|
||||
dataIndex: 'startTime'
|
||||
},
|
||||
{
|
||||
title:'end_time',
|
||||
align:"center",
|
||||
dataIndex: 'endTime'
|
||||
},
|
||||
{
|
||||
title:'run_days',
|
||||
align:"center",
|
||||
dataIndex: 'runDays'
|
||||
},
|
||||
{
|
||||
title:'run_hours',
|
||||
align:"center",
|
||||
dataIndex: 'runHours'
|
||||
},
|
||||
{
|
||||
title:'run_minutes',
|
||||
align:"center",
|
||||
dataIndex: 'runMinutes'
|
||||
},
|
||||
{
|
||||
title:'run_seconds',
|
||||
align:"center",
|
||||
dataIndex: 'runSeconds'
|
||||
},
|
||||
{
|
||||
title:'interval_seconds',
|
||||
align:"center",
|
||||
dataIndex: 'intervalSeconds'
|
||||
},
|
||||
{
|
||||
title:'history_interval',
|
||||
align:"center",
|
||||
dataIndex: 'historyInterval'
|
||||
},
|
||||
{
|
||||
title:'frames_per_outfile',
|
||||
align:"center",
|
||||
dataIndex: 'framesPerOutfile'
|
||||
},
|
||||
{
|
||||
title:'time_step',
|
||||
align:"center",
|
||||
dataIndex: 'timeStep'
|
||||
},
|
||||
{
|
||||
title:'we',
|
||||
align:"center",
|
||||
dataIndex: 'we'
|
||||
},
|
||||
{
|
||||
title:'sn',
|
||||
align:"center",
|
||||
dataIndex: 'sn'
|
||||
},
|
||||
{
|
||||
title:'vert',
|
||||
align:"center",
|
||||
dataIndex: 'vert'
|
||||
},
|
||||
{
|
||||
title:'dx',
|
||||
align:"center",
|
||||
dataIndex: 'dx'
|
||||
},
|
||||
{
|
||||
title:'dy',
|
||||
align:"center",
|
||||
dataIndex: 'dy'
|
||||
},
|
||||
{
|
||||
title:'physics_suite',
|
||||
align:"center",
|
||||
dataIndex: 'physicsSuite'
|
||||
},
|
||||
{
|
||||
title:'start_data',
|
||||
align:"center",
|
||||
dataIndex: 'startData'
|
||||
},
|
||||
{
|
||||
title:'end_data',
|
||||
align:"center",
|
||||
dataIndex: 'endData'
|
||||
},
|
||||
{
|
||||
title:'map_proj',
|
||||
align:"center",
|
||||
dataIndex: 'mapProj'
|
||||
},
|
||||
{
|
||||
title:'ref_lat',
|
||||
align:"center",
|
||||
dataIndex: 'refLat'
|
||||
},
|
||||
{
|
||||
title:'ref_lon',
|
||||
align:"center",
|
||||
dataIndex: 'refLon'
|
||||
},
|
||||
{
|
||||
title:'truelat1',
|
||||
align:"center",
|
||||
dataIndex: 'truelat1'
|
||||
},
|
||||
{
|
||||
title:'truelat2',
|
||||
align:"center",
|
||||
dataIndex: 'truelat2'
|
||||
},
|
||||
{
|
||||
title:'stand_lon',
|
||||
align:"center",
|
||||
dataIndex: 'standLon'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
align:"center",
|
||||
fixed:"right",
|
||||
width:147,
|
||||
scopedSlots: { customRender: 'action' }
|
||||
}
|
||||
],
|
||||
url: {
|
||||
list: "/bizWrf/bizWrf/list",
|
||||
delete: "/bizWrf/bizWrf/delete",
|
||||
deleteBatch: "/bizWrf/bizWrf/deleteBatch",
|
||||
exportXlsUrl: "/bizWrf/bizWrf/exportXls",
|
||||
importExcelUrl: "bizWrf/bizWrf/importExcel",
|
||||
|
||||
},
|
||||
dictOptions:{},
|
||||
superFieldList:[],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getSuperFieldList();
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl: function(){
|
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initDictConfig(){
|
||||
},
|
||||
getSuperFieldList(){
|
||||
let fieldList=[];
|
||||
fieldList.push({type:'string',value:'startTime',text:'start_time',dictCode:''})
|
||||
fieldList.push({type:'string',value:'endTime',text:'end_time',dictCode:''})
|
||||
fieldList.push({type:'string',value:'runDays',text:'run_days',dictCode:''})
|
||||
fieldList.push({type:'string',value:'runHours',text:'run_hours',dictCode:''})
|
||||
fieldList.push({type:'string',value:'runMinutes',text:'run_minutes',dictCode:''})
|
||||
fieldList.push({type:'string',value:'runSeconds',text:'run_seconds',dictCode:''})
|
||||
fieldList.push({type:'string',value:'intervalSeconds',text:'interval_seconds',dictCode:''})
|
||||
fieldList.push({type:'string',value:'historyInterval',text:'history_interval',dictCode:''})
|
||||
fieldList.push({type:'string',value:'framesPerOutfile',text:'frames_per_outfile',dictCode:''})
|
||||
fieldList.push({type:'string',value:'timeStep',text:'time_step',dictCode:''})
|
||||
fieldList.push({type:'string',value:'we',text:'we',dictCode:''})
|
||||
fieldList.push({type:'string',value:'sn',text:'sn',dictCode:''})
|
||||
fieldList.push({type:'string',value:'vert',text:'vert',dictCode:''})
|
||||
fieldList.push({type:'string',value:'dx',text:'dx',dictCode:''})
|
||||
fieldList.push({type:'string',value:'dy',text:'dy',dictCode:''})
|
||||
fieldList.push({type:'string',value:'physicsSuite',text:'physics_suite',dictCode:''})
|
||||
fieldList.push({type:'string',value:'startData',text:'start_data',dictCode:''})
|
||||
fieldList.push({type:'string',value:'endData',text:'end_data',dictCode:''})
|
||||
fieldList.push({type:'string',value:'mapProj',text:'map_proj',dictCode:''})
|
||||
fieldList.push({type:'string',value:'refLat',text:'ref_lat',dictCode:''})
|
||||
fieldList.push({type:'string',value:'refLon',text:'ref_lon',dictCode:''})
|
||||
fieldList.push({type:'string',value:'truelat1',text:'truelat1',dictCode:''})
|
||||
fieldList.push({type:'string',value:'truelat2',text:'truelat2',dictCode:''})
|
||||
fieldList.push({type:'string',value:'standLon',text:'stand_lon',dictCode:''})
|
||||
this.superFieldList = fieldList
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
|
@ -0,0 +1,26 @@
|
|||
-- 注意:该页面对应的前台目录为views/bizWrf文件夹下
|
||||
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
|
||||
|
||||
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
|
||||
VALUES ('2022121905425820350', NULL, 'wrf', '/bizWrf/bizWrfList', 'bizWrf/BizWrfList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0);
|
||||
|
||||
-- 权限控制sql
|
||||
-- 新增
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121905425820351', '2022121905425820350', '添加wrf', NULL, NULL, 0, NULL, NULL, 2, 'bizWrf:biz_wrf:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 编辑
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121905425820352', '2022121905425820350', '编辑wrf', NULL, NULL, 0, NULL, NULL, 2, 'bizWrf:biz_wrf:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121905425820353', '2022121905425820350', '删除wrf', NULL, NULL, 0, NULL, NULL, 2, 'bizWrf:biz_wrf:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 批量删除
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121905425820354', '2022121905425820350', '批量删除wrf', NULL, NULL, 0, NULL, NULL, 2, 'bizWrf:biz_wrf:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导出excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121905425820355', '2022121905425820350', '导出excel_wrf', NULL, NULL, 0, NULL, NULL, 2, 'bizWrf:biz_wrf:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0, 0, '1', 0);
|
||||
-- 导入excel
|
||||
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
|
||||
VALUES ('2022121905425820356', '2022121905425820350', '导入excel_wrf', NULL, NULL, 0, NULL, NULL, 2, 'bizWrf:biz_wrf:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2022-12-19 17:42:35', NULL, NULL, 0, 0, '1', 0);
|
|
@ -0,0 +1,219 @@
|
|||
<template>
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<j-form-container :disabled="formDisabled">
|
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="start_time" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startTime">
|
||||
<a-input v-model="model.startTime" placeholder="请输入start_time" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="end_time" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endTime">
|
||||
<a-input v-model="model.endTime" placeholder="请输入end_time" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="run_days" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="runDays">
|
||||
<a-input v-model="model.runDays" placeholder="请输入run_days" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="run_hours" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="runHours">
|
||||
<a-input v-model="model.runHours" placeholder="请输入run_hours" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="run_minutes" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="runMinutes">
|
||||
<a-input v-model="model.runMinutes" placeholder="请输入run_minutes" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="run_seconds" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="runSeconds">
|
||||
<a-input v-model="model.runSeconds" placeholder="请输入run_seconds" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="interval_seconds" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="intervalSeconds">
|
||||
<a-input v-model="model.intervalSeconds" placeholder="请输入interval_seconds" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="history_interval" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="historyInterval">
|
||||
<a-input v-model="model.historyInterval" placeholder="请输入history_interval" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="frames_per_outfile" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="framesPerOutfile">
|
||||
<a-input v-model="model.framesPerOutfile" placeholder="请输入frames_per_outfile" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="time_step" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="timeStep">
|
||||
<a-input v-model="model.timeStep" placeholder="请输入time_step" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="we" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="we">
|
||||
<a-input v-model="model.we" placeholder="请输入we" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="sn" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sn">
|
||||
<a-input v-model="model.sn" placeholder="请输入sn" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="vert" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="vert">
|
||||
<a-input v-model="model.vert" placeholder="请输入vert" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="dx" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dx">
|
||||
<a-input v-model="model.dx" placeholder="请输入dx" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="dy" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dy">
|
||||
<a-input v-model="model.dy" placeholder="请输入dy" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="physics_suite" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="physicsSuite">
|
||||
<a-input v-model="model.physicsSuite" placeholder="请输入physics_suite" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="start_data" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startData">
|
||||
<a-input v-model="model.startData" placeholder="请输入start_data" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="end_data" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endData">
|
||||
<a-input v-model="model.endData" placeholder="请输入end_data" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="map_proj" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="mapProj">
|
||||
<a-input v-model="model.mapProj" placeholder="请输入map_proj" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ref_lat" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="refLat">
|
||||
<a-input v-model="model.refLat" placeholder="请输入ref_lat" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="ref_lon" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="refLon">
|
||||
<a-input v-model="model.refLon" placeholder="请输入ref_lon" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="truelat1" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="truelat1">
|
||||
<a-input v-model="model.truelat1" placeholder="请输入truelat1" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="truelat2" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="truelat2">
|
||||
<a-input v-model="model.truelat2" placeholder="请输入truelat2" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="stand_lon" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="standLon">
|
||||
<a-input v-model="model.standLon" placeholder="请输入stand_lon" ></a-input>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
</j-form-container>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import { validateDuplicateValue } from '@/utils/util'
|
||||
|
||||
export default {
|
||||
name: 'BizWrfForm',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
//表单禁用
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
model:{
|
||||
},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
validatorRules: {
|
||||
},
|
||||
url: {
|
||||
add: "/bizWrf/bizWrf/add",
|
||||
edit: "/bizWrf/bizWrf/edit",
|
||||
queryById: "/bizWrf/bizWrf/queryById"
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
return this.disabled
|
||||
},
|
||||
},
|
||||
created () {
|
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit(this.modelDefault);
|
||||
},
|
||||
edit (record) {
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
},
|
||||
submitForm () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
that.confirmLoading = true;
|
||||
let httpurl = '';
|
||||
let method = '';
|
||||
if(!this.model.id){
|
||||
httpurl+=this.url.add;
|
||||
method = 'post';
|
||||
}else{
|
||||
httpurl+=this.url.edit;
|
||||
method = 'put';
|
||||
}
|
||||
httpAction(httpurl,this.model,method).then((res)=>{
|
||||
if(res.success){
|
||||
that.$message.success(res.message);
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,84 @@
|
|||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:width="width"
|
||||
placement="right"
|
||||
:closable="false"
|
||||
@close="close"
|
||||
destroyOnClose
|
||||
:visible="visible">
|
||||
<biz-wrf-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></biz-wrf-form>
|
||||
<div class="drawer-footer">
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
|
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BizWrfForm from './BizWrfForm'
|
||||
|
||||
export default {
|
||||
name: 'BizWrfModal',
|
||||
components: {
|
||||
BizWrfForm
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
width:800,
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
});
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/** Button按钮间距 */
|
||||
.ant-btn {
|
||||
margin-left: 30px;
|
||||
margin-bottom: 30px;
|
||||
float: right;
|
||||
}
|
||||
.drawer-footer{
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
width: 100%;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 16px;
|
||||
text-align: right;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,60 @@
|
|||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:width="width"
|
||||
:visible="visible"
|
||||
switchFullscreen
|
||||
@ok="handleOk"
|
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
||||
@cancel="handleCancel"
|
||||
cancelText="关闭">
|
||||
<biz-wrf-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></biz-wrf-form>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import BizWrfForm from './BizWrfForm'
|
||||
export default {
|
||||
name: 'BizWrfModal',
|
||||
components: {
|
||||
BizWrfForm
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
title:'',
|
||||
width:800,
|
||||
visible: false,
|
||||
disableSubmit: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.add();
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.visible=true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.realForm.edit(record);
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.realForm.submitForm();
|
||||
},
|
||||
submitCallback(){
|
||||
this.$emit('ok');
|
||||
this.visible = false;
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,80 @@
|
|||
package org.jeecg.modules.project.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Properties;
|
||||
|
||||
public class CmdUtil {
|
||||
|
||||
public static String execCmd(String cmd, String... params) {
|
||||
String paramString = String.join(" ", params);
|
||||
String cmdString = String.format("%s %s", cmd, paramString);
|
||||
System.out.println("cmdString = " + cmdString);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
String[] fullCmd = { "sh", "-c", cmdString };// 此处用于填写需要执行的命令,规则设定真实执行中需要空格的地方,这里变成String数组的来间隔开,至于sh -c命令建议网上自行脑补,我们这次执行的实际命令是查询目前linux系统存在的tomcat进程,命令如右:ps -ef|grep tomcat
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
Process p = runtime.exec(fullCmd);
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(p.getInputStream()));
|
||||
try {
|
||||
while (br.readLine() != null)
|
||||
;
|
||||
if(br != null){
|
||||
br.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
BufferedReader br = null;
|
||||
br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
p.waitFor();
|
||||
br.close();
|
||||
p.destroy();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String execCmd2(String cmd, String... params) {
|
||||
String paramString = String.join(" ", params);
|
||||
String cmdString = String.format("%s %s", cmd, paramString);
|
||||
System.out.println("cmdString = " + cmdString);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
String[] fullCmd = { "sh", "-c", cmdString };// 此处用于填写需要执行的命令,规则设定真实执行中需要空格的地方,这里变成String数组的来间隔开,至于sh -c命令建议网上自行脑补,我们这次执行的实际命令是查询目前linux系统存在的tomcat进程,命令如右:ps -ef|grep tomcat
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
Process process = runtime.exec(fullCmd);
|
||||
process.waitFor();
|
||||
//Process p = Runtime.getRuntime().exec(fullCmd);//创建实例进程执行命令行代码
|
||||
//p.waitFor();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
//BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
|
||||
String line = null;
|
||||
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line + "\n");
|
||||
}
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
package org.jeecg.modules.project.util;
|
||||
|
||||
import com.jcraft.jsch.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
|
||||
public class SFTPUtil {
|
||||
|
||||
private ChannelSftp sftp;
|
||||
|
||||
private Session session;
|
||||
// SFTP 登录用户名
|
||||
// private String username = "xiongzheng";
|
||||
//SFTP 登录密码
|
||||
// private String password = "512109";
|
||||
//私钥
|
||||
private String privateKey;
|
||||
//SFTP 服务器地址IP地址
|
||||
// private String host = "192.168.8.114";
|
||||
//SFTP 端口
|
||||
// private int port = 22;
|
||||
|
||||
|
||||
/**
|
||||
* 构造基于密码认证的sftp对象
|
||||
*/
|
||||
// public SFTPUtil(String username, String password, String host, int port) {
|
||||
// this.username = username;
|
||||
// this.password = password;
|
||||
// this.host = host;
|
||||
// this.port = port;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 构造基于秘钥认证的sftp对象
|
||||
*/
|
||||
// public SFTPUtil(String username, String host, int port, String privateKey) {
|
||||
// this.username = username;
|
||||
// this.host = host;
|
||||
// this.port = port;
|
||||
// this.privateKey = privateKey;
|
||||
// }
|
||||
|
||||
public SFTPUtil() { }
|
||||
|
||||
|
||||
/**
|
||||
* 连接sftp服务器
|
||||
*/
|
||||
public void login(String username, String password, String host, Integer port) {
|
||||
try {
|
||||
JSch jsch = new JSch();
|
||||
if (privateKey != null) {
|
||||
jsch.addIdentity(privateKey);// 设置私钥
|
||||
}
|
||||
|
||||
session = jsch.getSession(username, host, port);
|
||||
|
||||
if (password != null) {
|
||||
session.setPassword(password);
|
||||
}
|
||||
Properties config = new Properties();
|
||||
config.put("StrictHostKeyChecking", "no");
|
||||
|
||||
session.setConfig(config);
|
||||
session.connect(60 * 1000 * 10);
|
||||
System.out.println("session:"+session);
|
||||
Channel channel = session.openChannel("sftp");
|
||||
channel.connect(60 * 1000 * 10);
|
||||
|
||||
sftp = (ChannelSftp) channel;
|
||||
System.out.println("login-sftp:" + sftp);
|
||||
} catch (JSchException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭连接 server
|
||||
*/
|
||||
public void logout() {
|
||||
if (sftp != null) {
|
||||
if (sftp.isConnected()) {
|
||||
sftp.disconnect();
|
||||
}
|
||||
}
|
||||
if (session != null) {
|
||||
if (session.isConnected()) {
|
||||
session.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将输入流的数据上传到sftp作为文件。文件完整路径=basePath+directory
|
||||
*
|
||||
* @param directory 上传到该目录
|
||||
* @param sftpFileName sftp端文件名
|
||||
*/
|
||||
public boolean upload(String directory, String sftpFileName, InputStream input) throws SftpException {
|
||||
System.out.println("upload-sftp:" + sftp);
|
||||
try {
|
||||
if (directory != null && !"".equals(directory)) {
|
||||
sftp.cd(directory);
|
||||
}
|
||||
sftp.put(input, sftpFileName); //上传文件
|
||||
return true;
|
||||
} catch (SftpException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void cd(String directory) throws SftpException {
|
||||
if (directory != null && !"".equals(directory) && !"/".equals(directory)) {
|
||||
sftp.cd(directory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载文件。
|
||||
*
|
||||
* @param directory 下载目录
|
||||
* @param downloadFile 下载的文件
|
||||
* @param saveFile 存在本地的路径
|
||||
*/
|
||||
public void download(String directory, String downloadFile, String saveFile) {
|
||||
System.out.println("download:" + directory + " downloadFile:" + downloadFile + " saveFile:" + saveFile);
|
||||
|
||||
File file = null;
|
||||
try {
|
||||
if (directory != null && !"".equals(directory)) {
|
||||
System.out.println(sftp);
|
||||
sftp.cd(directory);
|
||||
}
|
||||
file = new File(saveFile);
|
||||
sftp.get(downloadFile, new FileOutputStream(file));
|
||||
} catch (SftpException | FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
if (file != null) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param directory 要删除文件所在目录
|
||||
* @param deleteFile 要删除的文件
|
||||
*/
|
||||
public void delete(String directory, String deleteFile) throws SftpException {
|
||||
if (directory != null && !"".equals(directory)) {
|
||||
sftp.cd(directory);
|
||||
}
|
||||
sftp.rm(deleteFile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列出目录下的文件
|
||||
*
|
||||
* @param directory 要列出的目录
|
||||
*/
|
||||
public List<String> listFiles(String directory) throws SftpException {
|
||||
Vector<?> objects = sftp.ls(directory);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (Object s : objects){
|
||||
String x = s.toString();
|
||||
String[] s1 = x.split(" ");
|
||||
System.out.println(s1[s1.length -1]);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public boolean isExistsFile(String directory, String fileName) {
|
||||
|
||||
List<String> findFileList = new ArrayList<>();
|
||||
ChannelSftp.LsEntrySelector selector = lsEntry -> {
|
||||
if (lsEntry.getFilename().equals(fileName)) {
|
||||
findFileList.add(fileName);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
try {
|
||||
sftp.ls(directory, selector);
|
||||
} catch (SftpException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return findFileList.size() > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user