diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/TransportTaskStatusEnum.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/TransportTaskStatusEnum.java new file mode 100644 index 0000000..84b28ed --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/TransportTaskStatusEnum.java @@ -0,0 +1,34 @@ +package org.jeecg.common.constant.enums; + +/** + * 输运任务状态说明枚举 + */ +public enum TransportTaskStatusEnum { + + /** + * 失败 + */ + FAILURE(-1), + /** + * 未开始 + */ + NOT_START(1), + /** + * 运行中 + */ + RUNNING(2), + /** + * 已完成 + */ + COMPLETED(3); + + private Integer key; + + TransportTaskStatusEnum(Integer key) { + this.key = key; + } + + public Integer getKey(){ + return this.key; + } +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/TransportTaskTypeEnum.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/TransportTaskTypeEnum.java new file mode 100644 index 0000000..39eee2e --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/TransportTaskTypeEnum.java @@ -0,0 +1,26 @@ +package org.jeecg.common.constant.enums; + +/** + * 输运任务类型说明枚举 + */ +public enum TransportTaskTypeEnum { + + /** + * 手动创建 + */ + MANUALLY(1), + /** + * 自动触发 + */ + AUTO(2); + + private Integer key; + + TransportTaskTypeEnum(Integer key) { + this.key = key; + } + + public Integer getKey(){ + return this.key; + } +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/WeatherVariableNameEnum.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/WeatherVariableNameEnum.java index 88be404..b29c6c0 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/WeatherVariableNameEnum.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/enums/WeatherVariableNameEnum.java @@ -6,21 +6,21 @@ package org.jeecg.common.constant.enums; public enum WeatherVariableNameEnum { - PANGU_T(0, 0, "Temperature_height_above_ground"), - PANGU_P(0, 1, "Pressure_msl"), - PANGU_H(0, 2, "Specific_humidity_isobaric"), - PANGU_U(0, 3, "u-component_of_wind_height_above_ground"), - PANGU_V(0, 4, "v-component_of_wind_height_above_ground"), - CRA40_T(1, 0, "Temperature_isobaric"), - CRA40_P(1, 1, "Vertical_velocity_pressure_isobaric"), - CRA40_H(1, 2, "Relative_humidity_isobaric"), - CRA40_U(1, 3, "u-component_of_wind_isobaric"), - CRA40_V(1, 4, "v-component_of_wind_isobaric"), - NCEP_T(2, 0, "Temperature_height_above_ground"), - NCEP_P(2, 1, "Pressure_msl"), - NCEP_H(2, 2, "Relative_humidity_height_above_ground"), - NCEP_U(2, 3, "u-component_of_wind_height_above_ground"), - NCEP_V(2, 4, "v-component_of_wind_height_above_ground"); + PANGU_T(1, 0, "Temperature_height_above_ground"), + PANGU_P(1, 1, "Pressure_msl"), + PANGU_H(1, 2, "Specific_humidity_isobaric"), + PANGU_U(1, 3, "u-component_of_wind_height_above_ground"), + PANGU_V(1, 4, "v-component_of_wind_height_above_ground"), + CRA40_T(3, 0, "Temperature_isobaric"), + CRA40_P(3, 1, "Vertical_velocity_pressure_isobaric"), + CRA40_H(3, 2, "Relative_humidity_isobaric"), + CRA40_U(3, 3, "u-component_of_wind_isobaric"), + CRA40_V(3, 4, "v-component_of_wind_isobaric"), + NCEP_T(4, 0, "Temperature_height_above_ground"), + NCEP_P(4, 1, "Pressure_msl"), + NCEP_H(4, 2, "Relative_humidity_height_above_ground"), + NCEP_U(4, 3, "u-component_of_wind_height_above_ground"), + NCEP_V(4, 4, "v-component_of_wind_height_above_ground"); private Integer type; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SourceRebuildParams.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SourceRebuildParams.java deleted file mode 100644 index 5458f73..0000000 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SourceRebuildParams.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jeecg.common.properties; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -@Data -@Component -@ConfigurationProperties(prefix = "source-rebuild") -public class SourceRebuildParams { - - /** - * Rserve 服务地址 - */ - private String serverAddr; - - /** - * Rserve端口 - */ - private Integer port; - - /** - * Rserve 用户名称 - */ - private String username; - - /** - * Rserve密码 - */ - private String password; - - /** - * R项目工作空间 - */ - private String workSpace; - -} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SourceRebuildProperties.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SourceRebuildProperties.java new file mode 100644 index 0000000..0e2d8cd --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/properties/SourceRebuildProperties.java @@ -0,0 +1,87 @@ +package org.jeecg.common.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@Component +@ConfigurationProperties(prefix = "source-rebuild") +public class SourceRebuildProperties { + + /** + * Rserve 服务地址 + */ + private String serverAddr; + + /** + * Rserve端口 + */ + private Integer port; + + /** + * Rserve 用户名称 + */ + private String username; + + /** + * Rserve密码 + */ + private String password; + + /** + * R项目工作空间 + */ + private String workSpace; + + /** + * pg数据库ip + */ + private String dbHost; + + /** + * pg数据库端口 + */ + private Integer dbPort; + + /** + * pg数据库名称 + */ + private String dbName; + + /** + * pg数据库用户名称 + */ + private String dbUsername; + + /** + * pg数据库密码 + */ + private String dbPassword; + + /** + * srs 文件路径 + */ + private String srsFilePath; + + /** + * xe文件srs文件所在的目录 + */ + private String xeGZFileDirSign; + + /** + * R项目所在路径 + */ + private String rProject; + + /** + * R项目输入目录 + */ + private String rInput; + + /** + * R项目输出目录 + */ + private String rOutput; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NcUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NcUtil.java index a970edc..2efb27e 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NcUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NcUtil.java @@ -303,10 +303,11 @@ public final class NcUtil { */ public static String getReftime(String filePath){ try (NetcdfFile ncFile = NetcdfFile.open(filePath)) { - Variable variable = ncFile.findVariable("reftime_ISO"); + Variable variable = ncFile.findVariable("reftime"); if (variable != null) { - Array data = variable.read(); - return data.getObject(0).toString(); + String units = variable.findAttribute("units").getStringValue(); + units = units.replace("Hour since ",""); + return units; } }catch (Exception e){ return null; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTask.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTask.java new file mode 100644 index 0000000..ed0ead8 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTask.java @@ -0,0 +1,100 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Null; +import lombok.Data; +import org.jeecg.common.validgroup.InsertGroup; +import org.jeecg.common.validgroup.UpdateGroup; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; +import java.util.List; + +/** + * 输运模拟任务表 + */ +@Data +@TableName("stas_transport_task") +public class TransportTask{ + + /** + * ID + */ + @Null(message = "ID必须为空",groups = { InsertGroup.class}) + @NotNull(message = "ID不能为空",groups = { UpdateGroup.class}) + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 任务名称 + */ + @NotBlank(message = "任务名称不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "task_name") + private String taskName; + + /** + * 任务模式(1-正向,-1-反向) + */ + @NotNull(message = "任务模式不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "task_mode") + private Integer taskMode; + + /** + * 任务类型(1-手动创建,2自动触发) + */ + @Null(message = "任务类型必须为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "task_type") + private Integer taskType; + + /** + * 任务进度 + */ + @Null(message = "任务进度必须为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "task_progress") + private Integer taskPprogress; + + /** + * 任务状态(-1执行失败,1未开始,2运行中,3已完成) + */ + @Null(message = "任务状态必须为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "task_status") + private Integer taskStatus; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新人 + */ + @TableField(value = "update_by") + private String updateBy; + + /** + * 更新时间 + */ + @TableField(value = "update_time") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + @Valid + @TableField(exist = false) + List childList; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTaskChild.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTaskChild.java new file mode 100644 index 0000000..91517d3 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTaskChild.java @@ -0,0 +1,92 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Null; +import lombok.Data; +import org.jeecg.common.validgroup.InsertGroup; +import org.jeecg.common.validgroup.UpdateGroup; +import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; + +/** + * 输运模拟任务子表 + */ +@Data +@TableName("stas_transport_task_child") +public class TransportTaskChild{ + + /** + * ID + */ + @Null(message = "ID必须为空",groups = { InsertGroup.class}) + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 任务ID + */ + @Null(message = "任务id必须为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "task_id") + private Integer taskId; + + /** + * 模拟开始时间 + */ + @NotNull(message = "模拟开始时间不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "start_time") + private Date startTime; + + /** + * 模拟结束时间 + */ + @NotNull(message = "模拟结束时间不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "end_time") + private Date endTime; + + /** + * 释放下部高度 + */ + @NotNull(message = "释放下部高度不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "z1") + private Double z1; + + /** + * 释放上部高度 + */ + @NotNull(message = "释放上部高度不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "z2") + private Double z2; + + /** + * 粒子数量 + */ + @NotNull(message = "粒子数量不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "particle_count") + private Integer particleCount; + + /** + * 物种编号 + */ + @NotNull(message = "物种编号不能为空",groups = {InsertGroup.class, UpdateGroup.class}) + @TableField(value = "specnum_rel") + private Integer specnumRel; + + /** + * 创建人 + */ + @TableField(value = "create_by") + private String createBy; + + /** + * 创建时间 + */ + @TableField(value = "create_time") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTaskLog.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTaskLog.java new file mode 100644 index 0000000..44e36f8 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/TransportTaskLog.java @@ -0,0 +1,45 @@ +package org.jeecg.modules.base.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 输运模拟任务日志表 + */ +@Data +@TableName("stas_transport_task_log") +public class TransportTaskLog implements Serializable { + + /** + * ID + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "ID") + private String id; + + /** + * 任务表主键 + */ + @TableField(value = "task_id") + private String taskId; + + /** + * 任务运行过程日志 + */ + @TableField(value = "log_content") + private String logContent; + + /** + * 创建时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/WeatherData.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/WeatherData.java index 86edf51..ebe7bdb 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/WeatherData.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/WeatherData.java @@ -51,7 +51,7 @@ public class WeatherData implements Serializable { private LocalDateTime dataStartTime; /** - * 数据来源(1-盘古模型,2-graphcast,3-再分析数据) + * 数据来源(1-盘古模型,2-graphcast,3-cra40,4-ncep) */ @TableField(value = "data_source") private Integer dataSource; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskChildMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskChildMapper.java new file mode 100644 index 0000000..6ed0e2d --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskChildMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.TransportTaskChild; + +public interface TransportTaskChildMapper extends BaseMapper { +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskLogMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskLogMapper.java new file mode 100644 index 0000000..1162ea9 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskLogMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.TransportTaskLog; + +public interface TransportTaskLogMapper extends BaseMapper { + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskMapper.java new file mode 100644 index 0000000..c2b6730 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/TransportTaskMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.TransportTask; + +public interface TransportTaskMapper extends BaseMapper { +} diff --git a/jeecg-module-source-rebuild/src/main/java/org/jeecg/service/impl/SourceRebuildTaskServiceImpl.java b/jeecg-module-source-rebuild/src/main/java/org/jeecg/service/impl/SourceRebuildTaskServiceImpl.java index 5fa0001..f408161 100644 --- a/jeecg-module-source-rebuild/src/main/java/org/jeecg/service/impl/SourceRebuildTaskServiceImpl.java +++ b/jeecg-module-source-rebuild/src/main/java/org/jeecg/service/impl/SourceRebuildTaskServiceImpl.java @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.constant.enums.SourceRebuildTaskStatusEnum; -import org.jeecg.common.properties.SourceRebuildParams; +import org.jeecg.common.properties.SourceRebuildProperties; import org.jeecg.common.properties.SystemStorageProperties; import org.jeecg.common.system.query.PageRequest; import org.jeecg.modules.base.entity.SourceRebuildMonitoringData; @@ -39,7 +39,7 @@ public class SourceRebuildTaskServiceImpl extends ServiceImpl taskMonitoringDatas; private SourceRebuildTaskLogService sourceRebuildTaskLogService; private SourceRebuildTask sourceRebuildTask; - private SourceRebuildParams sourceRebuildParams; + private SourceRebuildProperties sourceRebuildProperties; private SourceRebuildTaskService sourceRebuildTaskService; /** * 初始化 */ - public void init(SystemStorageProperties systemStorageProperties, - List taskMonitoringDatas, + public void init(List taskMonitoringDatas, SourceRebuildTask sourceRebuildTask, SourceRebuildTaskLogService sourceRebuildTaskLogService, - SourceRebuildParams sourceRebuildParams, + SourceRebuildProperties sourceRebuildProperties, SourceRebuildTaskService sourceRebuildTaskService){ - this.systemStorageProperties = systemStorageProperties; this.taskMonitoringDatas = taskMonitoringDatas; this.sourceRebuildTask = sourceRebuildTask; this.sourceRebuildTaskLogService = sourceRebuildTaskLogService; - this.sourceRebuildParams = sourceRebuildParams; + this.sourceRebuildProperties = sourceRebuildProperties; this.sourceRebuildTaskService = sourceRebuildTaskService; } @@ -129,7 +125,6 @@ public class SourceRebuildTaskExec extends Thread{ lines.add(formattedLine); //把监测数据详情保存到日志 this.generateLog(formattedLine); - } FileUtil.writeLines(lines,inputSubexp1,"UTF-8"); } @@ -146,7 +141,7 @@ public class SourceRebuildTaskExec extends Thread{ Path dirpath = Paths.get(srsFilePath); try(Stream walk = Files.walk(dirpath)) { walk.filter(Files::isRegularFile) - .filter(path -> path.toAbsolutePath().toString().contains(systemStorageProperties.getXeGZFileDirSign())) + .filter(path -> path.toAbsolutePath().toString().contains(sourceRebuildProperties.getXeGZFileDirSign())) .forEach(filePath -> { //USX77.fp.2024112115.f9.srm String[] nameArr = filePath.getFileName().toString().split("\\."); @@ -212,8 +207,8 @@ public class SourceRebuildTaskExec extends Thread{ private void execSourceRebuild(){ RConnection conn = null; try { - conn = new RConnection(this.sourceRebuildParams.getServerAddr(), this.sourceRebuildParams.getPort()); - conn.login(this.sourceRebuildParams.getUsername(), this.sourceRebuildParams.getPassword()); + conn = new RConnection(this.sourceRebuildProperties.getServerAddr(), this.sourceRebuildProperties.getPort()); + conn.login(this.sourceRebuildProperties.getUsername(), this.sourceRebuildProperties.getPassword()); if(conn.isConnected()){ String log = "Rserve 连接成功,设置运行参数"; this.generateLog(log); @@ -225,11 +220,11 @@ public class SourceRebuildTaskExec extends Thread{ //重建任务输出数据目录 conn.assign("outbasedir", this.getOutputPath()); //数据库相关 - conn.assign("dbHost", "192.168.42.54"); - conn.assign("dbPort", new REXPInteger(5432)); - conn.assign("dbName", "stas"); - conn.assign("dbUser", "stas"); - conn.assign("dbPassword", "123456"); + conn.assign("dbHost", this.sourceRebuildProperties.getDbHost()); + conn.assign("dbPort", new REXPInteger(this.sourceRebuildProperties.getDbPort())); + conn.assign("dbName", this.sourceRebuildProperties.getDbName()); + conn.assign("dbUser", this.sourceRebuildProperties.getUsername()); + conn.assign("dbPassword", this.sourceRebuildProperties.getPassword()); //任务关联ID conn.assign("taskId", this.sourceRebuildTask.getId().toString()); //半衰期 @@ -270,10 +265,10 @@ public class SourceRebuildTaskExec extends Thread{ conn.eval("trueValues <- c(NA,NA,NA,NA,NA)"); } //设置工作目录 - conn.eval("setwd(\""+this.sourceRebuildParams.getWorkSpace()+"\")"); + conn.eval("setwd(\""+this.sourceRebuildProperties.getWorkSpace()+"\")"); //执行脚本 - conn.eval("source(\"test_case/expdir/set_up.R\")"); - REXP outputREXP = conn.eval("capture.output({source(\"test_case/expdir/main.R\")})"); + conn.eval("source(\"R_scripts/set_up.R\")"); + REXP outputREXP = conn.eval("capture.output({source(\"R_scripts/main.R\")})"); // 将输出作为字符串数组获取 String[] outputLines = outputREXP.asStrings(); if(ArrayUtil.isNotEmpty(outputLines)){ @@ -322,9 +317,7 @@ public class SourceRebuildTaskExec extends Thread{ */ private String getInputPath(){ StringBuilder inputPath = new StringBuilder(); - inputPath.append(systemStorageProperties.getRootPath()); - inputPath.append("/"); - inputPath.append(systemStorageProperties.getRInput()); + inputPath.append(sourceRebuildProperties.getRInput()); if(!FileUtil.exist(inputPath.toString())){ FileUtil.mkdir(inputPath.toString()); } @@ -337,9 +330,7 @@ public class SourceRebuildTaskExec extends Thread{ */ private String getSRSFilePath(){ StringBuilder srsFilePath = new StringBuilder(); - srsFilePath.append(systemStorageProperties.getRootPath()); - srsFilePath.append("/"); - srsFilePath.append(systemStorageProperties.getSrsFilePath()); + srsFilePath.append(sourceRebuildProperties.getSrsFilePath()); // if(!FileUtil.exist(srsFilePath.toString())){ // String srsNotExistLog = "SRS 文件存储目录不存在"; // throw new RuntimeException(srsNotExistLog); @@ -353,9 +344,7 @@ public class SourceRebuildTaskExec extends Thread{ */ private String getOutputPath(){ StringBuilder outputPath = new StringBuilder(); - outputPath.append(systemStorageProperties.getRootPath()); - outputPath.append("/"); - outputPath.append(systemStorageProperties.getROutput()); + outputPath.append(sourceRebuildProperties.getROutput()); outputPath.append("/"); outputPath.append(sourceRebuildTask.getTaskName()); if(!FileUtil.exist(outputPath.toString())){ diff --git a/jeecg-module-transport/pom.xml b/jeecg-module-transport/pom.xml new file mode 100644 index 0000000..979cee4 --- /dev/null +++ b/jeecg-module-transport/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-boot-parent + 3.8.1 + + + jeecg-module-transport + + + 17 + 17 + UTF-8 + + + + + org.jeecgframework.boot + jeecg-boot-base-core + ${jeecgboot.version} + + + \ No newline at end of file diff --git a/jeecg-module-transport/src/main/java/org/jeecg/controller/TransportTaskController.java b/jeecg-module-transport/src/main/java/org/jeecg/controller/TransportTaskController.java new file mode 100644 index 0000000..f5c0c85 --- /dev/null +++ b/jeecg-module-transport/src/main/java/org/jeecg/controller/TransportTaskController.java @@ -0,0 +1,87 @@ +package org.jeecg.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.query.PageRequest; +import org.jeecg.common.validgroup.InsertGroup; +import org.jeecg.common.validgroup.UpdateGroup; +import org.jeecg.modules.base.entity.TransportTask; +import org.jeecg.service.TransportTaskService; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import java.time.LocalDate; +import java.util.HashMap; +import java.util.Map; + +@Validated +@RestController +@RequestMapping("transportTask") +@RequiredArgsConstructor +public class TransportTaskController { + + private final TransportTaskService transportTaskService; + + @AutoLog(value = "分页查询输运任务数据") + @Operation(summary = "分页查询输运任务数据") + @GetMapping("page") + public Result page(PageRequest pageRequest, String taskName, Integer taskMode,Integer taskStatus, + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate, + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate) { + IPage page = transportTaskService.page(pageRequest,taskName,taskMode,taskStatus,startDate,endDate); + Map rspData = new HashMap<>(); + rspData.put("rows", page.getRecords()); + rspData.put("total", page.getTotal()); + return Result.OK(rspData); + } + + @AutoLog(value = "新增输运任务") + @Operation(summary = "新增输运任务") + @PostMapping("create") + public Result create(@RequestBody @Validated(value = InsertGroup.class) TransportTask transportTask){ + transportTaskService.cteate(transportTask); + return Result.OK(); + } + + @AutoLog(value = "获取单条输运任务记录") + @Operation(summary = "获取单条输运任务记录") + @GetMapping("getById") + public Result getTransportTaskById(@NotNull(message = "ID不能为空") Integer id){ + return Result.OK(transportTaskService.getTransportTaskById(id)); + } + + @AutoLog(value = "修改输运任务") + @Operation(summary = "修改输运任务") + @PutMapping("update") + public Result update(@RequestBody @Validated(value = UpdateGroup.class) TransportTask transportTask){ + transportTaskService.update(transportTask); + return Result.OK(); + } + + @AutoLog(value = "删除输运任务") + @Operation(summary = "删除输运任务") + @DeleteMapping("delete") + public Result delete(@NotNull(message = "id不能为空") Integer id){ + transportTaskService.delete(id); + return Result.OK(); + } + + @AutoLog(value = "获取输运任务日志") + @Operation(summary = "获取输运任务日志") + @GetMapping("getTaskLog") + public Result getTaskLog(@NotNull(message = "任务ID不能为空") Integer taskId){ + return Result.OK(transportTaskService.getTaskLog(taskId)); + } + + @AutoLog(value = "启动任务") + @Operation(summary = "启动任务") + @PutMapping("runTask") + public Result runTask(@NotNull(message = "任务ID不能为空") Integer taskId){ + transportTaskService.runTask(taskId); + return Result.OK(); + } +} diff --git a/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskResultService.java b/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskResultService.java new file mode 100644 index 0000000..a7812ad --- /dev/null +++ b/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskResultService.java @@ -0,0 +1,10 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.TransportTask; + +/** + * 传输任务结果数据 + */ +public interface TransportTaskResultService extends IService { +} diff --git a/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskService.java b/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskService.java new file mode 100644 index 0000000..63ab1a8 --- /dev/null +++ b/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskService.java @@ -0,0 +1,65 @@ +package org.jeecg.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.system.query.PageRequest; +import org.jeecg.modules.base.entity.TransportTask; +import org.jeecg.modules.base.entity.TransportTaskLog; +import java.time.LocalDate; +import java.util.List; + +/** + * 输运模拟任务管理 + */ +public interface TransportTaskService extends IService { + + /** + * 分页查询任务列表 + * @param pageRequest + * @param taskName + * @param taskMode + * @param taskStatus + * @param startDate + * @param endDate + * @return + */ + IPage page(PageRequest pageRequest,String taskName,Integer taskMode,Integer taskStatus,LocalDate startDate,LocalDate endDate); + + /** + * 创建输运模拟任务 + * @param transportTask + */ + void cteate(TransportTask transportTask); + + /** + * 获取单条任务数据 + * @param id + * @return + */ + TransportTask getTransportTaskById(Integer id); + + /** + * 修改输运模拟任务 + * @param transportTask + */ + void update(TransportTask transportTask); + + /** + * 删除输运模拟任务 + * @param id + */ + void delete(Integer id); + + /** + * 运行任务 + * @param id + */ + void runTask(Integer id); + + /** + * 获取任务运行日志 + * @param taskId + * @return + */ + List getTaskLog(Integer taskId); +} diff --git a/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskServiceImpl.java b/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskServiceImpl.java new file mode 100644 index 0000000..6766d14 --- /dev/null +++ b/jeecg-module-transport/src/main/java/org/jeecg/service/TransportTaskServiceImpl.java @@ -0,0 +1,181 @@ +package org.jeecg.service; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.constant.enums.TransportTaskStatusEnum; +import org.jeecg.common.constant.enums.TransportTaskTypeEnum; +import org.jeecg.common.system.query.PageRequest; +import org.jeecg.modules.base.entity.TransportTask; +import org.jeecg.modules.base.entity.TransportTaskChild; +import org.jeecg.modules.base.entity.TransportTaskLog; +import org.jeecg.modules.base.mapper.TransportTaskChildMapper; +import org.jeecg.modules.base.mapper.TransportTaskLogMapper; +import org.jeecg.modules.base.mapper.TransportTaskMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * 输运模拟任务管理 + */ +@RequiredArgsConstructor +@Service +public class TransportTaskServiceImpl extends ServiceImpl implements TransportTaskService{ + + private final TransportTaskChildMapper transportTaskChildMapper; + private final TransportTaskLogMapper transportTaskLogMapper; + + /** + * 分页查询任务列表 + * + * @param pageRequest + * @param taskName + * @param taskMode + * @param taskStatus + * @param startDate + * @param endDate + * @return + */ + @Override + public IPage page(PageRequest pageRequest, String taskName, Integer taskMode,Integer taskStatus, LocalDate startDate, LocalDate endDate) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Objects.nonNull(taskMode),TransportTask::getTaskMode, taskMode); + queryWrapper.eq(Objects.nonNull(taskStatus),TransportTask::getTaskStatus, taskStatus); + if(Objects.nonNull(startDate) && Objects.nonNull(endDate)){ + LocalDateTime startDateTime = startDate.atTime(0, 0, 0); + LocalDateTime endDateTime = endDate.atTime(23, 59, 59); + queryWrapper.between(TransportTask::getCreateTime,startDateTime,endDateTime); + } + queryWrapper.like(StringUtils.isNotBlank(taskName),TransportTask::getTaskName,taskName); + queryWrapper.orderByDesc(TransportTask::getCreateTime); + queryWrapper.orderByAsc(TransportTask::getTaskStatus); + IPage iPage = new Page<>(pageRequest.getPageNum(), pageRequest.getPageSize()); + return this.page(iPage, queryWrapper); + } + + /** + * 创建输运模拟任务 + * + * @param transportTask + */ + @Transactional(rollbackFor = RuntimeException.class) + @Override + public void cteate(TransportTask transportTask) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TransportTask::getTaskName,transportTask.getTaskName()); + TransportTask checkNameResult = this.baseMapper.selectOne(queryWrapper); + if(Objects.nonNull(checkNameResult)){ + throw new RuntimeException("此任务已存在,请核对任务名称信息"); + } + transportTask.setTaskPprogress(0); + transportTask.setTaskStatus(TransportTaskStatusEnum.NOT_START.getKey()); + transportTask.setTaskType(TransportTaskTypeEnum.MANUALLY.getKey()); + this.baseMapper.insert(transportTask); + if(CollUtil.isNotEmpty(transportTask.getChildList())){ + transportTask.getChildList().forEach(transportTaskChild -> { + transportTaskChild.setTaskId(transportTask.getId()); + }); + transportTaskChildMapper.insert(transportTask.getChildList()); + } + } + + /** + * 获取单条任务数据 + * + * @param id + * @return + */ + @Override + public TransportTask getTransportTaskById(Integer id) { + TransportTask transportTask = this.baseMapper.selectById(id); + if(Objects.isNull(transportTask)){ + throw new RuntimeException("此任务不存在"); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TransportTaskChild::getTaskId,transportTask.getId()); + List transportTaskChildren = transportTaskChildMapper.selectList(queryWrapper); + if(CollUtil.isNotEmpty(transportTaskChildren)){ + transportTask.setChildList(transportTaskChildren); + } + return transportTask; + } + + /** + * 修改输运模拟任务 + * + * @param transportTask + */ + @Transactional(rollbackFor = RuntimeException.class) + @Override + public void update(TransportTask transportTask) { + TransportTask checkIdResult = this.baseMapper.selectById(transportTask.getId()); + if(Objects.isNull(checkIdResult)){ + throw new RuntimeException("此任务不存在"); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TransportTask::getTaskName,transportTask.getTaskName()); + TransportTask checkNameResult = this.baseMapper.selectOne(queryWrapper); + if(Objects.nonNull(checkNameResult) && !checkNameResult.getId().equals(checkIdResult.getId())){ + throw new RuntimeException("此任务已存在,请核对任务名称信息"); + } + checkIdResult.setTaskName(transportTask.getTaskName()); + checkIdResult.setTaskMode(transportTask.getTaskMode()); + this.baseMapper.updateById(checkIdResult); + //先删除再保存 + LambdaQueryWrapper delQueryWrapper = new LambdaQueryWrapper<>(); + delQueryWrapper.eq(TransportTaskChild::getTaskId,checkIdResult.getId()); + transportTaskChildMapper.delete(delQueryWrapper); + if(CollUtil.isNotEmpty(transportTask.getChildList())){ + transportTask.getChildList().forEach(transportTaskChild -> { + transportTaskChild.setTaskId(transportTask.getId()); + }); + transportTaskChildMapper.insert(transportTask.getChildList()); + } + } + + /** + * 删除输运模拟任务 + * + * @param id + */ + @Transactional(rollbackFor = RuntimeException.class) + @Override + public void delete(Integer id) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TransportTaskChild::getTaskId,id); + transportTaskChildMapper.delete(queryWrapper); + this.baseMapper.deleteById(id); + } + + /** + * 运行任务 + * + * @param id + */ + @Transactional(rollbackFor = RuntimeException.class) + @Override + public void runTask(Integer id) { + + } + + /** + * 获取任务运行日志 + * + * @param taskId + * @return + */ + @Override + public List getTaskLog(Integer taskId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TransportTaskLog::getTaskId,taskId); + return transportTaskLogMapper.selectList(queryWrapper); + } +} diff --git a/jeecg-module-weather/src/main/java/org/jeecg/controller/WeatherDataController.java b/jeecg-module-weather/src/main/java/org/jeecg/controller/WeatherDataController.java index ee21e2c..e70f3c9 100644 --- a/jeecg-module-weather/src/main/java/org/jeecg/controller/WeatherDataController.java +++ b/jeecg-module-weather/src/main/java/org/jeecg/controller/WeatherDataController.java @@ -82,7 +82,7 @@ public class WeatherDataController { @GetMapping(value = "getWeatherData") public Result getWeatherData(Integer dataType, Integer weatherType, - LocalDateTime startTime, + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime, int hour) { return Result.OK(weatherDataService.getWeatherData(dataType, weatherType, startTime, hour)); } @@ -93,9 +93,8 @@ public class WeatherDataController { */ @AutoLog(value = "气象预测-气象预览") @Operation(summary = "气象预测-气象预览") - @GetMapping(value = "getWeatherData") - public Result getWeatherDataPreview(String weatherId, - @RequestParam(required = false, defaultValue = "0")Integer weatherType) { + @GetMapping(value = "getWeatherDataPreview") + public Result getWeatherDataPreview(String weatherId,Integer weatherType) { return Result.OK(weatherDataService.getWeatherDataPreview(weatherId, weatherType)); } @@ -106,7 +105,7 @@ public class WeatherDataController { @AutoLog(value = "气象预测-气象折线图") @Operation(summary = "气象预测-气象折线图") @GetMapping(value = "getDataLine") - public Result getDataLine(Integer dataType,LocalDateTime startTime, LocalDateTime endTime, double longitude, double latitude) { + public Result getDataLine(Integer dataType,@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime, double longitude, double latitude) { return Result.OK(weatherDataService.getDataLine(dataType,startTime,endTime,longitude,latitude)); } @@ -126,7 +125,7 @@ public class WeatherDataController { public static void main(String[] args) { //reftime_ISO - String filePath = "F:\\工作\\五木\\放射性核素监测数据综合分析及氙本底源解析系统\\其他资料\\气象数据\\盘古模型预测数据\\panguweather_2025073118.grib"; + String filePath = "E:\\runtimeEnv\\fileSystem\\weather\\pangu1\\panguweather_2025073118.grib"; try { String md5 = calculateMD5(filePath); System.out.println("MD5: " + md5); diff --git a/jeecg-module-weather/src/main/java/org/jeecg/service/impl/WeatherDataServiceImpl.java b/jeecg-module-weather/src/main/java/org/jeecg/service/impl/WeatherDataServiceImpl.java index 6aaf7bc..d0e728d 100644 --- a/jeecg-module-weather/src/main/java/org/jeecg/service/impl/WeatherDataServiceImpl.java +++ b/jeecg-module-weather/src/main/java/org/jeecg/service/impl/WeatherDataServiceImpl.java @@ -310,13 +310,12 @@ public class WeatherDataServiceImpl extends ServiceImpl0){ //获取文件数据开始日期 -// String reftime = "2025-10-16 00:00:00";//NcUtil.getReftime(dataFile.getAbsolutePath()); -// if(StringUtils.isBlank(reftime)) { -// throw new JeecgFileUploadException("解析气象文件起始时间数据异常,此文件可能损坏"); -// } -// Instant instant = Instant.parse(reftime); -// LocalDateTime utcDateTime = LocalDateTime.ofInstant(instant, ZoneId.of("UTC")); - LocalDateTime utcDateTime = LocalDateTime.now(); + String reftime = NcUtil.getReftime(dataFile.getAbsolutePath()); + if(StringUtils.isBlank(reftime)) { + throw new JeecgFileUploadException("解析气象文件起始时间数据异常,此文件可能损坏"); + } + Instant instant = Instant.parse(reftime); + LocalDateTime utcDateTime = LocalDateTime.ofInstant(instant, ZoneId.of("UTC")); queryResult.setDataStartTime(utcDateTime); //计算文件大小M BigDecimal divideVal = new BigDecimal("1024"); @@ -347,6 +346,7 @@ public class WeatherDataServiceImpl extends ServiceImpl + stas-cloud-gateway org.springframework.boot diff --git a/jeecg-server-cloud/jeecg-cloud-nacos/pom.xml b/jeecg-server-cloud/jeecg-cloud-nacos/pom.xml index cc51c6b..cdb09eb 100644 --- a/jeecg-server-cloud/jeecg-cloud-nacos/pom.xml +++ b/jeecg-server-cloud/jeecg-cloud-nacos/pom.xml @@ -94,6 +94,7 @@ + stas-cloud-nacos org.springframework.boot diff --git a/jeecg-server-cloud/jeecg-data-analyze-start/pom.xml b/jeecg-server-cloud/jeecg-data-analyze-start/pom.xml index 81b0ac2..55b22f5 100644 --- a/jeecg-server-cloud/jeecg-data-analyze-start/pom.xml +++ b/jeecg-server-cloud/jeecg-data-analyze-start/pom.xml @@ -33,4 +33,13 @@ ${jeecgboot.version} + + stas-cloud-data-analyze + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-event-start/pom.xml b/jeecg-server-cloud/jeecg-event-start/pom.xml index d60c72e..0c41080 100644 --- a/jeecg-server-cloud/jeecg-event-start/pom.xml +++ b/jeecg-server-cloud/jeecg-event-start/pom.xml @@ -33,4 +33,13 @@ ${jeecgboot.version} + + stas-cloud-event-simulation + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-source-rebuild-start/pom.xml b/jeecg-server-cloud/jeecg-source-rebuild-start/pom.xml index 993f0da..cca3162 100644 --- a/jeecg-server-cloud/jeecg-source-rebuild-start/pom.xml +++ b/jeecg-server-cloud/jeecg-source-rebuild-start/pom.xml @@ -33,4 +33,13 @@ ${jeecgboot.version} + + stas-cloud-source-rebuild + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-sync-start/pom.xml b/jeecg-server-cloud/jeecg-sync-start/pom.xml index 8d95bb5..d6283e8 100644 --- a/jeecg-server-cloud/jeecg-sync-start/pom.xml +++ b/jeecg-server-cloud/jeecg-sync-start/pom.xml @@ -33,4 +33,13 @@ ${jeecgboot.version} + + stas-cloud-data-sync + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml b/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml index 33a004e..9883f62 100644 --- a/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml +++ b/jeecg-server-cloud/jeecg-system-cloud-start/pom.xml @@ -65,6 +65,7 @@ + stas-cloud-system org.springframework.boot diff --git a/jeecg-server-cloud/jeecg-transport-start/pom.xml b/jeecg-server-cloud/jeecg-transport-start/pom.xml new file mode 100644 index 0000000..70fe382 --- /dev/null +++ b/jeecg-server-cloud/jeecg-transport-start/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + org.jeecgframework.boot + jeecg-server-cloud + 3.8.1 + + + jeecg-transport-start + + + 17 + 17 + UTF-8 + + + + + org.jeecgframework.boot + jeecg-boot-starter3-cloud + + + org.jeecgframework.boot + jeecg-system-cloud-api + ${jeecgboot.version} + + + org.jeecgframework.boot + jeecg-module-transport + ${jeecgboot.version} + + + + stas-cloud-transport-simulation + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-transport-start/src/main/java/org/jeecg/JeecgTransportCloudApplication.java b/jeecg-server-cloud/jeecg-transport-start/src/main/java/org/jeecg/JeecgTransportCloudApplication.java new file mode 100644 index 0000000..12b16ef --- /dev/null +++ b/jeecg-server-cloud/jeecg-transport-start/src/main/java/org/jeecg/JeecgTransportCloudApplication.java @@ -0,0 +1,56 @@ +package org.jeecg; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.base.BaseMap; +import org.jeecg.common.constant.GlobalConstants; +import org.jeecg.common.util.oConvertUtils; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.data.redis.core.RedisTemplate; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +@Slf4j +@SpringBootApplication +@RequiredArgsConstructor +@EnableFeignClients +public class JeecgTransportCloudApplication extends SpringBootServletInitializer implements CommandLineRunner { + + private final RedisTemplate redisTemplate; + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(JeecgTransportCloudApplication.class); + } + + public static void main(String[] args) throws UnknownHostException { + ConfigurableApplicationContext application = SpringApplication.run(JeecgTransportCloudApplication.class, args); + Environment env = application.getEnvironment(); + String ip = InetAddress.getLocalHost().getHostAddress(); + String port = env.getProperty("server.port"); + String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); + log.info("\n----------------------------------------------------------\n\t" + + "Application STAS-Transport is running! Access URLs:\n\t" + + "Local: \t\thttp://localhost:" + port + path + "/doc.html\n" + + "External: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + + "----------------------------------------------------------"); + + } + + @Override + public void run(String... args) { + BaseMap params = new BaseMap(); + params.put(GlobalConstants.HANDLER_NAME, GlobalConstants.LODER_ROUDER_HANDLER); + //刷新网关 + redisTemplate.convertAndSend(GlobalConstants.REDIS_TOPIC_NAME, params); + } +} \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-transport-start/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-transport-start/src/main/resources/application.yml new file mode 100644 index 0000000..38308fe --- /dev/null +++ b/jeecg-server-cloud/jeecg-transport-start/src/main/resources/application.yml @@ -0,0 +1,24 @@ +server: + port: 8006 + +spring: + application: + name: jeecg-transport + cloud: + nacos: + config: + server-addr: @config.server-addr@ + group: @config.group@ + namespace: @config.namespace@ + username: @config.username@ + password: @config.password@ + discovery: + server-addr: ${spring.cloud.nacos.config.server-addr} + group: @config.group@ + namespace: @config.namespace@ + username: @config.username@ + password: @config.password@ + config: + import: + - optional:nacos:jeecg.yaml + - optional:nacos:jeecg-@profile.name@.yaml \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-transport-start/src/main/resources/logback-spring.xml b/jeecg-server-cloud/jeecg-transport-start/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..4faab6c --- /dev/null +++ b/jeecg-server-cloud/jeecg-transport-start/src/main/resources/logback-spring.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n + + + + + + + + ${LOG_HOME}/stas-transport-%d{yyyy-MM-dd}.%i.log + + 30 + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-server-cloud/jeecg-weather-start/pom.xml b/jeecg-server-cloud/jeecg-weather-start/pom.xml index 4098a22..8357431 100644 --- a/jeecg-server-cloud/jeecg-weather-start/pom.xml +++ b/jeecg-server-cloud/jeecg-weather-start/pom.xml @@ -33,4 +33,13 @@ ${jeecgboot.version} + + stas-cloud-weather + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/jeecg-server-cloud/pom.xml b/jeecg-server-cloud/pom.xml index 27cc7d9..06673c7 100644 --- a/jeecg-server-cloud/pom.xml +++ b/jeecg-server-cloud/pom.xml @@ -25,6 +25,7 @@ jeecg-sync-start jeecg-data-analyze-start jeecg-source-rebuild-start + jeecg-transport-start \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1a33da6..f4cba04 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,8 @@ jeecg-module-sync jeecg-module-data-analyze jeecg-module-source-rebuild - + jeecg-module-transport +