diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/constants/GriddConstants.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/constants/GriddConstants.java new file mode 100644 index 00000000..42c37811 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/constants/GriddConstants.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.constants; + +public class GriddConstants { + public static final double NY_GRIDD_RADII = 1.0742; // 纽约网格半径(度) + + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizCityAim/controller/BizCityAimController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizCityAim/controller/BizCityAimController.java index f1ad67c5..edc6acb3 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizCityAim/controller/BizCityAimController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizCityAim/controller/BizCityAimController.java @@ -66,7 +66,6 @@ public class BizCityAimController extends JeecgController add(@RequestBody BizCityAim bizCityAim) { bizCityAimService.save(bizCityAim); @@ -81,7 +80,6 @@ public class BizCityAimController extends JeecgController edit(@RequestBody BizCityAim bizCityAim) { bizCityAimService.updateById(bizCityAim); @@ -96,7 +94,6 @@ public class BizCityAimController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizCityAimService.removeById(id); @@ -111,7 +108,6 @@ public class BizCityAimController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizCityAimService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/controller/BizFacilityAimController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/controller/BizFacilityAimController.java index fcabcda6..029e4b72 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/controller/BizFacilityAimController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/controller/BizFacilityAimController.java @@ -79,7 +79,6 @@ public class BizFacilityAimController extends JeecgController add(@RequestBody BizFacilityAim bizFacilityAim) { bizFacilityAimService.save(bizFacilityAim); @@ -94,7 +93,6 @@ public class BizFacilityAimController extends JeecgController edit(@RequestBody BizFacilityAim bizFacilityAim) { bizFacilityAimService.updateById(bizFacilityAim); @@ -109,7 +107,6 @@ public class BizFacilityAimController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizFacilityAimService.removeById(id); @@ -124,7 +121,6 @@ public class BizFacilityAimController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizFacilityAimService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/entity/BizFacilityAim.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/entity/BizFacilityAim.java index 257f63d7..72657b87 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/entity/BizFacilityAim.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizAim/bizFacilityAim/entity/BizFacilityAim.java @@ -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; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/controller/BizEngineeringController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/controller/BizEngineeringController.java index 0ba6ad28..42f0ef19 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/controller/BizEngineeringController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/controller/BizEngineeringController.java @@ -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 bizEngineerings = bizEngineeringService.list(new LambdaQueryWrapper(). 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 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().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().eq(BizModeLink::getSceneType, sceneType)); - BizCmaq bizCmaq = bizCmaqService.getOne(new LambdaQueryWrapper().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().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().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().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().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 getBizEngineeringByTime() { - return Result.ok(bizEngineeringService.getBizEngineeringByTime()); + BizEngineering bizEngineeringByTime = bizEngineeringService.getBizEngineeringByTime(); + if(bizEngineeringByTime == null){ + Result.error("未查询到工程信息!",null); + } + return Result.ok(bizEngineeringByTime); } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/entity/BizEngineering.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/entity/BizEngineering.java index 1edc177a..29deed52 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/entity/BizEngineering.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/entity/BizEngineering.java @@ -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 diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/service/impl/BizEngineeringServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/service/impl/BizEngineeringServiceImpl.java index 1808cff8..e43375a4 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/service/impl/BizEngineeringServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizEngineering/service/impl/BizEngineeringServiceImpl.java @@ -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 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().eq(BizWrf::getEngineeringId,engId)); bizCmaqMapper.delete(new LambdaQueryWrapper().eq(BizCmaq::getEngineeringId,engId)); + bizCalpuffMapper.delete(new LambdaQueryWrapper().eq(BizCalpuff::getEngineeringId,engId)); bizOpenfoamService.remove(new LambdaQueryWrapper().eq(BizOpenfoam::getEngineeringId,engId)); bizConfigChemistryService.remove(new LambdaQueryWrapper().eq(BizConfigChemistry::getEngineeringId,engId)); bizConfigLeakService.remove(new LambdaQueryWrapper().eq(BizConfigLeak::getEngineeringId,engId)); bizConfigFacilityService.remove(new LambdaQueryWrapper().eq(BizConfigFacility::getEngineeringId,engId)); bizConfigNucleusService.remove(new LambdaQueryWrapper().eq(BizConfigNucleus::getEngineeringId,engId)); + bizResultDiffuseService.remove(new LambdaQueryWrapper().eq(BizResultDiffuse::getEngineeringId,engId)); bizResultDosageService.remove(new LambdaQueryWrapper().eq(BizResultDosage::getEngineeringId,engId)); bizResultOptimizeService.remove(new LambdaQueryWrapper().eq(BizResultOptimize::getEngineeringId,engId)); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/controller/BizModeLinkController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/controller/BizModeLinkController.java index d2048d2c..74329be7 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/controller/BizModeLinkController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/controller/BizModeLinkController.java @@ -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 { @Autowired private IBizModeLinkService bizModeLinkService; - - /** - * 分页列表查询 - * - * @param bizModeLink - * @param pageNo - * @param pageSize - * @param req - * @return - */ - //@AutoLog(value = "模型链路选择-分页列表查询") - @ApiOperation(value="模型链路选择-分页列表查询", notes="模型链路选择-分页列表查询") - @GetMapping(value = "/list") - public Result> queryPageList(BizModeLink bizModeLink, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bizModeLink, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage 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> queryPageList(BizModeLink bizModeLink, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bizModeLink, req.getParameterMap()); + queryWrapper.orderByAsc("scene_type"); + Page page = new Page(pageNo, pageSize); + IPage pageList = bizModeLinkService.page(page, queryWrapper); + return Result.OK(pageList); + } + /** * 添加 * @@ -81,7 +92,6 @@ public class BizModeLinkController extends JeecgController add(@RequestBody BizModeLink bizModeLink) { bizModeLinkService.save(bizModeLink); @@ -96,7 +106,6 @@ public class BizModeLinkController extends JeecgController edit(@RequestBody BizModeLink bizModeLink) { bizModeLinkService.updateById(bizModeLink); @@ -111,7 +120,6 @@ public class BizModeLinkController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizModeLinkService.removeById(id); @@ -126,7 +134,6 @@ public class BizModeLinkController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizModeLinkService.removeByIds(Arrays.asList(ids.split(","))); @@ -156,7 +163,6 @@ public class BizModeLinkController extends JeecgController importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, BizModeLink.class); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/entity/BizModeLink.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/entity/BizModeLink.java index f9d62c7e..bbba896c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/entity/BizModeLink.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizModeLink/entity/BizModeLink.java @@ -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; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizNuclide/controller/BizNuclideController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizNuclide/controller/BizNuclideController.java index 884f50ce..7825b4f9 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizNuclide/controller/BizNuclideController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizNuclide/controller/BizNuclideController.java @@ -66,7 +66,6 @@ public class BizNuclideController extends JeecgController add(@RequestBody BizNuclide bizNuclide) { bizNuclideService.save(bizNuclide); @@ -81,7 +80,6 @@ public class BizNuclideController extends JeecgController edit(@RequestBody BizNuclide bizNuclide) { bizNuclideService.updateById(bizNuclide); @@ -96,7 +94,6 @@ public class BizNuclideController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizNuclideService.removeById(id); @@ -111,7 +108,6 @@ public class BizNuclideController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizNuclideService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizRole/controller/BizRoleController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizRole/controller/BizRoleController.java index 78a9fd97..b827966c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizRole/controller/BizRoleController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizRole/controller/BizRoleController.java @@ -81,7 +81,6 @@ public class BizRoleController extends JeecgController */ @AutoLog(value = "Gis和角色权限管理表-添加") @ApiOperation(value="Gis和角色权限管理表-添加", notes="Gis和角色权限管理表-添加") - @RequiresPermissions("bizRole:biz_role:add") @PostMapping(value = "/add") public Result add(@RequestBody BizRole bizRole) { bizRoleService.save(bizRole); @@ -96,7 +95,6 @@ public class BizRoleController extends JeecgController */ @AutoLog(value = "Gis和角色权限管理表-编辑") @ApiOperation(value="Gis和角色权限管理表-编辑", notes="Gis和角色权限管理表-编辑") - @RequiresPermissions("bizRole:biz_role:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result edit(@RequestBody BizRole bizRole) { bizRoleService.updateById(bizRole); @@ -127,7 +125,6 @@ public class BizRoleController extends JeecgController */ @AutoLog(value = "Gis和角色权限管理表-通过id删除") @ApiOperation(value="Gis和角色权限管理表-通过id删除", notes="Gis和角色权限管理表-通过id删除") - @RequiresPermissions("bizRole:biz_role:delete") @DeleteMapping(value = "/delete") public Result delete(@RequestParam(name="id",required=true) String id) { bizRoleService.removeById(id); @@ -142,7 +139,6 @@ public class BizRoleController extends JeecgController */ @AutoLog(value = "Gis和角色权限管理表-批量删除") @ApiOperation(value="Gis和角色权限管理表-批量删除", notes="Gis和角色权限管理表-批量删除") - @RequiresPermissions("bizRole:biz_role:deleteBatch") @DeleteMapping(value = "/deleteBatch") public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizRoleService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizSourceItem/controller/BizSourceItemController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizSourceItem/controller/BizSourceItemController.java index 01c6657b..450c8c75 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizSourceItem/controller/BizSourceItemController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizSourceItem/controller/BizSourceItemController.java @@ -81,7 +81,6 @@ public class BizSourceItemController extends JeecgController add(@RequestBody BizSourceItem bizSourceItem) { bizSourceItemService.save(bizSourceItem); @@ -96,7 +95,6 @@ public class BizSourceItemController extends JeecgController edit(@RequestBody BizSourceItem bizSourceItem) { bizSourceItemService.updateById(bizSourceItem); @@ -111,7 +109,6 @@ public class BizSourceItemController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizSourceItemService.removeById(id); @@ -126,7 +123,6 @@ public class BizSourceItemController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizSourceItemService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizTopography/bizTopographyInfo/controller/BizTopographyInfoController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizTopography/bizTopographyInfo/controller/BizTopographyInfoController.java index 57acc19c..f03424da 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizTopography/bizTopographyInfo/controller/BizTopographyInfoController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizTopography/bizTopographyInfo/controller/BizTopographyInfoController.java @@ -66,7 +66,6 @@ public class BizTopographyInfoController extends JeecgController add(@RequestBody BizTopographyInfo bizTopographyInfo) { bizTopographyInfoService.save(bizTopographyInfo); @@ -81,7 +80,6 @@ public class BizTopographyInfoController extends JeecgController edit(@RequestBody BizTopographyInfo bizTopographyInfo) { bizTopographyInfoService.updateById(bizTopographyInfo); @@ -96,7 +94,6 @@ public class BizTopographyInfoController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizTopographyInfoService.removeById(id); @@ -111,7 +108,6 @@ public class BizTopographyInfoController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizTopographyInfoService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizWeapon/controller/BizWeaponController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizWeapon/controller/BizWeaponController.java index 32c73670..d60c7c1f 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizWeapon/controller/BizWeaponController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/bizWeapon/controller/BizWeaponController.java @@ -66,7 +66,6 @@ public class BizWeaponController extends JeecgController add(@RequestBody BizWeapon bizWeapon) { bizWeaponService.save(bizWeapon); @@ -81,7 +80,6 @@ public class BizWeaponController extends JeecgController edit(@RequestBody BizWeapon bizWeapon) { bizWeaponService.updateById(bizWeapon); @@ -96,7 +94,6 @@ public class BizWeaponController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizWeaponService.removeById(id); @@ -111,7 +108,6 @@ public class BizWeaponController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizWeaponService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentMotor/controller/BizEquipmentMotorController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentMotor/controller/BizEquipmentMotorController.java index 215b709b..c43d23c0 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentMotor/controller/BizEquipmentMotorController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentMotor/controller/BizEquipmentMotorController.java @@ -66,7 +66,6 @@ public class BizEquipmentMotorController extends JeecgController add(@RequestBody BizEquipmentMotor bizEquipmentMotor) { bizEquipmentMotorService.save(bizEquipmentMotor); @@ -81,7 +80,6 @@ public class BizEquipmentMotorController extends JeecgController edit(@RequestBody BizEquipmentMotor bizEquipmentMotor) { bizEquipmentMotorService.updateById(bizEquipmentMotor); @@ -96,7 +94,6 @@ public class BizEquipmentMotorController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizEquipmentMotorService.removeById(id); @@ -111,7 +108,6 @@ public class BizEquipmentMotorController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizEquipmentMotorService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentProtection/controller/BizEquipmentProtectionController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentProtection/controller/BizEquipmentProtectionController.java index b4365cff..45a7fa67 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentProtection/controller/BizEquipmentProtectionController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/equipment/bizEquipmentProtection/controller/BizEquipmentProtectionController.java @@ -66,7 +66,6 @@ public class BizEquipmentProtectionController extends JeecgController add(@RequestBody BizEquipmentProtection bizEquipmentProtection) { bizEquipmentProtectionService.save(bizEquipmentProtection); @@ -81,7 +80,6 @@ public class BizEquipmentProtectionController extends JeecgController edit(@RequestBody BizEquipmentProtection bizEquipmentProtection) { bizEquipmentProtectionService.updateById(bizEquipmentProtection); @@ -96,7 +94,6 @@ public class BizEquipmentProtectionController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizEquipmentProtectionService.removeById(id); @@ -111,7 +108,6 @@ public class BizEquipmentProtectionController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizEquipmentProtectionService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherForecast/controller/BizWeatherForecastController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherForecast/controller/BizWeatherForecastController.java index 442f5833..00560659 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherForecast/controller/BizWeatherForecastController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherForecast/controller/BizWeatherForecastController.java @@ -66,7 +66,6 @@ public class BizWeatherForecastController extends JeecgController add(@RequestBody BizWeatherForecast bizWeatherForecast) { bizWeatherForecastService.save(bizWeatherForecast); @@ -81,7 +80,6 @@ public class BizWeatherForecastController extends JeecgController edit(@RequestBody BizWeatherForecast bizWeatherForecast) { bizWeatherForecastService.updateById(bizWeatherForecast); @@ -96,7 +94,6 @@ public class BizWeatherForecastController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizWeatherForecastService.removeById(id); @@ -111,7 +108,6 @@ public class BizWeatherForecastController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizWeatherForecastService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherHistory/controller/BizWeatherHistoryController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherHistory/controller/BizWeatherHistoryController.java index 89cd1c38..9b23f0cc 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherHistory/controller/BizWeatherHistoryController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/baseConfig/weather/bizWeatherHistory/controller/BizWeatherHistoryController.java @@ -66,7 +66,6 @@ public class BizWeatherHistoryController extends JeecgController add(@RequestBody BizWeatherHistory bizWeatherHistory) { bizWeatherHistoryService.save(bizWeatherHistory); @@ -81,7 +80,6 @@ public class BizWeatherHistoryController extends JeecgController edit(@RequestBody BizWeatherHistory bizWeatherHistory) { bizWeatherHistoryService.updateById(bizWeatherHistory); @@ -96,7 +94,6 @@ public class BizWeatherHistoryController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizWeatherHistoryService.removeById(id); @@ -111,7 +108,6 @@ public class BizWeatherHistoryController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizWeatherHistoryService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/controller/BizCalpuffController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/controller/BizCalpuffController.java new file mode 100644 index 00000000..0afede7f --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/controller/BizCalpuffController.java @@ -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 { + @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> queryPageList(BizCalpuff bizCalpuff, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bizCalpuff, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage 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 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 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 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 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 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); + } + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/entity/BizCalpuff.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/entity/BizCalpuff.java new file mode 100644 index 00000000..9381d90a --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/entity/BizCalpuff.java @@ -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; +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/mapper/BizCalpuffMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/mapper/BizCalpuffMapper.java new file mode 100644 index 00000000..430df08d --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/mapper/BizCalpuffMapper.java @@ -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 { + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/mapper/xml/BizCalpuffMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/mapper/xml/BizCalpuffMapper.xml new file mode 100644 index 00000000..259d9653 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/mapper/xml/BizCalpuffMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/service/IBizCalpuffService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/service/IBizCalpuffService.java new file mode 100644 index 00000000..7e53ba1c --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/service/IBizCalpuffService.java @@ -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 { + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/service/impl/BizCalpuffServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/service/impl/BizCalpuffServiceImpl.java new file mode 100644 index 00000000..ad8237f6 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCalpuff/service/impl/BizCalpuffServiceImpl.java @@ -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 implements IBizCalpuffService { + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/controller/BizCmaqController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/controller/BizCmaqController.java index 938d094f..9010f600 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/controller/BizCmaqController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/controller/BizCmaqController.java @@ -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 @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> queryPageList(BizCmaq bizCmaq, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10000") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bizCmaq, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage 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 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 add(@RequestBody BizCmaq bizCmaq) { - BizWrf wrf = bizWrfService.getOne(new LambdaQueryWrapper().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 */ @AutoLog(value = "CMAQ-编辑") @ApiOperation(value="CMAQ-编辑", notes="CMAQ-编辑") - //@RequiresPermissions("bizCmaq:biz_cmaq:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result 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 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 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 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 getCmaqTem(Integer temType) { - BizCmaq bizCmaq = bizCmaqService.getOne(new LambdaQueryWrapper().eq(BizCmaq::getTemType,temType)); - if(bizCmaq==null) { - return Result.error("未找到对应数据"); - } - return Result.OK(bizCmaq); - } - /** * 通过类型查询模板 * @@ -235,7 +124,7 @@ public class BizCmaqController extends JeecgController //@AutoLog(value = "cmaq-通过类型查询模板") @ApiOperation(value="cmaq-通过类型查询模板", notes="cmaq-通过类型查询模板") @GetMapping(value = "/getCmaqTem") - public Result getWrfTem(Integer temType,Integer sceneType,Integer modeType,String modeSchemeName) { + public Result getCmaqTem(Integer temType,Integer sceneType,Integer modeType,String modeSchemeName) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(BizCmaq::getTemType,temType); lambdaQueryWrapper.eq(BizCmaq::getSceneType,sceneType); @@ -251,27 +140,4 @@ public class BizCmaqController extends JeecgController 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); - } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/entity/BizCmaq.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/entity/BizCmaq.java index 788deeb0..cef79ccb 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/entity/BizCmaq.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/entity/BizCmaq.java @@ -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; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/IBizCmaqService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/IBizCmaqService.java index f7ca2e74..c0e3a987 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/IBizCmaqService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/IBizCmaqService.java @@ -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 { List> getNCFileInfo(String engineeringId,int layer); - boolean runMcipShell(String engineeringId); - - boolean runIconShell(String engineeringId); - - boolean runBconShell(String engineeringId); - - boolean runCctmShell(String engineeringId); + Result runAllCmaqExe(Map map); List getVariableNames(String engineeringId); } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/impl/BizCmaqServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/impl/BizCmaqServiceImpl.java index 7ff94392..4e19871b 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/impl/BizCmaqServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizCmaq/service/impl/BizCmaqServiceImpl.java @@ -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 impl @Value("${spring.Linux.port}") private Integer port; + + @Override + public Result runAllCmaqExe(Map map){ + String engineeringId = map.get("engineeringId"); + BizCmaq bizCmaq = this.baseMapper.selectOne(new LambdaQueryWrapper().eq(BizCmaq::getEngineeringId, engineeringId)); + BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper().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 impl return fileName; } - @Override public boolean runMcipShell(String engineeringId) { BizEngineering engineering = bizEngineeringService.getById(engineeringId); BizCmaq cmaq = getOne(new LambdaQueryWrapper().eq(BizCmaq::getEngineeringId,engineeringId)); @@ -155,7 +178,6 @@ public class BizCmaqServiceImpl extends ServiceImpl impl return true; } - @Override public boolean runIconShell(String engineeringId) { BizEngineering engineering = bizEngineeringService.getById(engineeringId); BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper().eq(BizWrf::getEngineeringId,engineeringId)); @@ -175,7 +197,6 @@ public class BizCmaqServiceImpl extends ServiceImpl impl return true; } - @Override public boolean runBconShell(String engineeringId) { BizEngineering engineering = bizEngineeringService.getById(engineeringId); BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper().eq(BizWrf::getEngineeringId,engineeringId)); @@ -207,7 +228,6 @@ public class BizCmaqServiceImpl extends ServiceImpl impl return true; } - @Override public boolean runCctmShell(String engineeringId) { BizEngineering engineering = bizEngineeringService.getById(engineeringId); BizWrf wrf = bizWrfMapper.selectOne(new LambdaQueryWrapper().eq(BizWrf::getEngineeringId,engineeringId)); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigChemistry/controller/BizConfigChemistryController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigChemistry/controller/BizConfigChemistryController.java index b2e437d9..3ed58ab8 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigChemistry/controller/BizConfigChemistryController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigChemistry/controller/BizConfigChemistryController.java @@ -81,7 +81,6 @@ public class BizConfigChemistryController extends JeecgController add(@RequestBody BizConfigChemistry bizConfigChemistry) { bizConfigChemistryService.save(bizConfigChemistry); @@ -96,7 +95,6 @@ public class BizConfigChemistryController extends JeecgController edit(@RequestBody BizConfigChemistry bizConfigChemistry) { bizConfigChemistryService.updateById(bizConfigChemistry); @@ -111,7 +109,6 @@ public class BizConfigChemistryController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizConfigChemistryService.removeById(id); @@ -126,7 +123,6 @@ public class BizConfigChemistryController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizConfigChemistryService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigFacility/controller/BizConfigFacilityController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigFacility/controller/BizConfigFacilityController.java index e5cf10ee..0bdf0de5 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigFacility/controller/BizConfigFacilityController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigFacility/controller/BizConfigFacilityController.java @@ -81,7 +81,6 @@ public class BizConfigFacilityController extends JeecgController add(@RequestBody BizConfigFacility bizConfigFacility) { bizConfigFacilityService.save(bizConfigFacility); @@ -96,7 +95,6 @@ public class BizConfigFacilityController extends JeecgController edit(@RequestBody BizConfigFacility bizConfigFacility) { bizConfigFacilityService.updateById(bizConfigFacility); @@ -111,7 +109,6 @@ public class BizConfigFacilityController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizConfigFacilityService.removeById(id); @@ -126,7 +123,6 @@ public class BizConfigFacilityController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizConfigFacilityService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigLeak/controller/BizConfigLeakController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigLeak/controller/BizConfigLeakController.java index b21a60f7..39da1814 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigLeak/controller/BizConfigLeakController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigLeak/controller/BizConfigLeakController.java @@ -81,7 +81,6 @@ public class BizConfigLeakController extends JeecgController add(@RequestBody BizConfigLeak bizConfigLeak) { bizConfigLeakService.save(bizConfigLeak); @@ -96,7 +95,6 @@ public class BizConfigLeakController extends JeecgController edit(@RequestBody BizConfigLeak bizConfigLeak) { bizConfigLeakService.updateById(bizConfigLeak); @@ -111,7 +109,6 @@ public class BizConfigLeakController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizConfigLeakService.removeById(id); @@ -126,7 +123,6 @@ public class BizConfigLeakController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizConfigLeakService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigNucleus/controller/BizConfigNucleusController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigNucleus/controller/BizConfigNucleusController.java index b1db40e6..4bf1ec8c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigNucleus/controller/BizConfigNucleusController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizConfigNucleus/controller/BizConfigNucleusController.java @@ -81,7 +81,6 @@ public class BizConfigNucleusController extends JeecgController add(@RequestBody BizConfigNucleus bizConfigNucleus) { bizConfigNucleusService.save(bizConfigNucleus); @@ -96,7 +95,6 @@ public class BizConfigNucleusController extends JeecgController edit(@RequestBody BizConfigNucleus bizConfigNucleus) { bizConfigNucleusService.updateById(bizConfigNucleus); @@ -111,7 +109,6 @@ public class BizConfigNucleusController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizConfigNucleusService.removeById(id); @@ -126,7 +123,6 @@ public class BizConfigNucleusController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizConfigNucleusService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/controller/BizOpenfoamController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/controller/BizOpenfoamController.java index 72a1774b..9a37892d 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/controller/BizOpenfoamController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/controller/BizOpenfoamController.java @@ -96,21 +96,6 @@ public class BizOpenfoamController extends JeecgController add(@RequestBody BizOpenfoam bizOpenfoam) { - bizOpenfoamService.saveOrUpdate(bizOpenfoam); - return Result.OK(bizOpenfoam); - } - /** * 编辑 * @@ -119,7 +104,6 @@ public class BizOpenfoamController extends JeecgController edit(@RequestBody BizOpenfoam bizOpenfoam) { bizOpenfoamService.updateById(bizOpenfoam); @@ -150,8 +134,8 @@ public class BizOpenfoamController extends JeecgController getWrfTem(Integer temType, Integer sceneType, Integer modeType, String modeSchemeName) { + @GetMapping(value = "/getOpemFOAMTem") + public Result getOpemFOAMTem(Integer temType, Integer sceneType, Integer modeType, String modeSchemeName) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper.eq(BizOpenfoam::getTemType,temType); lambdaQueryWrapper.eq(BizOpenfoam::getSceneType,sceneType); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/entity/BizOpenfoam.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/entity/BizOpenfoam.java index abf51c7c..9cbe15ee 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/entity/BizOpenfoam.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizOpenfoam/entity/BizOpenfoam.java @@ -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; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/controller/BizWrfController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/controller/BizWrfController.java index ec9e89d5..177d5614 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/controller/BizWrfController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/controller/BizWrfController.java @@ -62,211 +62,12 @@ public class BizWrfController extends JeecgController { 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> queryPageList(BizWrf bizWrf, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10000") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(bizWrf, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage 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 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 runWps(String engineeringId) throws IOException { - BizEngineering engineering = bizEngineeringService.getById(engineeringId); - BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper().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 runWrf(String engineeringId) throws IOException { - BizEngineering engineering = bizEngineeringService.getById(engineeringId); - BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper().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 getRunWrfLog(String engineeringId) { - try { - BizEngineering engineering = bizEngineeringService.getById(engineeringId); - BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper().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 { */ @AutoLog(value = "wrf-编辑") @ApiOperation(value="wrf-编辑", notes="wrf-编辑") - //@RequiresPermissions("bizWrf:biz_wrf:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result 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 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 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 { //@AutoLog(value = "wrf-通过类型查询模板") @ApiOperation(value="wrf-通过类型查询模板", notes="wrf-通过类型查询模板") @GetMapping(value = "/getWrfTem") - public Result getWrfTem(Integer temType,Integer sceneType,Integer modeType,String modeSchemeName) { + public Result getWrfTem(Integer sceneType) { LambdaQueryWrapper 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 bizWrfs = bizWrfService.list(lambdaQueryWrapper); if(bizWrfs == null || bizWrfs.isEmpty()) { @@ -552,29 +319,6 @@ public class BizWrfController extends JeecgController { 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 { // 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; + } + } } } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/entity/BizWrf.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/entity/BizWrf.java index ff818d7b..28e4b2bf 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/entity/BizWrf.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/entity/BizWrf.java @@ -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; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/IBizWrfService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/IBizWrfService.java index 71af8cd0..563dae2c 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/IBizWrfService.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/IBizWrfService.java @@ -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 { - Result runGeogrid(String allRunPath, String engineeringId)throws IOException; - Result runUngrib(String allRunPath, String engineeringId)throws IOException; - Result runMetgrid(String allRunPath, String engineeringId)throws IOException; - Result runReal(String allRunPath, String engineeringId)throws IOException; - Result runWrf(String allRunPath, String engineeringId) throws IOException; + Result runAllWrfExe(Map map) throws IOException; } diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/impl/BizWrfServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/impl/BizWrfServiceImpl.java index 37cffba4..10e27a8f 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/impl/BizWrfServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/bizWrf/service/impl/BizWrfServiceImpl.java @@ -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 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 impleme private IBizEngineeringService bizEngineeringService; @Override + public Result runAllWrfExe(Map map) throws IOException { + + String engineeringId = map.get("engineeringId"); + BizEngineering engineering = bizEngineeringService.getById(engineeringId); + BizWrf bizWrf = this.baseMapper.selectOne(new LambdaQueryWrapper().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 runGeogridResult = runGeogrid(allRunPath, engineeringId); + if(!runGeogridResult.isSuccess()){ + return runGeogridResult; + } + Result runUngribResult = runUngrib(allRunPath,engineeringId); + if(!runUngribResult.isSuccess()){ + return runUngribResult; + } + Result runMetgridResult = runMetgrid(allRunPath,engineeringId); + if(!runMetgridResult.isSuccess()){ + return runMetgridResult; + } + Result runRealResult = runReal(allRunPath,engineeringId); + if(!runRealResult.isSuccess()){ + return runRealResult; + } + Result 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 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 impleme return Result.OK("geogrid执行成功"); }else{ bizEngineeringService.updateErrorStatus(engineeringId,1); - return Result.OK(geogridLog); + return Result.error(geogridLog); } } - @Override public Result runUngrib(String allRunPath,String engineeringId) throws IOException { BizWrf bizWrf = this.baseMapper.selectOne(new LambdaQueryWrapper().eq(BizWrf::getEngineeringId,engineeringId)); String localFilePath = allRunPath.replace(baseHome, localFilePrefix); @@ -100,11 +313,10 @@ public class BizWrfServiceImpl extends ServiceImpl impleme return Result.OK("ungrib执行成功"); }else{ bizEngineeringService.updateErrorStatus(engineeringId,2); - return Result.OK(ungribLog); + return Result.error(ungribLog); } } - @Override public Result 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 impleme return Result.OK("metgrid执行成功"); }else{ bizEngineeringService.updateErrorStatus(engineeringId,3); - return Result.OK(metgridLog); + return Result.error(metgridLog); } } - @Override public Result 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 impleme return Result.OK("real执行成功"); }else{ bizEngineeringService.updateErrorStatus(engineeringId,4); - return Result.OK(realLog); + return Result.error(realLog); } } - @Override public Result runWrf(String allRunPath,String engineeringId) throws IOException { String localFilePath = allRunPath.replace(baseHome, localFilePrefix); String cdWRF = "cd " + allRunPath + "WRF/run;"; diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/calculateAPI/service/IBizCalculateAPIService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/calculateAPI/service/IBizCalculateAPIService.java new file mode 100644 index 00000000..99d9fe09 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/calculateAPI/service/IBizCalculateAPIService.java @@ -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 map); + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/calculateAPI/service/impl/BizCalculateAPIServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/calculateAPI/service/impl/BizCalculateAPIServiceImpl.java new file mode 100644 index 00000000..b237f93e --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateConfig/calculateAPI/service/impl/BizCalculateAPIServiceImpl.java @@ -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 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); + } + } +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDiffuse/controller/BizResultDiffuseController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDiffuse/controller/BizResultDiffuseController.java index b2e31d8b..8680e50b 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDiffuse/controller/BizResultDiffuseController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDiffuse/controller/BizResultDiffuseController.java @@ -83,7 +83,6 @@ public class BizResultDiffuseController extends JeecgController add(@RequestBody BizResultDiffuse bizResultDiffuse) { bizResultDiffuseService.save(bizResultDiffuse); @@ -98,7 +97,6 @@ public class BizResultDiffuseController extends JeecgController edit(@RequestBody BizResultDiffuse bizResultDiffuse) { bizResultDiffuseService.updateById(bizResultDiffuse); @@ -113,7 +111,6 @@ public class BizResultDiffuseController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizResultDiffuseService.removeById(id); @@ -128,7 +125,6 @@ public class BizResultDiffuseController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizResultDiffuseService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDosage/controller/BizResultDosageController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDosage/controller/BizResultDosageController.java index 694c6e35..8acc115e 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDosage/controller/BizResultDosageController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultDosage/controller/BizResultDosageController.java @@ -84,7 +84,6 @@ public class BizResultDosageController extends JeecgController add(@RequestBody BizResultDosage bizResultDosage) { bizResultDosageService.save(bizResultDosage); @@ -99,7 +98,6 @@ public class BizResultDosageController extends JeecgController edit(@RequestBody BizResultDosage bizResultDosage) { bizResultDosageService.updateById(bizResultDosage); @@ -114,7 +112,6 @@ public class BizResultDosageController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizResultDosageService.removeById(id); @@ -129,7 +126,6 @@ public class BizResultDosageController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizResultDosageService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultOptimize/controller/BizResultOptimizeController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultOptimize/controller/BizResultOptimizeController.java index 470ab099..0d2cd5fb 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultOptimize/controller/BizResultOptimizeController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultOptimize/controller/BizResultOptimizeController.java @@ -84,7 +84,6 @@ public class BizResultOptimizeController extends JeecgController add(@RequestBody BizResultOptimize bizResultOptimize) { bizResultOptimizeService.save(bizResultOptimize); @@ -99,7 +98,6 @@ public class BizResultOptimizeController extends JeecgController edit(@RequestBody BizResultOptimize bizResultOptimize) { bizResultOptimizeService.updateById(bizResultOptimize); @@ -114,7 +112,6 @@ public class BizResultOptimizeController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizResultOptimizeService.removeById(id); @@ -129,7 +126,6 @@ public class BizResultOptimizeController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizResultOptimizeService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultSourceItem/controller/BizResultSourceItemController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultSourceItem/controller/BizResultSourceItemController.java index 4fcfd350..9dfdf47e 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultSourceItem/controller/BizResultSourceItemController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/bizResultSourceItem/controller/BizResultSourceItemController.java @@ -84,7 +84,6 @@ public class BizResultSourceItemController extends JeecgController add(@RequestBody BizResultSourceItem bizResultSourceItem) { bizResultSourceItemService.save(bizResultSourceItem); @@ -99,7 +98,6 @@ public class BizResultSourceItemController extends JeecgController edit(@RequestBody BizResultSourceItem bizResultSourceItem) { bizResultSourceItemService.updateById(bizResultSourceItem); @@ -114,7 +112,6 @@ public class BizResultSourceItemController extends JeecgController delete(@RequestParam(name="id",required=true) String id) { bizResultSourceItemService.removeById(id); @@ -129,7 +126,6 @@ public class BizResultSourceItemController extends JeecgController deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.bizResultSourceItemService.removeByIds(Arrays.asList(ids.split(","))); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/runProcess/controller/RunProcessController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/runProcess/controller/RunProcessController.java index b3809d83..b61c1fe0 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/runProcess/controller/RunProcessController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/project/calculateResult/runProcess/controller/RunProcessController.java @@ -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 runAllExe(String engineeringId) throws IOException { - BizEngineering engineering = bizEngineeringService.getById(engineeringId); - BizWrf bizWrf = bizWrfService.getOne(new LambdaQueryWrapper().eq(BizWrf::getEngineeringId,engineering)); + public Result runAllExe(Map 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 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 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