hky
This commit is contained in:
parent
3d9007ecc1
commit
0e9c9ea548
|
@ -10,6 +10,10 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.calculateConfig.bizCmaq.entity.BizCmaq;
|
||||
import org.jeecg.modules.project.calculateConfig.bizCmaq.service.IBizCmaqService;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.service.IBizWrfService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -26,6 +30,12 @@ public class BizEngineeringController {
|
|||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Autowired
|
||||
private IBizWrfService bizWrfService;
|
||||
|
||||
@Autowired
|
||||
private IBizCmaqService bizCmaqService;
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
|
||||
|
@ -43,7 +53,7 @@ public class BizEngineeringController {
|
|||
eq(BizEngineering::getCreateBy,sysUser.getUsername()).
|
||||
orderByDesc(BizEngineering::getCreateTime));
|
||||
if(bizEngineerings == null || bizEngineerings.isEmpty()) {
|
||||
String engPath = String.format("%s%s",baseHome,sysUser.getUsername());
|
||||
String engPath = String.format("%s%s/",baseHome,sysUser.getUsername());
|
||||
BizEngineering bizEngineering = new BizEngineering();
|
||||
bizEngineering.setCreateBy(sysUser.getUsername());
|
||||
bizEngineering.setCreateTime(new Date());
|
||||
|
@ -53,9 +63,9 @@ public class BizEngineeringController {
|
|||
bizEngineeringService.save(bizEngineering);
|
||||
bizEngineerings.add(bizEngineering);
|
||||
}
|
||||
for (BizEngineering bizEngineering : bizEngineerings) {
|
||||
bizEngineering.setEngineeringPath(bizEngineering.getEngineeringPath() + "/" + bizEngineering.getId());
|
||||
}
|
||||
// for (BizEngineering bizEngineering : bizEngineerings) {
|
||||
// bizEngineering.setEngineeringPath(bizEngineering.getEngineeringPath() + "/" + bizEngineering.getEngineeringName());
|
||||
// }
|
||||
return Result.OK(bizEngineerings);
|
||||
}
|
||||
|
||||
|
@ -70,12 +80,34 @@ public class BizEngineeringController {
|
|||
@ApiOperation(value="工程管理-添加", notes="工程管理-添加")
|
||||
//@RequiresPermissions("bizWrf:biz_wrf:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BizEngineering bizEngineering) {
|
||||
public Result<BizEngineering> add(@RequestBody BizEngineering bizEngineering) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String engPath= String.format("%s%s",baseHome,sysUser.getUsername());
|
||||
String engPath = String.format("%s%s/",baseHome,sysUser.getUsername());
|
||||
bizEngineering.setEngineeringPath(engPath);
|
||||
bizEngineeringService.save(bizEngineering);
|
||||
return Result.OK("添加成功!");
|
||||
|
||||
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getTemType, bizEngineering.getSceneType()));
|
||||
bizWrf.setId(null);
|
||||
bizWrf.setEngineeringId(bizEngineering.getId());
|
||||
bizWrf.setTemType(0);
|
||||
bizWrf.setUpdateBy(null);
|
||||
bizWrf.setUpdateTime(null);
|
||||
bizWrf.setCreateBy(null);
|
||||
bizWrf.setCreateTime(null);
|
||||
bizWrfService.save(bizWrf);
|
||||
|
||||
BizCmaq bizCmaq = bizCmaqService.getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getTemType, bizEngineering.getSceneType()));
|
||||
bizCmaq.setId(null);
|
||||
bizCmaq.setEngineeringId(bizEngineering.getId());
|
||||
bizCmaq.setTemType(0);
|
||||
bizCmaq.setUpdateBy(null);
|
||||
bizCmaq.setUpdateTime(null);
|
||||
bizCmaq.setCreateBy(null);
|
||||
bizCmaq.setCreateTime(null);
|
||||
bizCmaqService.save(bizCmaq);
|
||||
|
||||
return Result.OK(bizEngineering);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,27 +118,41 @@ public class BizEngineeringController {
|
|||
*/
|
||||
@AutoLog(value = "工程管理-编辑")
|
||||
@ApiOperation(value="工程管理-编辑", notes="工程管理-编辑")
|
||||
//@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("编辑成功!");
|
||||
// }
|
||||
/**
|
||||
* 修改运行状态
|
||||
*
|
||||
* @param bizEngineering
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "工程管理-修改运行状态")
|
||||
@ApiOperation(value="工程管理-修改运行状态", notes="工程管理-修改运行状态")
|
||||
@PutMapping(value = "/updateRunStatus")
|
||||
public Result<String> updateRunStatus(@RequestBody BizEngineering bizEngineering) {
|
||||
bizEngineeringService.updateById(bizEngineering);
|
||||
return Result.OK("修改运行状态成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="工程管理-通过id查询", notes="工程管理-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BizEngineering> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BizEngineering bizEngineering = bizEngineeringService.getById(id);
|
||||
if(bizEngineering==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bizEngineering);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最新工程
|
||||
|
|
|
@ -42,9 +42,12 @@ public class BizEngineering {
|
|||
* */
|
||||
@ApiModelProperty(value = "工程存放地址")
|
||||
private String engineeringPath;
|
||||
/**工程选中状态*/
|
||||
@ApiModelProperty(value = "工程选中状态")
|
||||
private int engineeringState;
|
||||
/**工程运行状态*/
|
||||
@ApiModelProperty(value = "工程运行状态")
|
||||
private int runStatus;
|
||||
/**异常时运行阶段*/
|
||||
@ApiModelProperty(value = "异常时运行阶段")
|
||||
private int errorStatus;
|
||||
/**备注*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.jeecg.modules.project.baseConfig.bizEngineering.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.entity.BizEngineering;
|
||||
|
||||
public interface IBizEngineeringService extends IService<BizEngineering> {
|
||||
BizEngineering getBizEngineeringByTime();
|
||||
void updateRunStatus(String engId,int status);
|
||||
void updateErrorStatus(String engId,int status);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,14 @@ package org.jeecg.modules.project.baseConfig.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.baseConfig.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.mapper.BizEngineeringMapper;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.service.IBizEngineeringService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -26,7 +28,7 @@ public class BizEngineeringServiceImpl extends ServiceImpl<BizEngineeringMapper,
|
|||
eq(BizEngineering::getCreateBy,sysUser.getUsername()).
|
||||
orderByDesc(BizEngineering::getCreateTime));
|
||||
if(bizEngineerings == null || bizEngineerings.isEmpty()) {
|
||||
String engPath= String.format("%s%s",baseHome,sysUser.getUsername());
|
||||
String engPath = String.format("%s%s/",baseHome,sysUser.getUsername());
|
||||
BizEngineering bizEngineering = new BizEngineering();
|
||||
bizEngineering.setCreateBy(sysUser.getUsername());
|
||||
bizEngineering.setCreateTime(new Date());
|
||||
|
@ -38,4 +40,20 @@ public class BizEngineeringServiceImpl extends ServiceImpl<BizEngineeringMapper,
|
|||
}
|
||||
return bizEngineerings.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRunStatus(String engId,int status){
|
||||
BizEngineering bizEngineering = new BizEngineering();
|
||||
bizEngineering.setId(engId);
|
||||
bizEngineering.setRunStatus(status);
|
||||
this.baseMapper.updateById(bizEngineering);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateErrorStatus(String engId,int status){
|
||||
BizEngineering bizEngineering = new BizEngineering();
|
||||
bizEngineering.setId(engId);
|
||||
bizEngineering.setRunStatus(status);
|
||||
this.baseMapper.updateById(bizEngineering);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@ public class BizRoleController extends JeecgController<BizRole, IBizRoleService>
|
|||
*/
|
||||
@AutoLog(value = "Gis和角色权限管理表-批量编辑")
|
||||
@ApiOperation(value="Gis和角色权限管理表-批量编辑", notes="Gis和角色权限管理表-批量编辑")
|
||||
@RequiresPermissions("bizRole:biz_role:editBatch")
|
||||
@RequestMapping(value = "/editBatch", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> editBatch(@RequestBody List<BizRole> bizRoles) {
|
||||
for (BizRole bizRole : bizRoles) {
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
package org.jeecg.modules.project.baseConfig.bizSourceItem.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.entity.BizSourceItem;
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.service.IBizSourceItemService;
|
||||
|
||||
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.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.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;
|
||||
|
||||
/**
|
||||
* @Description: 源项参数
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="源项参数")
|
||||
@RestController
|
||||
@RequestMapping("/bizSourceItem/bizSourceItem")
|
||||
@Slf4j
|
||||
public class BizSourceItemController extends JeecgController<BizSourceItem, IBizSourceItemService> {
|
||||
@Autowired
|
||||
private IBizSourceItemService bizSourceItemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param bizSourceItem
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "源项参数-分页列表查询")
|
||||
@ApiOperation(value="源项参数-分页列表查询", notes="源项参数-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<BizSourceItem>> queryPageList(BizSourceItem bizSourceItem,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BizSourceItem> queryWrapper = QueryGenerator.initQueryWrapper(bizSourceItem, req.getParameterMap());
|
||||
Page<BizSourceItem> page = new Page<BizSourceItem>(pageNo, pageSize);
|
||||
IPage<BizSourceItem> pageList = bizSourceItemService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bizSourceItem
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "源项参数-添加")
|
||||
@ApiOperation(value="源项参数-添加", notes="源项参数-添加")
|
||||
@RequiresPermissions("bizSourceItem:biz_source_item:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody BizSourceItem bizSourceItem) {
|
||||
bizSourceItemService.save(bizSourceItem);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bizSourceItem
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "源项参数-编辑")
|
||||
@ApiOperation(value="源项参数-编辑", notes="源项参数-编辑")
|
||||
@RequiresPermissions("bizSourceItem:biz_source_item:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody BizSourceItem bizSourceItem) {
|
||||
bizSourceItemService.updateById(bizSourceItem);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "源项参数-通过id删除")
|
||||
@ApiOperation(value="源项参数-通过id删除", notes="源项参数-通过id删除")
|
||||
@RequiresPermissions("bizSourceItem:biz_source_item:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bizSourceItemService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "源项参数-批量删除")
|
||||
@ApiOperation(value="源项参数-批量删除", notes="源项参数-批量删除")
|
||||
@RequiresPermissions("bizSourceItem:biz_source_item:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.bizSourceItemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "源项参数-通过id查询")
|
||||
@ApiOperation(value="源项参数-通过id查询", notes="源项参数-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<BizSourceItem> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BizSourceItem bizSourceItem = bizSourceItemService.getById(id);
|
||||
if(bizSourceItem==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bizSourceItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param bizSourceItem
|
||||
*/
|
||||
@RequiresPermissions("bizSourceItem:biz_source_item:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BizSourceItem bizSourceItem) {
|
||||
return super.exportXls(request, bizSourceItem, BizSourceItem.class, "源项参数");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("bizSourceItem:biz_source_item:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BizSourceItem.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package org.jeecg.modules.project.baseConfig.bizSourceItem.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: 源项参数
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("biz_source_item")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="biz_source_item对象", description="源项参数")
|
||||
public class BizSourceItem 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;
|
||||
/**核素种类*/
|
||||
@Excel(name = "核素种类", width = 15)
|
||||
@ApiModelProperty(value = "核素种类")
|
||||
private String nuclideType;
|
||||
/**释放量*/
|
||||
@Excel(name = "释放量", width = 15)
|
||||
@ApiModelProperty(value = "释放量")
|
||||
private Double releaseAmount;
|
||||
/**释放时间*/
|
||||
@Excel(name = "释放时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "释放时间")
|
||||
private Date releaseTime;
|
||||
/**持续时间*/
|
||||
@Excel(name = "持续时间", width = 15)
|
||||
@ApiModelProperty(value = "持续时间")
|
||||
private Double durationTime;
|
||||
/**释放高度*/
|
||||
@Excel(name = "释放高度", width = 15)
|
||||
@ApiModelProperty(value = "释放高度")
|
||||
private Double releaseHeight;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.project.baseConfig.bizSourceItem.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.entity.BizSourceItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 源项参数
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BizSourceItemMapper extends BaseMapper<BizSourceItem> {
|
||||
|
||||
}
|
|
@ -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.project.baseConfig.bizSourceItem.mapper.BizSourceItemMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.project.baseConfig.bizSourceItem.service;
|
||||
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.entity.BizSourceItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 源项参数
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBizSourceItemService extends IService<BizSourceItem> {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.project.baseConfig.bizSourceItem.service.impl;
|
||||
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.entity.BizSourceItem;
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.mapper.BizSourceItemMapper;
|
||||
import org.jeecg.modules.project.baseConfig.bizSourceItem.service.IBizSourceItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 源项参数
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-26
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BizSourceItemServiceImpl extends ServiceImpl<BizSourceItemMapper, BizSourceItem> implements IBizSourceItemService {
|
||||
|
||||
}
|
|
@ -96,8 +96,8 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
|
|||
@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.setColsN(Integer.valueOf(wrf.getWe()) -3 + "");
|
||||
bizCmaq.setRowsN(Integer.valueOf(wrf.getSn()) -3 + "");
|
||||
bizCmaq.setWrfLcRefLat(wrf.getRefLat());
|
||||
bizCmaqService.saveOrUpdate(bizCmaq);
|
||||
return Result.OK("添加成功!");
|
||||
|
@ -180,8 +180,8 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
|
|||
}
|
||||
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.setColsN(Integer.valueOf(wrf.getWe()) -3 + "");
|
||||
bizCmaq.setRowsN(Integer.valueOf(wrf.getSn()) -3 + "");
|
||||
bizCmaq.setWrfLcRefLat(wrf.getRefLat());
|
||||
}
|
||||
return Result.OK(bizCmaq);
|
||||
|
|
|
@ -242,7 +242,7 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
|
|||
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);
|
||||
List<String> coAndPecInfo = bizOpenfoamService.getCoAndPecInfo(wrf,engineering.getEngineeringName());
|
||||
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());
|
||||
|
@ -283,7 +283,9 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
|
|||
String ncName = "CCTM_ACONC_v532_2016_12SE1_" + sdf.format(sdf.parse(bizCmaq.getStartDate())).replace("-", "") + ".nc";
|
||||
NetcdfFile ncfile = NetcdfDataset.open(targetFilePath + ncName);
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId, bizEngineering.getId()));
|
||||
String ncNameWrf = "wrfout_d01_" + bizWrf.getStartTime();
|
||||
//正式环境需要修改
|
||||
// String ncNameWrf = "wrfout_d01_" + bizWrf.getStartTime();
|
||||
String ncNameWrf = "wrfout_d01_2016-07-01_00_00_00";
|
||||
NetcdfFile griddot2d = NetcdfDataset.open(targetFilePath + ncNameWrf);
|
||||
List<List<List<Double>>> coAllList = getNCByName(ncfile, "CO", layer);
|
||||
List<List<List<Double>>> no2AllList = getNCByName(ncfile, "NO2", layer);
|
||||
|
|
|
@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
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;
|
||||
|
@ -27,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.mapper.BizWrfMapper;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.modules.util.SFTPUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -54,10 +56,14 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
|
|||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Value("${spring.localFilePrefix}")
|
||||
private String localFilePrefix;
|
||||
@Value("${spring.cshTemFielPath}")
|
||||
private String cshTemFielPath;
|
||||
@Value("${spring.localFilePrefix}")
|
||||
private String localFilePrefix;
|
||||
@Value("${spring.OpenFOAM.runOpenFOAMPath}")
|
||||
private String runOpenFOAMPath;
|
||||
@Value("${spring.OpenFOAM.temFielPath}")
|
||||
private String temFielPath;
|
||||
@Value("${spring.Linux.ip}")
|
||||
private String ip;
|
||||
@Value("${spring.Linux.username}")
|
||||
|
@ -145,18 +151,17 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
|
|||
public String runOpenFoam(String engineeringId) throws IOException {
|
||||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
BizOpenfoam openfoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId,engineeringId));
|
||||
String openFoamPath = localFilePrefix + "OpenFOAM/" + openfoam.getCreateBy() + "/" + engineering.getEngineeringName();
|
||||
String openFoamPath = runOpenFOAMPath + openfoam.getCreateBy() + "/" + engineering.getEngineeringName();
|
||||
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);
|
||||
public double[][][] resolveOpenFoamResult(int startLine,int x,int y,int z,String localFilePath,String param) throws IOException {
|
||||
if(StringUtils.isBlank(param)){
|
||||
param = "c1";
|
||||
}
|
||||
Path p = Paths.get( openFoamPath + "/" + stepFileName + "/" + param);
|
||||
Path p = Paths.get( localFilePath + "/" + param);
|
||||
List<String> lines = Files.readAllLines(p);
|
||||
double[][][] result = new double[x][y][z];
|
||||
if(lines != null && !lines.isEmpty()) {
|
||||
|
@ -185,12 +190,11 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
|
|||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
|
||||
String openFoamPath = localFilePrefix + "OpenFOAM/" + wrf.getCreateBy() + "/" + engineering.getEngineeringName();
|
||||
// String openFoamPath = "C:\\Users\\13673\\Desktop\\Nuclear\\file\\openfoam\\bak\\cylinder_U";
|
||||
String systemPath = openFoamPath + "/system/";
|
||||
String openFoamPath = runOpenFOAMPath + wrf.getCreateBy() + "/" + engineering.getEngineeringName();
|
||||
String localFilePath = localFilePrefix + wrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
|
||||
String [] hexArray = null;
|
||||
List<String> blockMeshDictFileInfos = Files.readAllLines(Paths.get(systemPath + "blockMeshDict"));
|
||||
List<String> blockMeshDictFileInfos = Files.readAllLines(Paths.get(cshTemFielPath + "blockMeshDict"));
|
||||
for (String info : blockMeshDictFileInfos) {
|
||||
if(info.indexOf("hex") > 0){
|
||||
int index1 = info.indexOf("(");
|
||||
|
@ -233,15 +237,20 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
|
|||
@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 = localFilePrefix + "OpenFOAM/" + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName();
|
||||
String openFoamPath = runOpenFOAMPath + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName();
|
||||
String resultFilePath = openFoamPath + "/0/";
|
||||
String localFilePath = localFilePrefix + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName() + "/";
|
||||
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");
|
||||
FileUtil.writeString(uFileValue.replace("#{value}", String.format("(%s %s %s)",uValue,vValue,windFieldValue)), localFilePath + "U", "UTF-8");
|
||||
FileUtil.writeString(pFileValue.replace("#{value}", pValue), localFilePath + "p", "UTF-8");
|
||||
FileUtil.writeString(tFileValue.replace("#{value}", tValue), localFilePath + "T", "UTF-8");
|
||||
|
||||
sftpUpload(localFilePath + "U", resultFilePath, "U");
|
||||
sftpUpload(localFilePath + "p", resultFilePath, "p");
|
||||
sftpUpload(localFilePath + "T", resultFilePath, "T");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
|
@ -259,33 +268,35 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
|
|||
public String saveOpenFoamConfig(@RequestBody BizOpenfoam bizOpenfoam) {
|
||||
try {
|
||||
BizEngineering bizEngineering = bizEngineeringService.getById(bizOpenfoam.getEngineeringId());
|
||||
String openFoamPath = localFilePrefix + "OpenFOAM/";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, "rm -rf " + openFoamPath + bizOpenfoam.getCreateBy() + "/" +bizEngineering.getEngineeringName());
|
||||
String runCmd = String.format("cp -r %scylinder_U %s%s/%s",cshTemFielPath,openFoamPath,bizOpenfoam.getCreateBy(),bizEngineering.getEngineeringName());
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, String.format("mkdir %s",runOpenFOAMPath + bizOpenfoam.getCreateBy()));
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, "rm -rf " + runOpenFOAMPath + bizOpenfoam.getCreateBy() + "/" +bizEngineering.getEngineeringName());
|
||||
|
||||
String runCmd = String.format("cp -r %s %s%s/%s",temFielPath,runOpenFOAMPath,bizOpenfoam.getCreateBy(),bizEngineering.getEngineeringName());
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
|
||||
String controlDictFilePath = openFoamPath + bizOpenfoam.getCreateBy() + "/" + bizEngineering.getEngineeringName() + "/system/controlDict";
|
||||
String controlDictFilePath = cshTemFielPath + "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){
|
||||
if(controlDict.indexOf("application ") >= 0){
|
||||
controlDict = "application "+bizOpenfoam.getApplication()+";";
|
||||
}
|
||||
if(controlDict.indexOf("startTime ") > 0){
|
||||
if(controlDict.indexOf("startTime ") >= 0){
|
||||
controlDict = "startTime "+bizOpenfoam.getStartTime()+";";
|
||||
}
|
||||
if(controlDict.indexOf("endTime ") > 0){
|
||||
if(controlDict.indexOf("endTime ") >= 0){
|
||||
controlDict = "endTime "+bizOpenfoam.getEndTime()+";";
|
||||
}
|
||||
if(controlDict.indexOf("deltaT ") > 0){
|
||||
if(controlDict.indexOf("deltaT ") >= 0){
|
||||
controlDict = "deltaT "+bizOpenfoam.getDeltat()+";";
|
||||
}
|
||||
if(controlDict.indexOf("writeInterval ") > 0){
|
||||
if(controlDict.indexOf("writeInterval ") >= 0){
|
||||
controlDict = "writeInterval "+bizOpenfoam.getWriteinterval()+";";
|
||||
}
|
||||
result.add(controlDict);
|
||||
}
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(controlDictFilePath);
|
||||
String localFilePath = localFilePrefix + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName() + "/";
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(localFilePath + "controlDict");
|
||||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fileOutputStream));
|
||||
for (String res : result) {
|
||||
bw.write(res);
|
||||
|
@ -295,11 +306,24 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
|
|||
bw.close();
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
|
||||
sftpUpload(localFilePath + "controlDict", runOpenFOAMPath + bizOpenfoam.getCreateBy() + "/" +bizEngineering.getEngineeringName() + "/system/", "controlDict");
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SftpException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "添加成功!";
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface IBizOpenfoamService extends IService<BizOpenfoam> {
|
||||
|
||||
List<String> getCoAndPecInfo(BizWrf wrf);
|
||||
List<String> getCoAndPecInfo(BizWrf wrf,String engineeringName);
|
||||
String getStepFileName(String systemPath);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package org.jeecg.modules.project.calculateConfig.bizOpenfoam.service.impl;
|
||||
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.entity.BizOpenfoam;
|
||||
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.mapper.BizOpenfoamMapper;
|
||||
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.service.IBizOpenfoamService;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.jeecg.modules.util.SFTPUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -29,24 +29,30 @@ import java.util.regex.Pattern;
|
|||
@Service
|
||||
public class BizOpenfoamServiceImpl extends ServiceImpl<BizOpenfoamMapper, BizOpenfoam> implements IBizOpenfoamService {
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
|
||||
@Value("${spring.OpenFOAM.runOpenFOAMPath}")
|
||||
private String runOpenFOAMPath;
|
||||
@Value("${spring.cshTemFielPath}")
|
||||
private String cshTemFielPath;
|
||||
@Value("${spring.localFilePrefix}")
|
||||
private String localFilePrefix;
|
||||
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
@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;
|
||||
|
||||
@Override
|
||||
public List<String> getCoAndPecInfo(BizWrf wrf) {
|
||||
BizEngineering engineering = bizEngineeringService.getById(wrf.getEngineeringId());
|
||||
String openFoamPath = localFilePrefix + "OpenFOAM/" + wrf.getCreateBy() + "/" + engineering.getEngineeringName();
|
||||
|
||||
public List<String> getCoAndPecInfo(BizWrf wrf,String engineeringName) {
|
||||
String openFoamPath = runOpenFOAMPath + wrf.getCreateBy() + "/" + engineeringName;
|
||||
String localFilePath = localFilePrefix + wrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
String stepFileName = getStepFileName(openFoamPath);
|
||||
try {
|
||||
String [] hexArray = null;
|
||||
List<String> blockMeshDictFileInfos = Files.readAllLines(Paths.get(openFoamPath + "/system/" + "blockMeshDict"));
|
||||
List<String> blockMeshDictFileInfos = Files.readAllLines(Paths.get(cshTemFielPath + "blockMeshDict"));
|
||||
for (String info : blockMeshDictFileInfos) {
|
||||
if(info.indexOf("hex") > 0){
|
||||
int index1 = info.indexOf("(");
|
||||
|
@ -56,8 +62,15 @@ public class BizOpenfoamServiceImpl extends ServiceImpl<BizOpenfoamMapper, BizOp
|
|||
}
|
||||
}
|
||||
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"));
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(openFoamPath + "/" + stepFileName,"c1",localFilePath + "c1");
|
||||
sftpUtil.download(openFoamPath + "/" + stepFileName,"c2",localFilePath + "c2");
|
||||
sftpUtil.logout();
|
||||
|
||||
List<String> c1Lines = Files.readAllLines(Paths.get(localFilePath + "/c1"));
|
||||
List<String> c2Lines = Files.readAllLines(Paths.get(localFilePath + "/c2"));
|
||||
List<Double> c1Values = new ArrayList<>();
|
||||
List<Double> c2Values = new ArrayList<>();
|
||||
for (int i = 22; i < count; i++) {
|
||||
|
@ -76,7 +89,7 @@ public class BizOpenfoamServiceImpl extends ServiceImpl<BizOpenfoamMapper, BizOp
|
|||
|
||||
@Override
|
||||
public String getStepFileName(String systemPath){
|
||||
List<String> folderNames = getFolderNames(systemPath);
|
||||
String [] folderNames = RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, String.format("cd %s;ls",systemPath)).split("\\n");
|
||||
List<Double> stepFileNames = new ArrayList<>();
|
||||
for (String folderName : folderNames) {
|
||||
if(isNumeric(folderName)){
|
||||
|
@ -85,10 +98,6 @@ public class BizOpenfoamServiceImpl extends ServiceImpl<BizOpenfoamMapper, BizOp
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
|
||||
public void saveWpsFile(BizWrf bizWrf,String engineeringName){
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
String localFilePath = localFilePrefix + "/" + bizWrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
String fileName = "namelist.wps";
|
||||
try {
|
||||
String startStr = "";
|
||||
|
@ -199,7 +199,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
|
||||
public void saveInputFile(BizWrf bizWrf,String engineeringName){
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
String localFilePath = localFilePrefix + "/" + bizWrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineeringName + "/";
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
|
||||
Calendar startCal = Calendar.getInstance();
|
||||
|
@ -288,6 +288,18 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取程序运行路径
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getAllRunPath")
|
||||
public String getAllRunPath(String engineeringId) {
|
||||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
String allRunPath = baseHome + engineering.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
return allRunPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 运行WPS
|
||||
*
|
||||
|
@ -298,7 +310,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineering.getId()));
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
String localFilePath = localFilePrefix + "/" + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
|
||||
String format = "yyyy-MM-dd_hh:mm:ss";
|
||||
String ymdFormat = "yyyy-MM-dd";
|
||||
|
@ -338,11 +350,11 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineering.getId()));
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
String localFilePath = localFilePrefix + "/" + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
|
||||
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");
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWRF + "ulimit -s unlimited;./real.exe");
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWRF + "ulimit -s unlimited;./wrf.exe");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
|
@ -384,7 +396,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineering.getId()));
|
||||
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
String localFilePath = localFilePrefix + "/" + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
|
@ -412,6 +424,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
List<List<Double[]>> resultSample = new ArrayList<>();
|
||||
int column = 0;
|
||||
BizEngineering bizEngineering = bizEngineeringService.getById(engineeringId);
|
||||
String localFilePath = localFilePrefix + "/" + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName() + "/";
|
||||
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,bizEngineering.getId()));
|
||||
|
@ -419,8 +432,10 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
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(localFilePrefix + ncNameWrf);
|
||||
//正式环境需要修改
|
||||
// String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
String ncNameWrf = "wrfout_d01_2016-07-01_00_00_00";
|
||||
NetcdfFile ncfile = NetcdfDataset.open(localFilePath + 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);
|
||||
|
@ -473,6 +488,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
List<List<Double[]>> resultSample = new ArrayList<>();
|
||||
int column = 0;
|
||||
BizEngineering bizEngineering = bizEngineeringService.getById(engineeringId);
|
||||
String localFilePath = localFilePrefix + "/" + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName() + "/";
|
||||
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,bizEngineering.getId()));
|
||||
|
@ -480,8 +496,10 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
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(localFilePrefix + ncNameWrf);
|
||||
//正式环境需要修改
|
||||
// String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
String ncNameWrf = "wrfout_d01_2016-07-01_00_00_00";
|
||||
NetcdfFile ncfile = NetcdfDataset.open(localFilePath + 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);
|
||||
|
@ -518,6 +536,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
public Result<Map<String,String>> getNCPointInfo(String engineeringId,String lon,String lat) {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
BizEngineering bizEngineering = bizEngineeringService.getById(engineeringId);
|
||||
String localFilePath = localFilePrefix + "/" + bizEngineering.getCreateBy() + "/" + bizEngineering.getEngineeringName() + "/";
|
||||
try {
|
||||
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizEngineering.getId()));
|
||||
BizOpenfoam bizOpenFoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId, bizWrf.getEngineeringId()));
|
||||
|
@ -531,8 +550,10 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
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(localFilePrefix + ncNameWrf);
|
||||
//正式环境需要修改
|
||||
// String ncNameWrf = "wrfout_d01_" + newStartTime;
|
||||
String ncNameWrf = "wrfout_d01_2016-07-01_00_00_00";
|
||||
NetcdfFile ncfile = NetcdfDataset.open(localFilePath + 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);
|
||||
|
@ -761,5 +782,7 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
|
|||
// 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);
|
||||
// String wmhr = RemoteExecuteCommand.runRemoteLinuxCmd("192.168.115.128", "wmhr", "123456", "cd /home/wmhr/OpenFOAM-8/run/admin/工程001/;ls");
|
||||
// System.out.println(wmhr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.jeecg.modules.project.calculateConfig.bizWrf.service;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
* @Author: jeecg-boot
|
||||
|
@ -11,4 +14,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IBizWrfService extends IService<BizWrf> {
|
||||
|
||||
Result<String> runGeogrid(String allRunPath, String engineeringId)throws IOException;
|
||||
Result<String> runUngrib(String allRunPath, String engineeringId)throws IOException;
|
||||
Result<String> runMetgrid(String allRunPath, String engineeringId)throws IOException;
|
||||
Result<String> runReal(String allRunPath, String engineeringId)throws IOException;
|
||||
Result<String> runWrf(String allRunPath, String engineeringId) throws IOException;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
package org.jeecg.modules.project.calculateConfig.bizWrf.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.util.RemoteExecuteCommand;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.mapper.BizWrfMapper;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.service.IBizWrfService;
|
||||
import org.jeecg.modules.util.SFTPUtil;
|
||||
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 org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import static java.nio.file.Files.readAllBytes;
|
||||
import static java.nio.file.Paths.get;
|
||||
|
||||
/**
|
||||
* @Description: wrf
|
||||
|
@ -16,4 +32,145 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
@Service
|
||||
public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> implements IBizWrfService {
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
@Value("${spring.localFilePrefix}")
|
||||
private String localFilePrefix;
|
||||
@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;
|
||||
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Override
|
||||
public Result<String> runGeogrid(String allRunPath, String engineeringId) throws IOException {
|
||||
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
|
||||
String cdWPS = "cd " + allRunPath + "WPS;";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWPS + "./geogrid.exe");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WPS","geogrid.log",localFilePath + "geogrid.log");
|
||||
sftpUtil.logout();
|
||||
String geogridLog = new String(readAllBytes(get(localFilePath + "geogrid.log")));
|
||||
if(geogridLog.indexOf("Successful completion of program geogrid.exe") > 0){
|
||||
bizEngineeringService.updateRunStatus(engineeringId,1);
|
||||
return Result.OK("geogrid执行成功");
|
||||
}else{
|
||||
bizEngineeringService.updateErrorStatus(engineeringId,1);
|
||||
return Result.OK(geogridLog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> runUngrib(String allRunPath,String engineeringId) throws IOException {
|
||||
BizWrf bizWrf = this.baseMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
|
||||
String cdWPS = "cd " + allRunPath + "WPS;";
|
||||
|
||||
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("* ");
|
||||
}
|
||||
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");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WPS","ungrib.log",localFilePath + "ungrib.log");
|
||||
sftpUtil.logout();
|
||||
String ungribLog = new String(readAllBytes(get(localFilePath + "ungrib.log")));
|
||||
if(ungribLog.indexOf("Successful completion of program ungrib.exe") > 0){
|
||||
bizEngineeringService.updateRunStatus(engineeringId,2);
|
||||
return Result.OK("ungrib执行成功");
|
||||
}else{
|
||||
bizEngineeringService.updateErrorStatus(engineeringId,2);
|
||||
return Result.OK(ungribLog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> runMetgrid(String allRunPath,String engineeringId) throws IOException {
|
||||
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
|
||||
String cdWPS = "cd " + allRunPath + "WPS;";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWPS + "./metgrid.exe");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WPS","metgrid.log",localFilePath + "metgrid.log");
|
||||
sftpUtil.logout();
|
||||
String metgridLog = new String(readAllBytes(get(localFilePath + "metgrid.log")));
|
||||
if(metgridLog.indexOf("Successful completion of program metgrid.exe") > 0){
|
||||
bizEngineeringService.updateRunStatus(engineeringId,3);
|
||||
return Result.OK("metgrid执行成功");
|
||||
}else{
|
||||
bizEngineeringService.updateErrorStatus(engineeringId,3);
|
||||
return Result.OK(metgridLog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> runReal(String allRunPath,String engineeringId) throws IOException {
|
||||
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
|
||||
String cdWRF = "cd " + allRunPath + "WRF/run;";
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWRF + "ulimit -s unlimited;./real.exe");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WRF/run","rsl.out.0000",localFilePath + "rsl.out.0000");
|
||||
sftpUtil.logout();
|
||||
String realLog = new String(readAllBytes(get(localFilePath + "rsl.out.0000")));
|
||||
if(realLog.indexOf("SUCCESS COMPLETE REAL_EM INIT") > 0){
|
||||
bizEngineeringService.updateRunStatus(engineeringId,4);
|
||||
return Result.OK("real执行成功");
|
||||
}else{
|
||||
bizEngineeringService.updateErrorStatus(engineeringId,4);
|
||||
return Result.OK(realLog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> runWrf(String allRunPath,String engineeringId) throws IOException {
|
||||
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
|
||||
String cdWRF = "cd " + allRunPath + "WRF/run;";
|
||||
BizWrf bizWrf = this.baseMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
|
||||
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, cdWRF + "ulimit -s unlimited;./wrf.exe");
|
||||
|
||||
SFTPUtil sftpUtil = new SFTPUtil();
|
||||
sftpUtil.login(username, password,ip,port);
|
||||
sftpUtil.download(allRunPath + "WRF/run","rsl.out.0000",localFilePath + "rsl.out.0000");
|
||||
String wrfLog = new String(readAllBytes(get(localFilePath + "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,localFilePath + ncNameWrf);
|
||||
sftpUtil.logout();
|
||||
|
||||
bizEngineeringService.updateRunStatus(engineeringId,5);
|
||||
return Result.OK("SUCCESS COMPLETE WRF");
|
||||
}
|
||||
bizEngineeringService.updateErrorStatus(engineeringId,5);
|
||||
sftpUtil.logout();
|
||||
return Result.error(wrfLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package org.jeecg.modules.project.calculateResult.runProcess.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.entity.BizEngineering;
|
||||
import org.jeecg.modules.project.baseConfig.bizEngineering.service.IBizEngineeringService;
|
||||
import org.jeecg.modules.project.calculateConfig.bizWrf.service.IBizWrfService;
|
||||
import org.jeecg.modules.project.calculateResult.bizResultDiffuse.entity.BizResultDiffuse;
|
||||
import org.jeecg.modules.project.calculateResult.bizResultDiffuse.service.IBizResultDiffuseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 运行过程
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-09-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="运行过程")
|
||||
@RestController
|
||||
@RequestMapping("/runProcess")
|
||||
@Slf4j
|
||||
public class RunProcessController extends JeecgController<BizResultDiffuse, IBizResultDiffuseService> {
|
||||
|
||||
@Autowired
|
||||
private IBizEngineeringService bizEngineeringService;
|
||||
|
||||
@Autowired
|
||||
private IBizWrfService bizWrfService;
|
||||
|
||||
@Value("${spring.baseHome}")
|
||||
private String baseHome;
|
||||
|
||||
|
||||
/**
|
||||
* 运行wrf所有程序
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "运行过程-运行wrf所有程序")
|
||||
@ApiOperation(value="运行过程-运行wrf所有程序", notes="运行过程-运行wrf所有程序")
|
||||
@GetMapping(value = "/runAllExe")
|
||||
public Result<String> runAllExe(String engineeringId) throws IOException {
|
||||
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
|
||||
String allRunPath = baseHome + engineering.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
|
||||
bizWrfService.runGeogrid(allRunPath,engineeringId);
|
||||
bizWrfService.runUngrib(allRunPath,engineeringId);
|
||||
bizWrfService.runMetgrid(allRunPath,engineeringId);
|
||||
bizWrfService.runReal(allRunPath,engineeringId);
|
||||
bizWrfService.runWrf(allRunPath,engineeringId);
|
||||
return Result.OK("运行成功!");
|
||||
}
|
||||
}
|
|
@ -28,6 +28,9 @@ spring:
|
|||
fnldataPath: /home/wmhr/Build_WRF/WPS/fnldata/
|
||||
CMAQ:
|
||||
pythonPath: /home/wmhr/python/
|
||||
OpenFOAM:
|
||||
runOpenFOAMPath: /home/wmhr/OpenFOAM-8/run/
|
||||
temFielPath: /home/wmhr/OpenFOAM-8/cylinder_U/
|
||||
Linux:
|
||||
ip: 192.168.115.128
|
||||
username: wmhr
|
||||
|
|
Loading…
Reference in New Issue
Block a user