This commit is contained in:
hky 2023-10-18 09:45:23 +08:00
parent 8704a91554
commit a96be0b65d
46 changed files with 877 additions and 872 deletions

View File

@ -0,0 +1,7 @@
package org.jeecg.modules.constants;
public class GriddConstants {
public static final double NY_GRIDD_RADII = 1.0742; // 纽约网格半径()
}

View File

@ -66,7 +66,6 @@ public class BizCityAimController extends JeecgController<BizCityAim, IBizCityAi
*/
@AutoLog(value = "城市目标表-添加")
@ApiOperation(value="城市目标表-添加", notes="城市目标表-添加")
@RequiresPermissions("bizCityAim:biz_city_aim:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizCityAim bizCityAim) {
bizCityAimService.save(bizCityAim);
@ -81,7 +80,6 @@ public class BizCityAimController extends JeecgController<BizCityAim, IBizCityAi
*/
@AutoLog(value = "城市目标表-编辑")
@ApiOperation(value="城市目标表-编辑", notes="城市目标表-编辑")
@RequiresPermissions("bizCityAim:biz_city_aim:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizCityAim bizCityAim) {
bizCityAimService.updateById(bizCityAim);
@ -96,7 +94,6 @@ public class BizCityAimController extends JeecgController<BizCityAim, IBizCityAi
*/
@AutoLog(value = "城市目标表-通过id删除")
@ApiOperation(value="城市目标表-通过id删除", notes="城市目标表-通过id删除")
@RequiresPermissions("bizCityAim:biz_city_aim:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizCityAimService.removeById(id);
@ -111,7 +108,6 @@ public class BizCityAimController extends JeecgController<BizCityAim, IBizCityAi
*/
@AutoLog(value = "城市目标表-批量删除")
@ApiOperation(value="城市目标表-批量删除", notes="城市目标表-批量删除")
@RequiresPermissions("bizCityAim:biz_city_aim:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizCityAimService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -79,7 +79,6 @@ public class BizFacilityAimController extends JeecgController<BizFacilityAim, IB
*/
@AutoLog(value = "设施目标表-添加")
@ApiOperation(value="设施目标表-添加", notes="设施目标表-添加")
@RequiresPermissions("bizFacilityAim:biz_facility_aim:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizFacilityAim bizFacilityAim) {
bizFacilityAimService.save(bizFacilityAim);
@ -94,7 +93,6 @@ public class BizFacilityAimController extends JeecgController<BizFacilityAim, IB
*/
@AutoLog(value = "设施目标表-编辑")
@ApiOperation(value="设施目标表-编辑", notes="设施目标表-编辑")
@RequiresPermissions("bizFacilityAim:biz_facility_aim:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizFacilityAim bizFacilityAim) {
bizFacilityAimService.updateById(bizFacilityAim);
@ -109,7 +107,6 @@ public class BizFacilityAimController extends JeecgController<BizFacilityAim, IB
*/
@AutoLog(value = "设施目标表-通过id删除")
@ApiOperation(value="设施目标表-通过id删除", notes="设施目标表-通过id删除")
@RequiresPermissions("bizFacilityAim:biz_facility_aim:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizFacilityAimService.removeById(id);
@ -124,7 +121,6 @@ public class BizFacilityAimController extends JeecgController<BizFacilityAim, IB
*/
@AutoLog(value = "设施目标表-批量删除")
@ApiOperation(value="设施目标表-批量删除", notes="设施目标表-批量删除")
@RequiresPermissions("bizFacilityAim:biz_facility_aim:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizFacilityAimService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -65,8 +65,8 @@ public class BizFacilityAim implements Serializable {
@ApiModelProperty(value = "设施地区")
private String facilityArea;
/**纬度*/
@Excel(name = "", width = 15)
@ApiModelProperty(value = "")
@Excel(name = "", width = 15)
@ApiModelProperty(value = "")
private Double facilityLon;
/**纬度*/
@Excel(name = "纬度", width = 15)
@ -100,4 +100,8 @@ public class BizFacilityAim implements Serializable {
@Excel(name = "描述", width = 15)
@ApiModelProperty(value = "描述")
private String description;
/**设施图片*/
@Excel(name = "设施图片", width = 15)
@ApiModelProperty(value = "设施图片")
private String facilityImage;
}

View File

@ -11,8 +11,14 @@ import org.jeecg.common.system.vo.LoginUser;
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.baseConfig.bizModeLink.entity.BizModeLink;
import org.jeecg.modules.project.baseConfig.bizModeLink.service.IBizModeLinkService;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.entity.BizCalpuff;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.service.IBizCalpuffService;
import org.jeecg.modules.project.calculateConfig.bizCmaq.entity.BizCmaq;
import org.jeecg.modules.project.calculateConfig.bizCmaq.service.IBizCmaqService;
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.entity.BizOpenfoam;
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.service.IBizOpenfoamService;
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;
@ -37,10 +43,17 @@ public class BizEngineeringController {
@Autowired
private IBizCmaqService bizCmaqService;
@Autowired
private IBizOpenfoamService bizOpenfoamService;
@Autowired
private IBizCalpuffService bizCalpuffService;
@Autowired
private IBizModeLinkService bizModeLinkService;
@Value("${spring.baseHome}")
private String baseHome;
@Value("${spring.localFilePrefix}")
private String localFilePrefix;
@Value("${spring.Linux.ip}")
private String ip;
@Value("${spring.Linux.username}")
@ -61,17 +74,6 @@ public class BizEngineeringController {
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);
}
return Result.OK(bizEngineerings);
}
@ -84,7 +86,6 @@ public class BizEngineeringController {
*/
@AutoLog(value = "工程管理-添加")
@ApiOperation(value="工程管理-添加", notes="工程管理-添加")
//@RequiresPermissions("bizWrf:biz_wrf:add")
@PostMapping(value = "/add")
public Result<BizEngineering> add(@RequestBody BizEngineering bizEngineering) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@ -92,26 +93,47 @@ public class BizEngineeringController {
bizEngineering.setEngineeringPath(engPath);
bizEngineeringService.save(bizEngineering);
Integer sceneType = bizEngineering.getSceneType();
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);
BizModeLink bizModeLink = bizModeLinkService.getOne(new LambdaQueryWrapper<BizModeLink>().eq(BizModeLink::getSceneType, sceneType));
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);
if(bizModeLink.getSourceitemModeId() == 1){
BizOpenfoam bizOpenfoam = bizOpenfoamService.getOne(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getTemType, 0).eq(BizOpenfoam::getSceneType,sceneType));
bizOpenfoam.setId(null);
bizOpenfoam.setEngineeringId(bizEngineering.getId());
bizOpenfoam.setTemType(1);
bizOpenfoam.setSceneType(sceneType);
bizOpenfoam.setModeType(bizModeLink.getSourceitemModeId());
bizOpenfoamService.save(bizOpenfoam);
}
if(bizModeLink.getWeatherModeId() == 1){
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getTemType, 0).eq(BizWrf::getSceneType,sceneType));
bizWrf.setId(null);
bizWrf.setEngineeringId(bizEngineering.getId());
bizWrf.setTemType(1);
bizWrf.setSceneType(sceneType);
bizWrf.setModeType(bizModeLink.getSourceitemModeId());
bizWrfService.save(bizWrf);
}
if(bizModeLink.getDiffuseModeId() == 1){
BizCmaq bizCmaq = bizCmaqService.getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getTemType, 0).eq(BizCmaq::getSceneType,sceneType));
bizCmaq.setId(null);
bizCmaq.setEngineeringId(bizEngineering.getId());
bizCmaq.setTemType(1);
bizCmaq.setSceneType(sceneType);
bizCmaq.setModeType(bizModeLink.getDiffuseModeId());
bizCmaqService.save(bizCmaq);
}else{
BizCalpuff bizCalpuff = bizCalpuffService.getOne(new LambdaQueryWrapper<BizCalpuff>().eq(BizCalpuff::getTemType, 0).eq(BizCalpuff::getSceneType, sceneType));
bizCalpuff.setId(null);
bizCalpuff.setEngineeringId(bizEngineering.getId());
bizCalpuff.setTemType(1);
bizCalpuff.setSceneType(sceneType);
bizCalpuff.setModeType(bizModeLink.getDiffuseModeId());
bizCalpuffService.save(bizCalpuff);
}
return Result.OK(bizEngineering);
}
@ -187,6 +209,10 @@ public class BizEngineeringController {
@ApiOperation(value="工程管理-查询最新工程", notes="工程管理-查询最新工程")
@GetMapping(value = "/getBizEngineeringByTime")
public Result<BizEngineering> getBizEngineeringByTime() {
return Result.ok(bizEngineeringService.getBizEngineeringByTime());
BizEngineering bizEngineeringByTime = bizEngineeringService.getBizEngineeringByTime();
if(bizEngineeringByTime == null){
Result.error("未查询到工程信息!",null);
}
return Result.ok(bizEngineeringByTime);
}
}

View File

@ -35,7 +35,7 @@ public class BizEngineering {
@ApiModelProperty(value = "工程名称")
private String engineeringName;
/**场景类型*/
@ApiModelProperty(value = "场景类型")
@ApiModelProperty(value = "sceneType(1:核,2:设施,3:化学,4:泄露)")
private Integer sceneType;
/**
* 工程存放地址(baseHome/userName)前端显示时需要拼接工程ID

View File

@ -7,6 +7,8 @@ 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.jeecg.modules.project.calculateConfig.bizCalpuff.entity.BizCalpuff;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.mapper.BizCalpuffMapper;
import org.jeecg.modules.project.calculateConfig.bizCmaq.entity.BizCmaq;
import org.jeecg.modules.project.calculateConfig.bizCmaq.mapper.BizCmaqMapper;
import org.jeecg.modules.project.calculateConfig.bizConfigChemistry.entity.BizConfigChemistry;
@ -39,15 +41,13 @@ import java.util.List;
@Service
public class BizEngineeringServiceImpl extends ServiceImpl<BizEngineeringMapper, BizEngineering> implements IBizEngineeringService {
@Value("${spring.baseHome}")
private String baseHome;
@Autowired
private BizWrfMapper bizWrfMapper;
@Autowired
private BizCmaqMapper bizCmaqMapper;
@Autowired
private BizCalpuffMapper bizCalpuffMapper;
@Autowired
private IBizOpenfoamService bizOpenfoamService;
@Autowired
@ -74,15 +74,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());
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 null;
}
return bizEngineerings.get(0);
}
@ -107,12 +99,14 @@ public class BizEngineeringServiceImpl extends ServiceImpl<BizEngineeringMapper,
this.baseMapper.deleteById(engId);
bizWrfMapper.delete(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engId));
bizCmaqMapper.delete(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,engId));
bizCalpuffMapper.delete(new LambdaQueryWrapper<BizCalpuff>().eq(BizCalpuff::getEngineeringId,engId));
bizOpenfoamService.remove(new LambdaQueryWrapper<BizOpenfoam>().eq(BizOpenfoam::getEngineeringId,engId));
bizConfigChemistryService.remove(new LambdaQueryWrapper<BizConfigChemistry>().eq(BizConfigChemistry::getEngineeringId,engId));
bizConfigLeakService.remove(new LambdaQueryWrapper<BizConfigLeak>().eq(BizConfigLeak::getEngineeringId,engId));
bizConfigFacilityService.remove(new LambdaQueryWrapper<BizConfigFacility>().eq(BizConfigFacility::getEngineeringId,engId));
bizConfigNucleusService.remove(new LambdaQueryWrapper<BizConfigNucleus>().eq(BizConfigNucleus::getEngineeringId,engId));
bizResultDiffuseService.remove(new LambdaQueryWrapper<BizResultDiffuse>().eq(BizResultDiffuse::getEngineeringId,engId));
bizResultDosageService.remove(new LambdaQueryWrapper<BizResultDosage>().eq(BizResultDosage::getEngineeringId,engId));
bizResultOptimizeService.remove(new LambdaQueryWrapper<BizResultOptimize>().eq(BizResultOptimize::getEngineeringId,engId));

View File

@ -9,6 +9,8 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
@ -20,6 +22,14 @@ 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.calculateConfig.bizCalpuff.entity.BizCalpuff;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.service.IBizCalpuffService;
import org.jeecg.modules.project.calculateConfig.bizCmaq.entity.BizCmaq;
import org.jeecg.modules.project.calculateConfig.bizCmaq.service.IBizCmaqService;
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.entity.BizOpenfoam;
import org.jeecg.modules.project.calculateConfig.bizOpenfoam.service.IBizOpenfoamService;
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
import org.jeecg.modules.project.calculateConfig.bizWrf.service.IBizWrfService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -50,29 +60,30 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
public class BizModeLinkController extends JeecgController<BizModeLink, IBizModeLinkService> {
@Autowired
private IBizModeLinkService bizModeLinkService;
/**
* 分页列表查询
*
* @param bizModeLink
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "模型链路选择-分页列表查询")
@ApiOperation(value="模型链路选择-分页列表查询", notes="模型链路选择-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<BizModeLink>> queryPageList(BizModeLink bizModeLink,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<BizModeLink> queryWrapper = QueryGenerator.initQueryWrapper(bizModeLink, req.getParameterMap());
Page<BizModeLink> page = new Page<BizModeLink>(pageNo, pageSize);
IPage<BizModeLink> pageList = bizModeLinkService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @param bizModeLink
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "模型链路选择-分页列表查询")
@ApiOperation(value="模型链路选择-分页列表查询", notes="模型链路选择-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<BizModeLink>> queryPageList(BizModeLink bizModeLink,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<BizModeLink> queryWrapper = QueryGenerator.initQueryWrapper(bizModeLink, req.getParameterMap());
queryWrapper.orderByAsc("scene_type");
Page<BizModeLink> page = new Page<BizModeLink>(pageNo, pageSize);
IPage<BizModeLink> pageList = bizModeLinkService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
@ -81,7 +92,6 @@ public class BizModeLinkController extends JeecgController<BizModeLink, IBizMode
*/
@AutoLog(value = "模型链路选择-添加")
@ApiOperation(value="模型链路选择-添加", notes="模型链路选择-添加")
@RequiresPermissions("bizModeLink:biz_mode_link:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizModeLink bizModeLink) {
bizModeLinkService.save(bizModeLink);
@ -96,7 +106,6 @@ public class BizModeLinkController extends JeecgController<BizModeLink, IBizMode
*/
@AutoLog(value = "模型链路选择-编辑")
@ApiOperation(value="模型链路选择-编辑", notes="模型链路选择-编辑")
@RequiresPermissions("bizModeLink:biz_mode_link:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizModeLink bizModeLink) {
bizModeLinkService.updateById(bizModeLink);
@ -111,7 +120,6 @@ public class BizModeLinkController extends JeecgController<BizModeLink, IBizMode
*/
@AutoLog(value = "模型链路选择-通过id删除")
@ApiOperation(value="模型链路选择-通过id删除", notes="模型链路选择-通过id删除")
@RequiresPermissions("bizModeLink:biz_mode_link:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizModeLinkService.removeById(id);
@ -126,7 +134,6 @@ public class BizModeLinkController extends JeecgController<BizModeLink, IBizMode
*/
@AutoLog(value = "模型链路选择-批量删除")
@ApiOperation(value="模型链路选择-批量删除", notes="模型链路选择-批量删除")
@RequiresPermissions("bizModeLink:biz_mode_link:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizModeLinkService.removeByIds(Arrays.asList(ids.split(",")));
@ -156,7 +163,6 @@ public class BizModeLinkController extends JeecgController<BizModeLink, IBizMode
* @param request
* @param bizModeLink
*/
@RequiresPermissions("bizModeLink:biz_mode_link:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, BizModeLink bizModeLink) {
return super.exportXls(request, bizModeLink, BizModeLink.class, "模型链路选择");
@ -169,7 +175,6 @@ public class BizModeLinkController extends JeecgController<BizModeLink, IBizMode
* @param response
* @return
*/
@RequiresPermissions("bizModeLink:biz_mode_link:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, BizModeLink.class);

View File

@ -52,12 +52,28 @@ public class BizModeLink implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private Date updateTime;
/**模式类型*/
@Excel(name = "模式类型", width = 15)
@ApiModelProperty(value = "模式类型")
private Integer modeType;
/**模式方案id*/
@Excel(name = "模式方案id", width = 15)
@ApiModelProperty(value = "模式方案id")
private String modeId;
/**场景类型*/
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "sceneType(1:核,2:设施,3:化学,4:泄露)")
private Integer sceneType;
/**源项模式id*/
@Excel(name = "源项模式id", width = 15)
@ApiModelProperty(value = "源项模式id")
private Integer sourceitemModeId;
/**气象模式id*/
@Excel(name = "气象模式id", width = 15)
@ApiModelProperty(value = "气象模式id")
private Integer weatherModeId;
/**扩散模式id*/
@Excel(name = "扩散模式id", width = 15)
@ApiModelProperty(value = "扩散模式id")
private Integer diffuseModeId;
/**后果评估模式id*/
@Excel(name = "后果评估模式id", width = 15)
@ApiModelProperty(value = "后果评估模式id")
private Integer dosageModeId;
/**辅助决策模式id*/
@Excel(name = "辅助决策模式id", width = 15)
@ApiModelProperty(value = "辅助决策模式id")
private Integer optimizeModeId;
}

View File

@ -66,7 +66,6 @@ public class BizNuclideController extends JeecgController<BizNuclide, IBizNuclid
*/
@AutoLog(value = "核素模块-添加")
@ApiOperation(value="核素模块-添加", notes="核素模块-添加")
@RequiresPermissions("bizNuclide:biz_nuclide:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizNuclide bizNuclide) {
bizNuclideService.save(bizNuclide);
@ -81,7 +80,6 @@ public class BizNuclideController extends JeecgController<BizNuclide, IBizNuclid
*/
@AutoLog(value = "核素模块-编辑")
@ApiOperation(value="核素模块-编辑", notes="核素模块-编辑")
@RequiresPermissions("bizNuclide:biz_nuclide:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizNuclide bizNuclide) {
bizNuclideService.updateById(bizNuclide);
@ -96,7 +94,6 @@ public class BizNuclideController extends JeecgController<BizNuclide, IBizNuclid
*/
@AutoLog(value = "核素模块-通过id删除")
@ApiOperation(value="核素模块-通过id删除", notes="核素模块-通过id删除")
@RequiresPermissions("bizNuclide:biz_nuclide:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizNuclideService.removeById(id);
@ -111,7 +108,6 @@ public class BizNuclideController extends JeecgController<BizNuclide, IBizNuclid
*/
@AutoLog(value = "核素模块-批量删除")
@ApiOperation(value="核素模块-批量删除", notes="核素模块-批量删除")
@RequiresPermissions("bizNuclide:biz_nuclide:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizNuclideService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -81,7 +81,6 @@ public class BizRoleController extends JeecgController<BizRole, IBizRoleService>
*/
@AutoLog(value = "Gis和角色权限管理表-添加")
@ApiOperation(value="Gis和角色权限管理表-添加", notes="Gis和角色权限管理表-添加")
@RequiresPermissions("bizRole:biz_role:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizRole bizRole) {
bizRoleService.save(bizRole);
@ -96,7 +95,6 @@ public class BizRoleController extends JeecgController<BizRole, IBizRoleService>
*/
@AutoLog(value = "Gis和角色权限管理表-编辑")
@ApiOperation(value="Gis和角色权限管理表-编辑", notes="Gis和角色权限管理表-编辑")
@RequiresPermissions("bizRole:biz_role:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizRole bizRole) {
bizRoleService.updateById(bizRole);
@ -127,7 +125,6 @@ public class BizRoleController extends JeecgController<BizRole, IBizRoleService>
*/
@AutoLog(value = "Gis和角色权限管理表-通过id删除")
@ApiOperation(value="Gis和角色权限管理表-通过id删除", notes="Gis和角色权限管理表-通过id删除")
@RequiresPermissions("bizRole:biz_role:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizRoleService.removeById(id);
@ -142,7 +139,6 @@ public class BizRoleController extends JeecgController<BizRole, IBizRoleService>
*/
@AutoLog(value = "Gis和角色权限管理表-批量删除")
@ApiOperation(value="Gis和角色权限管理表-批量删除", notes="Gis和角色权限管理表-批量删除")
@RequiresPermissions("bizRole:biz_role:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizRoleService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -81,7 +81,6 @@ public class BizSourceItemController extends JeecgController<BizSourceItem, IBiz
*/
@AutoLog(value = "源项参数-添加")
@ApiOperation(value="源项参数-添加", notes="源项参数-添加")
@RequiresPermissions("bizSourceItem:biz_source_item:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizSourceItem bizSourceItem) {
bizSourceItemService.save(bizSourceItem);
@ -96,7 +95,6 @@ public class BizSourceItemController extends JeecgController<BizSourceItem, IBiz
*/
@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);
@ -111,7 +109,6 @@ public class BizSourceItemController extends JeecgController<BizSourceItem, IBiz
*/
@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);
@ -126,7 +123,6 @@ public class BizSourceItemController extends JeecgController<BizSourceItem, IBiz
*/
@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(",")));

View File

@ -66,7 +66,6 @@ public class BizTopographyInfoController extends JeecgController<BizTopographyIn
*/
@AutoLog(value = "地形信息管理表-添加")
@ApiOperation(value="地形信息管理表-添加", notes="地形信息管理表-添加")
@RequiresPermissions("bizTopographyInfo:biz_topography_info:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizTopographyInfo bizTopographyInfo) {
bizTopographyInfoService.save(bizTopographyInfo);
@ -81,7 +80,6 @@ public class BizTopographyInfoController extends JeecgController<BizTopographyIn
*/
@AutoLog(value = "地形信息管理表-编辑")
@ApiOperation(value="地形信息管理表-编辑", notes="地形信息管理表-编辑")
@RequiresPermissions("bizTopographyInfo:biz_topography_info:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizTopographyInfo bizTopographyInfo) {
bizTopographyInfoService.updateById(bizTopographyInfo);
@ -96,7 +94,6 @@ public class BizTopographyInfoController extends JeecgController<BizTopographyIn
*/
@AutoLog(value = "地形信息管理表-通过id删除")
@ApiOperation(value="地形信息管理表-通过id删除", notes="地形信息管理表-通过id删除")
@RequiresPermissions("bizTopographyInfo:biz_topography_info:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizTopographyInfoService.removeById(id);
@ -111,7 +108,6 @@ public class BizTopographyInfoController extends JeecgController<BizTopographyIn
*/
@AutoLog(value = "地形信息管理表-批量删除")
@ApiOperation(value="地形信息管理表-批量删除", notes="地形信息管理表-批量删除")
@RequiresPermissions("bizTopographyInfo:biz_topography_info:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizTopographyInfoService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -66,7 +66,6 @@ public class BizWeaponController extends JeecgController<BizWeapon, IBizWeaponSe
*/
@AutoLog(value = "WQ类型数据管理表-添加")
@ApiOperation(value="WQ类型数据管理表-添加", notes="WQ类型数据管理表-添加")
@RequiresPermissions("bizWeapon:biz_weapon:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizWeapon bizWeapon) {
bizWeaponService.save(bizWeapon);
@ -81,7 +80,6 @@ public class BizWeaponController extends JeecgController<BizWeapon, IBizWeaponSe
*/
@AutoLog(value = "WQ类型数据管理表-编辑")
@ApiOperation(value="WQ类型数据管理表-编辑", notes="WQ类型数据管理表-编辑")
@RequiresPermissions("bizWeapon:biz_weapon:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizWeapon bizWeapon) {
bizWeaponService.updateById(bizWeapon);
@ -96,7 +94,6 @@ public class BizWeaponController extends JeecgController<BizWeapon, IBizWeaponSe
*/
@AutoLog(value = "WQ类型数据管理表-通过id删除")
@ApiOperation(value="WQ类型数据管理表-通过id删除", notes="WQ类型数据管理表-通过id删除")
@RequiresPermissions("bizWeapon:biz_weapon:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizWeaponService.removeById(id);
@ -111,7 +108,6 @@ public class BizWeaponController extends JeecgController<BizWeapon, IBizWeaponSe
*/
@AutoLog(value = "WQ类型数据管理表-批量删除")
@ApiOperation(value="WQ类型数据管理表-批量删除", notes="WQ类型数据管理表-批量删除")
@RequiresPermissions("bizWeapon:biz_weapon:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizWeaponService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -66,7 +66,6 @@ public class BizEquipmentMotorController extends JeecgController<BizEquipmentMot
*/
@AutoLog(value = "机动装备表-添加")
@ApiOperation(value="机动装备表-添加", notes="机动装备表-添加")
@RequiresPermissions("bizEquipmentMotor:biz_equipment_motor:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizEquipmentMotor bizEquipmentMotor) {
bizEquipmentMotorService.save(bizEquipmentMotor);
@ -81,7 +80,6 @@ public class BizEquipmentMotorController extends JeecgController<BizEquipmentMot
*/
@AutoLog(value = "机动装备表-编辑")
@ApiOperation(value="机动装备表-编辑", notes="机动装备表-编辑")
@RequiresPermissions("bizEquipmentMotor:biz_equipment_motor:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizEquipmentMotor bizEquipmentMotor) {
bizEquipmentMotorService.updateById(bizEquipmentMotor);
@ -96,7 +94,6 @@ public class BizEquipmentMotorController extends JeecgController<BizEquipmentMot
*/
@AutoLog(value = "机动装备表-通过id删除")
@ApiOperation(value="机动装备表-通过id删除", notes="机动装备表-通过id删除")
@RequiresPermissions("bizEquipmentMotor:biz_equipment_motor:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizEquipmentMotorService.removeById(id);
@ -111,7 +108,6 @@ public class BizEquipmentMotorController extends JeecgController<BizEquipmentMot
*/
@AutoLog(value = "机动装备表-批量删除")
@ApiOperation(value="机动装备表-批量删除", notes="机动装备表-批量删除")
@RequiresPermissions("bizEquipmentMotor:biz_equipment_motor:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizEquipmentMotorService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -66,7 +66,6 @@ public class BizEquipmentProtectionController extends JeecgController<BizEquipme
*/
@AutoLog(value = "防护装备表-添加")
@ApiOperation(value="防护装备表-添加", notes="防护装备表-添加")
@RequiresPermissions("bizEquipmentProtection:biz_equipment_protection:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizEquipmentProtection bizEquipmentProtection) {
bizEquipmentProtectionService.save(bizEquipmentProtection);
@ -81,7 +80,6 @@ public class BizEquipmentProtectionController extends JeecgController<BizEquipme
*/
@AutoLog(value = "防护装备表-编辑")
@ApiOperation(value="防护装备表-编辑", notes="防护装备表-编辑")
@RequiresPermissions("bizEquipmentProtection:biz_equipment_protection:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizEquipmentProtection bizEquipmentProtection) {
bizEquipmentProtectionService.updateById(bizEquipmentProtection);
@ -96,7 +94,6 @@ public class BizEquipmentProtectionController extends JeecgController<BizEquipme
*/
@AutoLog(value = "防护装备表-通过id删除")
@ApiOperation(value="防护装备表-通过id删除", notes="防护装备表-通过id删除")
@RequiresPermissions("bizEquipmentProtection:biz_equipment_protection:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizEquipmentProtectionService.removeById(id);
@ -111,7 +108,6 @@ public class BizEquipmentProtectionController extends JeecgController<BizEquipme
*/
@AutoLog(value = "防护装备表-批量删除")
@ApiOperation(value="防护装备表-批量删除", notes="防护装备表-批量删除")
@RequiresPermissions("bizEquipmentProtection:biz_equipment_protection:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizEquipmentProtectionService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -66,7 +66,6 @@ public class BizWeatherForecastController extends JeecgController<BizWeatherFore
*/
@AutoLog(value = "气象预报表-添加")
@ApiOperation(value="气象预报表-添加", notes="气象预报表-添加")
@RequiresPermissions("bizWeatherForecast:biz_weather_forecast:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizWeatherForecast bizWeatherForecast) {
bizWeatherForecastService.save(bizWeatherForecast);
@ -81,7 +80,6 @@ public class BizWeatherForecastController extends JeecgController<BizWeatherFore
*/
@AutoLog(value = "气象预报表-编辑")
@ApiOperation(value="气象预报表-编辑", notes="气象预报表-编辑")
@RequiresPermissions("bizWeatherForecast:biz_weather_forecast:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizWeatherForecast bizWeatherForecast) {
bizWeatherForecastService.updateById(bizWeatherForecast);
@ -96,7 +94,6 @@ public class BizWeatherForecastController extends JeecgController<BizWeatherFore
*/
@AutoLog(value = "气象预报表-通过id删除")
@ApiOperation(value="气象预报表-通过id删除", notes="气象预报表-通过id删除")
@RequiresPermissions("bizWeatherForecast:biz_weather_forecast:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizWeatherForecastService.removeById(id);
@ -111,7 +108,6 @@ public class BizWeatherForecastController extends JeecgController<BizWeatherFore
*/
@AutoLog(value = "气象预报表-批量删除")
@ApiOperation(value="气象预报表-批量删除", notes="气象预报表-批量删除")
@RequiresPermissions("bizWeatherForecast:biz_weather_forecast:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizWeatherForecastService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -66,7 +66,6 @@ public class BizWeatherHistoryController extends JeecgController<BizWeatherHisto
*/
@AutoLog(value = "历史气象表-添加")
@ApiOperation(value="历史气象表-添加", notes="历史气象表-添加")
@RequiresPermissions("bizWeatherHistory:biz_weather_history:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizWeatherHistory bizWeatherHistory) {
bizWeatherHistoryService.save(bizWeatherHistory);
@ -81,7 +80,6 @@ public class BizWeatherHistoryController extends JeecgController<BizWeatherHisto
*/
@AutoLog(value = "历史气象表-编辑")
@ApiOperation(value="历史气象表-编辑", notes="历史气象表-编辑")
@RequiresPermissions("bizWeatherHistory:biz_weather_history:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizWeatherHistory bizWeatherHistory) {
bizWeatherHistoryService.updateById(bizWeatherHistory);
@ -96,7 +94,6 @@ public class BizWeatherHistoryController extends JeecgController<BizWeatherHisto
*/
@AutoLog(value = "历史气象表-通过id删除")
@ApiOperation(value="历史气象表-通过id删除", notes="历史气象表-通过id删除")
@RequiresPermissions("bizWeatherHistory:biz_weather_history:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizWeatherHistoryService.removeById(id);
@ -111,7 +108,6 @@ public class BizWeatherHistoryController extends JeecgController<BizWeatherHisto
*/
@AutoLog(value = "历史气象表-批量删除")
@ApiOperation(value="历史气象表-批量删除", notes="历史气象表-批量删除")
@RequiresPermissions("bizWeatherHistory:biz_weather_history:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizWeatherHistoryService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -0,0 +1,172 @@
package org.jeecg.modules.project.calculateConfig.bizCalpuff.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.calculateConfig.bizCalpuff.entity.BizCalpuff;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.service.IBizCalpuffService;
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: calpuff
* @Author: jeecg-boot
* @Date: 2023-10-12
* @Version: V1.0
*/
@Api(tags="calpuff")
@RestController
@RequestMapping("/bizCalpuff/bizCalpuff")
@Slf4j
public class BizCalpuffController extends JeecgController<BizCalpuff, IBizCalpuffService> {
@Autowired
private IBizCalpuffService bizCalpuffService;
/**
* 分页列表查询
*
* @param bizCalpuff
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "calpuff-分页列表查询")
@ApiOperation(value="calpuff-分页列表查询", notes="calpuff-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<BizCalpuff>> queryPageList(BizCalpuff bizCalpuff,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<BizCalpuff> queryWrapper = QueryGenerator.initQueryWrapper(bizCalpuff, req.getParameterMap());
Page<BizCalpuff> page = new Page<BizCalpuff>(pageNo, pageSize);
IPage<BizCalpuff> pageList = bizCalpuffService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param bizCalpuff
* @return
*/
@AutoLog(value = "calpuff-添加")
@ApiOperation(value="calpuff-添加", notes="calpuff-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizCalpuff bizCalpuff) {
bizCalpuffService.save(bizCalpuff);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param bizCalpuff
* @return
*/
@AutoLog(value = "calpuff-编辑")
@ApiOperation(value="calpuff-编辑", notes="calpuff-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizCalpuff bizCalpuff) {
bizCalpuffService.updateById(bizCalpuff);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "calpuff-通过id删除")
@ApiOperation(value="calpuff-通过id删除", notes="calpuff-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizCalpuffService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "calpuff-批量删除")
@ApiOperation(value="calpuff-批量删除", notes="calpuff-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizCalpuffService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "calpuff-通过id查询")
@ApiOperation(value="calpuff-通过id查询", notes="calpuff-通过id查询")
@GetMapping(value = "/queryById")
public Result<BizCalpuff> queryById(@RequestParam(name="id",required=true) String id) {
BizCalpuff bizCalpuff = bizCalpuffService.getById(id);
if(bizCalpuff==null) {
return Result.error("未找到对应数据");
}
return Result.OK(bizCalpuff);
}
/**
* 导出excel
*
* @param request
* @param bizCalpuff
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, BizCalpuff bizCalpuff) {
return super.exportXls(request, bizCalpuff, BizCalpuff.class, "calpuff");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, BizCalpuff.class);
}
}

View File

@ -0,0 +1,77 @@
package org.jeecg.modules.project.calculateConfig.bizCalpuff.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: calpuff
* @Author: jeecg-boot
* @Date: 2023-10-12
* @Version: V1.0
*/
@Data
@TableName("biz_calpuff")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="biz_calpuff对象", description="calpuff")
public class BizCalpuff 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;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
@Excel(name = "工程ID", width = 15)
@ApiModelProperty(value = "工程ID")
private String engineeringId;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String name;
/**模板类型*/
@Excel(name = "模板类型", width = 15)
@ApiModelProperty(value = "模板类型")
private Integer temType;
/**场景类型*/
@Excel(name = "场景类型", width = 15)
@ApiModelProperty(value = "场景类型")
private Integer sceneType;
/**模式类型*/
@Excel(name = "模式类型", width = 15)
@ApiModelProperty(value = "模式类型")
private Integer modeType;
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.project.calculateConfig.bizCalpuff.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.entity.BizCalpuff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: calpuff
* @Author: jeecg-boot
* @Date: 2023-10-12
* @Version: V1.0
*/
@Mapper
public interface BizCalpuffMapper extends BaseMapper<BizCalpuff> {
}

View File

@ -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.calculateConfig.bizCalpuff.mapper.BizCalpuffMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package org.jeecg.modules.project.calculateConfig.bizCalpuff.service;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.entity.BizCalpuff;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: calpuff
* @Author: jeecg-boot
* @Date: 2023-10-12
* @Version: V1.0
*/
public interface IBizCalpuffService extends IService<BizCalpuff> {
}

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.project.calculateConfig.bizCalpuff.service.impl;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.entity.BizCalpuff;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.mapper.BizCalpuffMapper;
import org.jeecg.modules.project.calculateConfig.bizCalpuff.service.IBizCalpuffService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: calpuff
* @Author: jeecg-boot
* @Date: 2023-10-12
* @Version: V1.0
*/
@Service
public class BizCalpuffServiceImpl extends ServiceImpl<BizCalpuffMapper, BizCalpuff> implements IBizCalpuffService {
}

View File

@ -22,6 +22,7 @@ import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
import org.jeecg.modules.project.calculateConfig.bizWrf.service.IBizWrfService;
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.servlet.ModelAndView;
import io.swagger.annotations.Api;
@ -44,31 +45,8 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
@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="10000") 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);
}
@Value("${spring.baseHome}")
private String baseHome;
/**
* get
@ -84,26 +62,6 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
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(Integer.valueOf(wrf.getWe()) -3 + "");
bizCmaq.setRowsN(Integer.valueOf(wrf.getSn()) -3 + "");
bizCmaq.setWrfLcRefLat(wrf.getRefLat());
bizCmaqService.saveOrUpdate(bizCmaq);
return Result.OK("添加成功!");
}
/**
* 编辑
*
@ -112,43 +70,13 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
*/
@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) {
bizCmaq.setFilePath(baseHome + "用户名/工程名/");
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查询
*
@ -188,45 +116,6 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
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);
}
/**
* 通过temType查询模板
*
* @return
*/
@ApiOperation(value="cmaq-通过temType查询模板", notes="cmaq-通过temType查询模板")
@GetMapping(value = "/getCmaqTem")
public Result<BizCmaq> getCmaqTem(Integer temType) {
BizCmaq bizCmaq = bizCmaqService.getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getTemType,temType));
if(bizCmaq==null) {
return Result.error("未找到对应数据");
}
return Result.OK(bizCmaq);
}
/**
* 通过类型查询模板
*
@ -235,7 +124,7 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
//@AutoLog(value = "cmaq-通过类型查询模板")
@ApiOperation(value="cmaq-通过类型查询模板", notes="cmaq-通过类型查询模板")
@GetMapping(value = "/getCmaqTem")
public Result<BizCmaq> getWrfTem(Integer temType,Integer sceneType,Integer modeType,String modeSchemeName) {
public Result<BizCmaq> getCmaqTem(Integer temType,Integer sceneType,Integer modeType,String modeSchemeName) {
LambdaQueryWrapper<BizCmaq> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BizCmaq::getTemType,temType);
lambdaQueryWrapper.eq(BizCmaq::getSceneType,sceneType);
@ -251,27 +140,4 @@ public class BizCmaqController extends JeecgController<BizCmaq, IBizCmaqService>
return Result.OK(bizCmaqs.get(0));
}
/**
* 导出excel
*
* @param request
* @param bizCmaq
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, BizCmaq bizCmaq) {
return super.exportXls(request, bizCmaq, BizCmaq.class, "CMAQ");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, BizCmaq.class);
}
}

View File

@ -50,168 +50,127 @@ public class BizCmaq implements Serializable {
@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;
@Excel(name = "temType", width = 15)
@ApiModelProperty(value = "temType(0:模板,1:非模板)")
private int temType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "sceneType(1:核,2:设施,3:化学,4:泄露)")
private int sceneType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "modeType(1:源项模拟,2:气象参数,3:扩散模拟,4:后果评估,5:辅助决策)")
private int modeType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "modeSchemeName(预留字段)")
private String modeSchemeName;
@ApiModelProperty(value = "文件路径")
private String filePath;
}

View File

@ -1,9 +1,11 @@
package org.jeecg.modules.project.calculateConfig.bizCmaq.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.project.calculateConfig.bizCmaq.entity.BizCmaq;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: CMAQ
@ -15,13 +17,7 @@ public interface IBizCmaqService extends IService<BizCmaq> {
List<List<Double[]>> getNCFileInfo(String engineeringId,int layer);
boolean runMcipShell(String engineeringId);
boolean runIconShell(String engineeringId);
boolean runBconShell(String engineeringId);
boolean runCctmShell(String engineeringId);
Result<String> runAllCmaqExe(Map<String,String> map);
List<String> getVariableNames(String engineeringId);
}

View File

@ -5,6 +5,7 @@ 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.api.vo.Result;
import org.jeecg.common.util.RemoteExecuteCommand;
import org.jeecg.modules.project.calculateConfig.bizCmaq.entity.BizCmaq;
import org.jeecg.modules.project.calculateConfig.bizCmaq.mapper.BizCmaqMapper;
@ -33,10 +34,7 @@ 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 java.util.*;
import static java.nio.file.Files.readAllBytes;
import static java.nio.file.Paths.get;
@ -75,6 +73,32 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
@Value("${spring.Linux.port}")
private Integer port;
@Override
public Result<String> runAllCmaqExe(Map<String,String> map){
String engineeringId = map.get("engineeringId");
BizCmaq bizCmaq = this.baseMapper.selectOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId, engineeringId));
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,bizCmaq.getEngineeringId()));
bizCmaq.setColsN(Integer.valueOf(wrf.getWe()) -3 + "");
bizCmaq.setRowsN(Integer.valueOf(wrf.getSn()) -3 + "");
bizCmaq.setWrfLcRefLat(wrf.getRefLat());
this.baseMapper.updateById(bizCmaq);
if(!runMcipShell(engineeringId)){
return Result.error("MCIP ERROR!");
}
if(!runIconShell(engineeringId)){
return Result.error("ICON ERROR!");
}
if(!runBconShell(engineeringId)){
return Result.error("BCON ERROR!");
}
if(!runCctmShell(engineeringId)){
return Result.error("CCTM ERROR!");
}
return Result.OK("运行成功!");
}
private String genMcipsShell(String allRunPath, String targetFilePath, 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")));
@ -133,7 +157,6 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
return fileName;
}
@Override
public boolean runMcipShell(String engineeringId) {
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
BizCmaq cmaq = getOne(new LambdaQueryWrapper<BizCmaq>().eq(BizCmaq::getEngineeringId,engineeringId));
@ -155,7 +178,6 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
return true;
}
@Override
public boolean runIconShell(String engineeringId) {
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
@ -175,7 +197,6 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
return true;
}
@Override
public boolean runBconShell(String engineeringId) {
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));
@ -207,7 +228,6 @@ public class BizCmaqServiceImpl extends ServiceImpl<BizCmaqMapper, BizCmaq> impl
return true;
}
@Override
public boolean runCctmShell(String engineeringId) {
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineeringId));

View File

@ -81,7 +81,6 @@ public class BizConfigChemistryController extends JeecgController<BizConfigChemi
*/
@AutoLog(value = "化爆配置表-添加")
@ApiOperation(value="化爆配置表-添加", notes="化爆配置表-添加")
@RequiresPermissions("bizConfigChemistry:biz_config_chemistry:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizConfigChemistry bizConfigChemistry) {
bizConfigChemistryService.save(bizConfigChemistry);
@ -96,7 +95,6 @@ public class BizConfigChemistryController extends JeecgController<BizConfigChemi
*/
@AutoLog(value = "化爆配置表-编辑")
@ApiOperation(value="化爆配置表-编辑", notes="化爆配置表-编辑")
@RequiresPermissions("bizConfigChemistry:biz_config_chemistry:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizConfigChemistry bizConfigChemistry) {
bizConfigChemistryService.updateById(bizConfigChemistry);
@ -111,7 +109,6 @@ public class BizConfigChemistryController extends JeecgController<BizConfigChemi
*/
@AutoLog(value = "化爆配置表-通过id删除")
@ApiOperation(value="化爆配置表-通过id删除", notes="化爆配置表-通过id删除")
@RequiresPermissions("bizConfigChemistry:biz_config_chemistry:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizConfigChemistryService.removeById(id);
@ -126,7 +123,6 @@ public class BizConfigChemistryController extends JeecgController<BizConfigChemi
*/
@AutoLog(value = "化爆配置表-批量删除")
@ApiOperation(value="化爆配置表-批量删除", notes="化爆配置表-批量删除")
@RequiresPermissions("bizConfigChemistry:biz_config_chemistry:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizConfigChemistryService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -81,7 +81,6 @@ public class BizConfigFacilityController extends JeecgController<BizConfigFacili
*/
@AutoLog(value = "核设施配置表-添加")
@ApiOperation(value="核设施配置表-添加", notes="核设施配置表-添加")
@RequiresPermissions("bizConfigFacility:biz_config_facility:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizConfigFacility bizConfigFacility) {
bizConfigFacilityService.save(bizConfigFacility);
@ -96,7 +95,6 @@ public class BizConfigFacilityController extends JeecgController<BizConfigFacili
*/
@AutoLog(value = "核设施配置表-编辑")
@ApiOperation(value="核设施配置表-编辑", notes="核设施配置表-编辑")
@RequiresPermissions("bizConfigFacility:biz_config_facility:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizConfigFacility bizConfigFacility) {
bizConfigFacilityService.updateById(bizConfigFacility);
@ -111,7 +109,6 @@ public class BizConfigFacilityController extends JeecgController<BizConfigFacili
*/
@AutoLog(value = "核设施配置表-通过id删除")
@ApiOperation(value="核设施配置表-通过id删除", notes="核设施配置表-通过id删除")
@RequiresPermissions("bizConfigFacility:biz_config_facility:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizConfigFacilityService.removeById(id);
@ -126,7 +123,6 @@ public class BizConfigFacilityController extends JeecgController<BizConfigFacili
*/
@AutoLog(value = "核设施配置表-批量删除")
@ApiOperation(value="核设施配置表-批量删除", notes="核设施配置表-批量删除")
@RequiresPermissions("bizConfigFacility:biz_config_facility:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizConfigFacilityService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -81,7 +81,6 @@ public class BizConfigLeakController extends JeecgController<BizConfigLeak, IBiz
*/
@AutoLog(value = "泄露配置表-添加")
@ApiOperation(value="泄露配置表-添加", notes="泄露配置表-添加")
@RequiresPermissions("bizConfigLeak:biz_config_leak:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizConfigLeak bizConfigLeak) {
bizConfigLeakService.save(bizConfigLeak);
@ -96,7 +95,6 @@ public class BizConfigLeakController extends JeecgController<BizConfigLeak, IBiz
*/
@AutoLog(value = "泄露配置表-编辑")
@ApiOperation(value="泄露配置表-编辑", notes="泄露配置表-编辑")
@RequiresPermissions("bizConfigLeak:biz_config_leak:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizConfigLeak bizConfigLeak) {
bizConfigLeakService.updateById(bizConfigLeak);
@ -111,7 +109,6 @@ public class BizConfigLeakController extends JeecgController<BizConfigLeak, IBiz
*/
@AutoLog(value = "泄露配置表-通过id删除")
@ApiOperation(value="泄露配置表-通过id删除", notes="泄露配置表-通过id删除")
@RequiresPermissions("bizConfigLeak:biz_config_leak:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizConfigLeakService.removeById(id);
@ -126,7 +123,6 @@ public class BizConfigLeakController extends JeecgController<BizConfigLeak, IBiz
*/
@AutoLog(value = "泄露配置表-批量删除")
@ApiOperation(value="泄露配置表-批量删除", notes="泄露配置表-批量删除")
@RequiresPermissions("bizConfigLeak:biz_config_leak:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizConfigLeakService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -81,7 +81,6 @@ public class BizConfigNucleusController extends JeecgController<BizConfigNucleus
*/
@AutoLog(value = "核爆配置表-添加")
@ApiOperation(value="核爆配置表-添加", notes="核爆配置表-添加")
@RequiresPermissions("bizConfigNucleus:biz_config_nucleus:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizConfigNucleus bizConfigNucleus) {
bizConfigNucleusService.save(bizConfigNucleus);
@ -96,7 +95,6 @@ public class BizConfigNucleusController extends JeecgController<BizConfigNucleus
*/
@AutoLog(value = "核爆配置表-编辑")
@ApiOperation(value="核爆配置表-编辑", notes="核爆配置表-编辑")
@RequiresPermissions("bizConfigNucleus:biz_config_nucleus:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizConfigNucleus bizConfigNucleus) {
bizConfigNucleusService.updateById(bizConfigNucleus);
@ -111,7 +109,6 @@ public class BizConfigNucleusController extends JeecgController<BizConfigNucleus
*/
@AutoLog(value = "核爆配置表-通过id删除")
@ApiOperation(value="核爆配置表-通过id删除", notes="核爆配置表-通过id删除")
@RequiresPermissions("bizConfigNucleus:biz_config_nucleus:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizConfigNucleusService.removeById(id);
@ -126,7 +123,6 @@ public class BizConfigNucleusController extends JeecgController<BizConfigNucleus
*/
@AutoLog(value = "核爆配置表-批量删除")
@ApiOperation(value="核爆配置表-批量删除", notes="核爆配置表-批量删除")
@RequiresPermissions("bizConfigNucleus:biz_config_nucleus:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizConfigNucleusService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -96,21 +96,6 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
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);
}
/**
* 编辑
*
@ -119,7 +104,6 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
*/
@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);
@ -150,8 +134,8 @@ public class BizOpenfoamController extends JeecgController<BizOpenfoam, IBizOpen
*/
//@AutoLog(value = "cmaq-通过类型查询模板")
@ApiOperation(value="cmaq-通过类型查询模板", notes="cmaq-通过类型查询模板")
@GetMapping(value = "/getCmaqTem")
public Result<BizOpenfoam> getWrfTem(Integer temType, Integer sceneType, Integer modeType, String modeSchemeName) {
@GetMapping(value = "/getOpemFOAMTem")
public Result<BizOpenfoam> getOpemFOAMTem(Integer temType, Integer sceneType, Integer modeType, String modeSchemeName) {
LambdaQueryWrapper<BizOpenfoam> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BizOpenfoam::getTemType,temType);
lambdaQueryWrapper.eq(BizOpenfoam::getSceneType,sceneType);

View File

@ -50,61 +50,48 @@ public class BizOpenfoam implements Serializable {
@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;
@Excel(name = "temType", width = 15)
@ApiModelProperty(value = "temType(0:模板,1:非模板)")
private int temType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "sceneType(1:核,2:设施,3:化学,4:泄露)")
private int sceneType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "modeType(1:源项模拟,2:气象参数,3:扩散模拟,4:后果评估,5:辅助决策)")
private int modeType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "modeSchemeName(预留字段)")
private String modeSchemeName;
@ApiModelProperty(value = "文件路径")
private String filePath;
}

View File

@ -62,211 +62,12 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
private IBizOpenfoamService bizOpenfoamService;
@Autowired
private IBizEngineeringService bizEngineeringService;
@Resource
private WebSocket webSocket;
@Value("${spring.localFilePrefix}")
private String localFilePrefix;
@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;
// 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="10000") 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.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))));
bizWrf.setTemType(0);
bizWrfService.saveOrUpdate(bizWrf);
return Result.OK("添加成功!");
}
/**
* 获取程序运行路径
*
* @return
*/
@GetMapping(value = "/getAllRunPath")
public String getAllRunPath(String engineeringId) {
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
String allRunPath = baseHome + engineering.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
return allRunPath;
}
/**
* 运行WPS
*
* @return
*/
@GetMapping(value = "/runWps")
public Result<String> runWps(String engineeringId) throws IOException {
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 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",localFilePath + "metgrid.log");
sftpUtil.logout();
String metgridLog = new String(readAllBytes(get(localFilePath + "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 engineeringId) throws IOException {
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 cdWRF = "cd " + allRunPath + "WRF/run;";
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);
// sftpUtil.download(allRunPath + "WRF/run","wrf.log",localFilePath + "wrf.log");
// String wrfLog = new String(readAllBytes(get(localFilePath + "wrf.log")));
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);
DateTime endTime = DateUtil.parse(bizWrf.getEndTime(), format);
long oneDaySecs = 60 * 60 * 24 * 1000;
//工程总运行小时数WRF的时间
Integer sumHour = Integer.valueOf((endTime.getTime() - startTime.getTime()) / oneDaySecs * 24 + "");
Integer sumDay = sumHour / 24 + 1;
for (Integer i = 1; i <= sumDay; i++) {
String newStartTime = DateUtil.format(new Date(startTime.getTime() + oneDaySecs * i - oneDaySecs), format);
String ncNameWrf = "wrfout_d01_" + newStartTime;
sftpUtil.download(allRunPath + "WRF/run/",ncNameWrf,localFilePath + 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,localFilePrefix + ncNameWrf);
// sftpUtil.logout();
// return Result.OK("SUCCESS COMPLETE WRF");
return Result.error(wrfLog);
}
/**
* 运行
*
* @return
*/
@GetMapping(value = "/getRunWrfLog")
public Result<String> getRunWrfLog(String engineeringId) {
try {
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() + "/";
SFTPUtil sftpUtil = new SFTPUtil();
sftpUtil.login(username, password,ip,port);
sftpUtil.download(allRunPath + "WRF/run/","rsl.out.0000",localFilePath + "rsl.out.0000");
// sftpUtil.download(allRunPath + "WRF/run","wrf.log",localFilePath + "wrf.log");
sftpUtil.logout();
// String wrfLog = new String(readAllBytes(get(localFilePath + "wrf.log")));
String wrfLog = new String(readAllBytes(get(localFilePath + "rsl.out.0000")));
// 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
@ -457,43 +258,13 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
*/
@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) {
bizWrf.setFilePath(baseHome + "用户名/工程名/");
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查询
*
@ -519,14 +290,10 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
//@AutoLog(value = "wrf-通过类型查询模板")
@ApiOperation(value="wrf-通过类型查询模板", notes="wrf-通过类型查询模板")
@GetMapping(value = "/getWrfTem")
public Result<BizWrf> getWrfTem(Integer temType,Integer sceneType,Integer modeType,String modeSchemeName) {
public Result<BizWrf> getWrfTem(Integer sceneType) {
LambdaQueryWrapper<BizWrf> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BizWrf::getTemType,temType);
lambdaQueryWrapper.eq(BizWrf::getTemType,0);
lambdaQueryWrapper.eq(BizWrf::getSceneType,sceneType);
lambdaQueryWrapper.eq(BizWrf::getModeType,modeType);
if(StringUtil.isNotEmpty(modeSchemeName)){
lambdaQueryWrapper.eq(BizWrf::getModeSchemeName,modeSchemeName);
}
List<BizWrf> bizWrfs = bizWrfService.list(lambdaQueryWrapper);
if(bizWrfs == null || bizWrfs.isEmpty()) {
@ -552,29 +319,6 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
return Result.OK(bizWrf);
}
/**
* 导出excel
*
* @param request
* @param bizWrf
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, BizWrf bizWrf) {
return super.exportXls(request, bizWrf, BizWrf.class, "wrf");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, BizWrf.class);
}
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));
@ -584,7 +328,14 @@ public class BizWrfController extends JeecgController<BizWrf, IBizWrfService> {
// String wmhr = RemoteExecuteCommand.runRemoteLinuxCmd("192.168.115.128", "wmhr", "123456", "cd /home/wmhr/OpenFOAM-8/run/admin/工程001/;ls");
// System.out.println(wmhr);
String wmhr = RemoteExecuteCommand.runRemoteLinuxCmd("192.168.115.128", "wmhr", "123456", "ps -ef | grep wrf.exe");
System.out.println(wmhr);
String executeResult = RemoteExecuteCommand.runRemoteLinuxCmd("192.168.115.128", "wmhr", "123456", "ps -ef | grep wrf.exe");
String[] resultArray = executeResult.split("\\n");
for (String result : resultArray) {
if(result.indexOf("./wrf.exe") >= 0){
String[] values = result.trim().split(" ");
// RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password,"kill -9 " + values[1].trim());
break;
}
}
}
}

View File

@ -50,166 +50,124 @@ public class BizWrf implements Serializable {
@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;
/***/
@ApiModelProperty(value = "analog_Time")
private String analogTime;
/**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;
@Excel(name = "temType", width = 15)
@ApiModelProperty(value = "temType(0:模板,1:非模板)")
private int temType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "sceneType(1:核,2:设施,3:化学,4:泄露)")
private int sceneType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "modeType(1:源项模拟,2:气象参数,3:扩散模拟,4:后果评估,5:辅助决策)")
private int modeType;
@Excel(name = "sceneType", width = 15)
@ApiModelProperty(value = "modeSchemeName(预留字段)")
private String modeSchemeName;
@ApiModelProperty(value = "文件路径")
private String filePath;
/*
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;

View File

@ -5,6 +5,7 @@ import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.IOException;
import java.util.Map;
/**
* @Description: wrf
@ -14,10 +15,6 @@ import java.io.IOException;
*/
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;
Result<String> runAllWrfExe(Map<String,String> map) throws IOException;
}

View File

@ -1,11 +1,18 @@
package org.jeecg.modules.project.calculateConfig.bizWrf.service.impl;
import cn.hutool.core.bean.BeanUtil;
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 org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RemoteExecuteCommand;
import org.jeecg.modules.constants.GriddConstants;
import org.jeecg.modules.project.baseAPI.sftpAPI.IBizSftpAPIService;
import org.jeecg.modules.project.baseConfig.bizEngineering.entity.BizEngineering;
import org.jeecg.modules.project.baseConfig.bizEngineering.service.IBizEngineeringService;
import org.jeecg.modules.project.calculateConfig.bizConfigNucleus.entity.BizConfigNucleus;
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;
@ -16,8 +23,13 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import static java.nio.file.Files.readAllBytes;
import static java.nio.file.Paths.get;
@ -31,12 +43,19 @@ import static java.nio.file.Paths.get;
@Service
public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> implements IBizWrfService {
@Autowired
private IBizSftpAPIService bizSftpAPIService;
@Value("${spring.baseHome}")
private String baseHome;
@Value("${spring.localFilePrefix}")
private String localFilePrefix;
@Value("${spring.WRF.fnldataPath}")
private String fnldataPath;
@Value("${spring.cshTemFielPath}")
private String cshTemFielPath;
@Value("${spring.WRF.geog_data_path}")
private String geog_data_path;
@Value("${spring.Linux.ip}")
private String ip;
@ -51,6 +70,201 @@ public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> impleme
private IBizEngineeringService bizEngineeringService;
@Override
public Result<String> runAllWrfExe(Map<String,String> map) throws IOException {
String engineeringId = map.get("engineeringId");
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
BizWrf bizWrf = this.baseMapper.selectOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineering));
BizConfigNucleus bizConfigNucleus = new BizConfigNucleus();
BeanUtil.copyProperties(map, bizConfigNucleus);
String format = "yyyy-MM-dd_hh:mm:ss";
Calendar calendar = Calendar.getInstance();
calendar.setTime(bizConfigNucleus.getEventTime());
calendar.add(Calendar.HOUR_OF_DAY, Integer.valueOf(bizWrf.getAnalogTime()));
bizWrf.setStartTime(DateUtil.format(bizConfigNucleus.getEventTime(),format));
bizWrf.setEndTime(DateUtil.format(calendar.getTime(),format));
bizWrf.setLat1(Double.valueOf(bizWrf.getRefLat()) - GriddConstants.NY_GRIDD_RADII + "");
bizWrf.setLon1(Double.valueOf(bizWrf.getRefLon()) - GriddConstants.NY_GRIDD_RADII + "");
bizWrf.setLat2(Double.valueOf(bizWrf.getRefLat()) + GriddConstants.NY_GRIDD_RADII + "");
bizWrf.setLon2(Double.valueOf(bizWrf.getRefLon()) + GriddConstants.NY_GRIDD_RADII + "");
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))));
this.baseMapper.updateById(bizWrf);
String newAllRunPath = String.format("%s%s/%s/", baseHome, bizWrf.getCreateBy(),engineering.getEngineeringName());
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, String.format("rm -rf %s",newAllRunPath));
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, String.format("mkdir %s",baseHome + bizWrf.getCreateBy()));
String runCmd = String.format("cp -r %sAll_Run %s", baseHome, newAllRunPath);
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
saveWpsFile(bizWrf,engineering.getEngineeringName());
saveInputFile(bizWrf,engineering.getEngineeringName());
String allRunPath = baseHome + engineering.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
Result<String> runGeogridResult = runGeogrid(allRunPath, engineeringId);
if(!runGeogridResult.isSuccess()){
return runGeogridResult;
}
Result<String> runUngribResult = runUngrib(allRunPath,engineeringId);
if(!runUngribResult.isSuccess()){
return runUngribResult;
}
Result<String> runMetgridResult = runMetgrid(allRunPath,engineeringId);
if(!runMetgridResult.isSuccess()){
return runMetgridResult;
}
Result<String> runRealResult = runReal(allRunPath,engineeringId);
if(!runRealResult.isSuccess()){
return runRealResult;
}
Result<String> runWrfResult = runWrf(allRunPath,engineeringId);
if(!runWrfResult.isSuccess()){
return runWrfResult;
}
return Result.OK("运行成功!");
}
public void saveWpsFile(BizWrf bizWrf,String engineeringName){
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineeringName + "/";
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineeringName + "/";
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.getStartTime());
endStr = String.format("'%s',",bizWrf.getEndTime());
}
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, localFilePath + fileName, "UTF-8");
bizSftpAPIService.sftpUpload(localFilePath + fileName, allRunPath + "WPS", fileName);
} catch (Exception e) {
e.printStackTrace();
}
}
public void saveInputFile(BizWrf bizWrf,String engineeringName){
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineeringName + "/";
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineeringName + "/";
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, localFilePath + fileName, "UTF-8");
bizSftpAPIService.sftpUpload(localFilePath + fileName, allRunPath + "WRF/run", fileName);
} catch (ParseException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public Result<String> runGeogrid(String allRunPath, String engineeringId) throws IOException {
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
String cdWPS = "cd " + allRunPath + "WPS;";
@ -66,11 +280,10 @@ public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> impleme
return Result.OK("geogrid执行成功");
}else{
bizEngineeringService.updateErrorStatus(engineeringId,1);
return Result.OK(geogridLog);
return Result.error(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);
@ -100,11 +313,10 @@ public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> impleme
return Result.OK("ungrib执行成功");
}else{
bizEngineeringService.updateErrorStatus(engineeringId,2);
return Result.OK(ungribLog);
return Result.error(ungribLog);
}
}
@Override
public Result<String> runMetgrid(String allRunPath,String engineeringId) throws IOException {
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
String cdWPS = "cd " + allRunPath + "WPS;";
@ -120,11 +332,10 @@ public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> impleme
return Result.OK("metgrid执行成功");
}else{
bizEngineeringService.updateErrorStatus(engineeringId,3);
return Result.OK(metgridLog);
return Result.error(metgridLog);
}
}
@Override
public Result<String> runReal(String allRunPath,String engineeringId) throws IOException {
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
String cdWRF = "cd " + allRunPath + "WRF/run;";
@ -140,11 +351,10 @@ public class BizWrfServiceImpl extends ServiceImpl<BizWrfMapper, BizWrf> impleme
return Result.OK("real执行成功");
}else{
bizEngineeringService.updateErrorStatus(engineeringId,4);
return Result.OK(realLog);
return Result.error(realLog);
}
}
@Override
public Result<String> runWrf(String allRunPath,String engineeringId) throws IOException {
String localFilePath = allRunPath.replace(baseHome, localFilePrefix);
String cdWRF = "cd " + allRunPath + "WRF/run;";

View File

@ -0,0 +1,19 @@
package org.jeecg.modules.project.calculateConfig.calculateAPI.service;
import java.util.Map;
/**
* @Description: 通用API
* @Author: jeecg-boot
* @Date: 2023-09-20
* @Version: V1.0
*/
public interface IBizCalculateAPIService {
/**
* 保存计算配置
* @param map
*/
void saveCalculateConfig(Map<String,String> map);
}

View File

@ -0,0 +1,56 @@
package org.jeecg.modules.project.calculateConfig.calculateAPI.service.impl;
import cn.hutool.core.bean.BeanUtil;
import org.jeecg.modules.project.calculateConfig.bizConfigChemistry.entity.BizConfigChemistry;
import org.jeecg.modules.project.calculateConfig.bizConfigChemistry.service.IBizConfigChemistryService;
import org.jeecg.modules.project.calculateConfig.bizConfigFacility.entity.BizConfigFacility;
import org.jeecg.modules.project.calculateConfig.bizConfigFacility.service.IBizConfigFacilityService;
import org.jeecg.modules.project.calculateConfig.bizConfigLeak.entity.BizConfigLeak;
import org.jeecg.modules.project.calculateConfig.bizConfigLeak.service.IBizConfigLeakService;
import org.jeecg.modules.project.calculateConfig.bizConfigNucleus.entity.BizConfigNucleus;
import org.jeecg.modules.project.calculateConfig.bizConfigNucleus.service.IBizConfigNucleusService;
import org.jeecg.modules.project.calculateConfig.calculateAPI.service.IBizCalculateAPIService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
public class BizCalculateAPIServiceImpl implements IBizCalculateAPIService {
@Autowired
private IBizConfigNucleusService bizConfigNucleusService;
@Autowired
private IBizConfigFacilityService bizConfigFacilityService;
@Autowired
private IBizConfigChemistryService bizConfigChemistryService;
@Autowired
private IBizConfigLeakService bizConfigLeakService;
@Override
public void saveCalculateConfig(Map<String,String> map) {
Integer sceneType = Integer.valueOf(map.get("sceneType"));
if(sceneType == 1){
BizConfigNucleus bizConfigNucleus = new BizConfigNucleus();
BeanUtil.copyProperties(map, bizConfigNucleus);
bizConfigNucleusService.save(bizConfigNucleus);
}else if(sceneType == 2){
BizConfigFacility bizConfigFacility = new BizConfigFacility();
BeanUtil.copyProperties(map, bizConfigFacility);
bizConfigFacilityService.save(bizConfigFacility);
}else if(sceneType == 3){
BizConfigChemistry bizConfigChemistry = new BizConfigChemistry();
BeanUtil.copyProperties(map, bizConfigChemistry);
bizConfigChemistryService.save(bizConfigChemistry);
}else if(sceneType == 4){
BizConfigLeak bizConfigLeak = new BizConfigLeak();
BeanUtil.copyProperties(map, bizConfigLeak);
bizConfigLeakService.save(bizConfigLeak);
}
}
}

View File

@ -83,7 +83,6 @@ public class BizResultDiffuseController extends JeecgController<BizResultDiffuse
*/
@AutoLog(value = "扩散计算结果配置表-添加")
@ApiOperation(value="扩散计算结果配置表-添加", notes="扩散计算结果配置表-添加")
@RequiresPermissions("bizResultDiffuse:biz_result_diffuse:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizResultDiffuse bizResultDiffuse) {
bizResultDiffuseService.save(bizResultDiffuse);
@ -98,7 +97,6 @@ public class BizResultDiffuseController extends JeecgController<BizResultDiffuse
*/
@AutoLog(value = "扩散计算结果配置表-编辑")
@ApiOperation(value="扩散计算结果配置表-编辑", notes="扩散计算结果配置表-编辑")
@RequiresPermissions("bizResultDiffuse:biz_result_diffuse:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizResultDiffuse bizResultDiffuse) {
bizResultDiffuseService.updateById(bizResultDiffuse);
@ -113,7 +111,6 @@ public class BizResultDiffuseController extends JeecgController<BizResultDiffuse
*/
@AutoLog(value = "扩散计算结果配置表-通过id删除")
@ApiOperation(value="扩散计算结果配置表-通过id删除", notes="扩散计算结果配置表-通过id删除")
@RequiresPermissions("bizResultDiffuse:biz_result_diffuse:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizResultDiffuseService.removeById(id);
@ -128,7 +125,6 @@ public class BizResultDiffuseController extends JeecgController<BizResultDiffuse
*/
@AutoLog(value = "扩散计算结果配置表-批量删除")
@ApiOperation(value="扩散计算结果配置表-批量删除", notes="扩散计算结果配置表-批量删除")
@RequiresPermissions("bizResultDiffuse:biz_result_diffuse:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizResultDiffuseService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -84,7 +84,6 @@ public class BizResultDosageController extends JeecgController<BizResultDosage,
*/
@AutoLog(value = "剂量计算结果配置表-添加")
@ApiOperation(value="剂量计算结果配置表-添加", notes="剂量计算结果配置表-添加")
@RequiresPermissions("bizResultDosage:biz_result_dosage:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizResultDosage bizResultDosage) {
bizResultDosageService.save(bizResultDosage);
@ -99,7 +98,6 @@ public class BizResultDosageController extends JeecgController<BizResultDosage,
*/
@AutoLog(value = "剂量计算结果配置表-编辑")
@ApiOperation(value="剂量计算结果配置表-编辑", notes="剂量计算结果配置表-编辑")
@RequiresPermissions("bizResultDosage:biz_result_dosage:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizResultDosage bizResultDosage) {
bizResultDosageService.updateById(bizResultDosage);
@ -114,7 +112,6 @@ public class BizResultDosageController extends JeecgController<BizResultDosage,
*/
@AutoLog(value = "剂量计算结果配置表-通过id删除")
@ApiOperation(value="剂量计算结果配置表-通过id删除", notes="剂量计算结果配置表-通过id删除")
@RequiresPermissions("bizResultDosage:biz_result_dosage:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizResultDosageService.removeById(id);
@ -129,7 +126,6 @@ public class BizResultDosageController extends JeecgController<BizResultDosage,
*/
@AutoLog(value = "剂量计算结果配置表-批量删除")
@ApiOperation(value="剂量计算结果配置表-批量删除", notes="剂量计算结果配置表-批量删除")
@RequiresPermissions("bizResultDosage:biz_result_dosage:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizResultDosageService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -84,7 +84,6 @@ public class BizResultOptimizeController extends JeecgController<BizResultOptimi
*/
@AutoLog(value = "路径优化计算结果配置表-添加")
@ApiOperation(value="路径优化计算结果配置表-添加", notes="路径优化计算结果配置表-添加")
@RequiresPermissions("bizResultOptimize:biz_result_optimize:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizResultOptimize bizResultOptimize) {
bizResultOptimizeService.save(bizResultOptimize);
@ -99,7 +98,6 @@ public class BizResultOptimizeController extends JeecgController<BizResultOptimi
*/
@AutoLog(value = "路径优化计算结果配置表-编辑")
@ApiOperation(value="路径优化计算结果配置表-编辑", notes="路径优化计算结果配置表-编辑")
@RequiresPermissions("bizResultOptimize:biz_result_optimize:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizResultOptimize bizResultOptimize) {
bizResultOptimizeService.updateById(bizResultOptimize);
@ -114,7 +112,6 @@ public class BizResultOptimizeController extends JeecgController<BizResultOptimi
*/
@AutoLog(value = "路径优化计算结果配置表-通过id删除")
@ApiOperation(value="路径优化计算结果配置表-通过id删除", notes="路径优化计算结果配置表-通过id删除")
@RequiresPermissions("bizResultOptimize:biz_result_optimize:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizResultOptimizeService.removeById(id);
@ -129,7 +126,6 @@ public class BizResultOptimizeController extends JeecgController<BizResultOptimi
*/
@AutoLog(value = "路径优化计算结果配置表-批量删除")
@ApiOperation(value="路径优化计算结果配置表-批量删除", notes="路径优化计算结果配置表-批量删除")
@RequiresPermissions("bizResultOptimize:biz_result_optimize:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizResultOptimizeService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -84,7 +84,6 @@ public class BizResultSourceItemController extends JeecgController<BizResultSour
*/
@AutoLog(value = "源项计算结果配置表-添加")
@ApiOperation(value="源项计算结果配置表-添加", notes="源项计算结果配置表-添加")
@RequiresPermissions("bizResultSourceItem:biz_result_sourceitem:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody BizResultSourceItem bizResultSourceItem) {
bizResultSourceItemService.save(bizResultSourceItem);
@ -99,7 +98,6 @@ public class BizResultSourceItemController extends JeecgController<BizResultSour
*/
@AutoLog(value = "源项计算结果配置表-编辑")
@ApiOperation(value="源项计算结果配置表-编辑", notes="源项计算结果配置表-编辑")
@RequiresPermissions("bizResultSourceItem:biz_result_sourceitem:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody BizResultSourceItem bizResultSourceItem) {
bizResultSourceItemService.updateById(bizResultSourceItem);
@ -114,7 +112,6 @@ public class BizResultSourceItemController extends JeecgController<BizResultSour
*/
@AutoLog(value = "源项计算结果配置表-通过id删除")
@ApiOperation(value="源项计算结果配置表-通过id删除", notes="源项计算结果配置表-通过id删除")
@RequiresPermissions("bizResultSourceItem:biz_result_sourceitem:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
bizResultSourceItemService.removeById(id);
@ -129,7 +126,6 @@ public class BizResultSourceItemController extends JeecgController<BizResultSour
*/
@AutoLog(value = "源项计算结果配置表-批量删除")
@ApiOperation(value="源项计算结果配置表-批量删除", notes="源项计算结果配置表-批量删除")
@RequiresPermissions("bizResultSourceItem:biz_result_sourceitem:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.bizResultSourceItemService.removeByIds(Arrays.asList(ids.split(",")));

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.project.calculateResult.runProcess.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
@ -14,11 +15,15 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.util.RemoteExecuteCommand;
import org.jeecg.modules.constants.EnginConstants;
import org.jeecg.modules.constants.GriddConstants;
import org.jeecg.modules.project.baseAPI.sftpAPI.IBizSftpAPIService;
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.service.IBizCmaqService;
import org.jeecg.modules.project.calculateConfig.bizConfigNucleus.entity.BizConfigNucleus;
import org.jeecg.modules.project.calculateConfig.bizWrf.entity.BizWrf;
import org.jeecg.modules.project.calculateConfig.bizWrf.service.IBizWrfService;
import org.jeecg.modules.project.calculateConfig.calculateAPI.service.IBizCalculateAPIService;
import org.jeecg.modules.project.calculateResult.bizResultDiffuse.entity.BizResultDiffuse;
import org.jeecg.modules.project.calculateResult.bizResultDiffuse.service.IBizResultDiffuseService;
import org.jeecg.modules.project.calculateResult.runProcess.VO.ProgressVO;
@ -40,6 +45,7 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -65,16 +71,15 @@ public class RunProcessController extends JeecgController<BizResultDiffuse, IBiz
private IBizWrfService bizWrfService;
@Autowired
private IBizSftpAPIService bizSftpAPIService;
private IBizCmaqService bizCmaqService;
@Autowired
private IBizCalculateAPIService bizCalculateAPIService;
@Value("${spring.baseHome}")
private String baseHome;
@Value("${spring.localFilePrefix}")
private String localFilePrefix;
@Value("${spring.cshTemFielPath}")
private String cshTemFielPath;
@Value("${spring.WRF.geog_data_path}")
private String geog_data_path;
@Value("${spring.Linux.ip}")
private String ip;
@ -95,160 +100,59 @@ public class RunProcessController extends JeecgController<BizResultDiffuse, IBiz
@AutoLog(value = "运行过程-运行wrf所有程序")
@ApiOperation(value="运行过程-运行wrf所有程序", notes="运行过程-运行wrf所有程序")
@GetMapping(value = "/runAllExe")
public Result<String> runAllExe(String engineeringId) throws IOException {
BizEngineering engineering = bizEngineeringService.getById(engineeringId);
BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper<BizWrf>().eq(BizWrf::getEngineeringId,engineering));
public Result<String> runAllExe(Map<String,String> map) throws IOException {
bizCalculateAPIService.saveCalculateConfig(map);
String newAllRunPath = String.format("%s%s/%s/", baseHome, bizWrf.getCreateBy(),engineering.getEngineeringName());
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, String.format("rm -rf %s",newAllRunPath));
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, String.format("mkdir %s",baseHome + bizWrf.getCreateBy()));
String runCmd = String.format("cp -r %sAll_Run %s", baseHome, newAllRunPath);
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, runCmd);
saveWpsFile(bizWrf,engineering.getEngineeringName());
saveInputFile(bizWrf,engineering.getEngineeringName());
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);
bizWrfService.runAllWrfExe(map);
bizCmaqService.runAllCmaqExe(map);
return Result.OK("运行成功!");
}
public void saveWpsFile(BizWrf bizWrf,String engineeringName){
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineeringName + "/";
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineeringName + "/";
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());
/**
* 停止程序
*
* @param
* @return
*/
@AutoLog(value = "运行过程-暂停程序")
@ApiOperation(value="运行过程-暂停程序", notes="运行过程-暂停程序")
@GetMapping(value = "/stopRun")
public Result<String> stopRun(String engin) throws IOException {
BizEngineering engineering = bizEngineeringService.getById(engin);
String allRunPath = baseHome + engineering.getCreateBy() + "/" + engineering.getEngineeringName() + "/";
String exeName = "";
String executeResult = RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password, "ps -ef | grep "+exeName+".exe");
String[] resultArray = executeResult.split("/n");
for (String result : resultArray) {
if(result.indexOf(allRunPath) >= 0){
String[] values = result.trim().split(" ");
RemoteExecuteCommand.runRemoteLinuxCmd(ip, username, password,"kill -9 " + values[6].trim());
break;
}
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, localFilePath + fileName, "UTF-8");
bizSftpAPIService.sftpUpload(localFilePath + fileName, allRunPath + "WPS", fileName);
} catch (Exception e) {
e.printStackTrace();
}
engineering.setRunStatus(99);
bizEngineeringService.updateById(engineering);
return Result.OK("运行成功!");
}
public void saveInputFile(BizWrf bizWrf,String engineeringName){
String allRunPath = baseHome + bizWrf.getCreateBy() + "/" + engineeringName + "/";
String localFilePath = localFilePrefix + bizWrf.getCreateBy() + "/" + engineeringName + "/";
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, localFilePath + fileName, "UTF-8");
bizSftpAPIService.sftpUpload(localFilePath + fileName, allRunPath + "WRF/run", fileName);
} catch (ParseException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
/**
* 暂停程序
*
* @param
* @return
*/
@AutoLog(value = "运行过程-暂停程序")
@ApiOperation(value="运行过程-暂停程序", notes="运行过程-暂停程序")
@GetMapping(value = "/pauseRun")
public Result<String> pauseRun(String engin) throws IOException {
// bizCalculateAPIService.saveCalculateConfig(map);
//
// bizWrfService.runAllWrfExe(map);
// bizCmaqService.runAllCmaqExe(map);
return Result.OK("运行成功!");
}
/**
@ -453,6 +357,23 @@ public class RunProcessController extends JeecgController<BizResultDiffuse, IBiz
// long oneDaySecs = 60 * 60 * 24 * 1000;
// long sumDay = Integer.valueOf(endTime.getTime() - startTime.getTime() + "") / oneDaySecs * 24;
// System.out.println(sumDay);
System.out.println(1.0 / 3);
BizWrf bizWrf = new BizWrf();
bizWrf.setRefLat(40 + "");
bizWrf.setRefLon(-97+"");
bizWrf.setDx(1000+"");
bizWrf.setDy(1000+"");
bizWrf.setLat1(Double.valueOf(bizWrf.getRefLat()) - GriddConstants.NY_GRIDD_RADII + "");
bizWrf.setLon1(Double.valueOf(bizWrf.getRefLon()) - GriddConstants.NY_GRIDD_RADII + "");
bizWrf.setLat2(Double.valueOf(bizWrf.getRefLat()) + GriddConstants.NY_GRIDD_RADII + "");
bizWrf.setLon2(Double.valueOf(bizWrf.getRefLon()) + GriddConstants.NY_GRIDD_RADII + "");
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))));
System.out.println(bizWrf.getSn() + " " + bizWrf.getWe());
}
}

View File

@ -466,7 +466,6 @@ public class SysUserController {
* @param request
* @param sysUser
*/
@RequiresPermissions("system:user:export")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
// Step.1 组装查询条件