1.修改天气预报功能
2.编写输运模拟基本功能 3.修改所有服务打包策略 4.修改源项重建接口
This commit is contained in:
parent
d5fabebe84
commit
faddfbd223
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,21 +6,21 @@ package org.jeecg.common.constant.enums;
|
||||||
public enum WeatherVariableNameEnum {
|
public enum WeatherVariableNameEnum {
|
||||||
|
|
||||||
|
|
||||||
PANGU_T(0, 0, "Temperature_height_above_ground"),
|
PANGU_T(1, 0, "Temperature_height_above_ground"),
|
||||||
PANGU_P(0, 1, "Pressure_msl"),
|
PANGU_P(1, 1, "Pressure_msl"),
|
||||||
PANGU_H(0, 2, "Specific_humidity_isobaric"),
|
PANGU_H(1, 2, "Specific_humidity_isobaric"),
|
||||||
PANGU_U(0, 3, "u-component_of_wind_height_above_ground"),
|
PANGU_U(1, 3, "u-component_of_wind_height_above_ground"),
|
||||||
PANGU_V(0, 4, "v-component_of_wind_height_above_ground"),
|
PANGU_V(1, 4, "v-component_of_wind_height_above_ground"),
|
||||||
CRA40_T(1, 0, "Temperature_isobaric"),
|
CRA40_T(3, 0, "Temperature_isobaric"),
|
||||||
CRA40_P(1, 1, "Vertical_velocity_pressure_isobaric"),
|
CRA40_P(3, 1, "Vertical_velocity_pressure_isobaric"),
|
||||||
CRA40_H(1, 2, "Relative_humidity_isobaric"),
|
CRA40_H(3, 2, "Relative_humidity_isobaric"),
|
||||||
CRA40_U(1, 3, "u-component_of_wind_isobaric"),
|
CRA40_U(3, 3, "u-component_of_wind_isobaric"),
|
||||||
CRA40_V(1, 4, "v-component_of_wind_isobaric"),
|
CRA40_V(3, 4, "v-component_of_wind_isobaric"),
|
||||||
NCEP_T(2, 0, "Temperature_height_above_ground"),
|
NCEP_T(4, 0, "Temperature_height_above_ground"),
|
||||||
NCEP_P(2, 1, "Pressure_msl"),
|
NCEP_P(4, 1, "Pressure_msl"),
|
||||||
NCEP_H(2, 2, "Relative_humidity_height_above_ground"),
|
NCEP_H(4, 2, "Relative_humidity_height_above_ground"),
|
||||||
NCEP_U(2, 3, "u-component_of_wind_height_above_ground"),
|
NCEP_U(4, 3, "u-component_of_wind_height_above_ground"),
|
||||||
NCEP_V(2, 4, "v-component_of_wind_height_above_ground");
|
NCEP_V(4, 4, "v-component_of_wind_height_above_ground");
|
||||||
|
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -303,10 +303,11 @@ public final class NcUtil {
|
||||||
*/
|
*/
|
||||||
public static String getReftime(String filePath){
|
public static String getReftime(String filePath){
|
||||||
try (NetcdfFile ncFile = NetcdfFile.open(filePath)) {
|
try (NetcdfFile ncFile = NetcdfFile.open(filePath)) {
|
||||||
Variable variable = ncFile.findVariable("reftime_ISO");
|
Variable variable = ncFile.findVariable("reftime");
|
||||||
if (variable != null) {
|
if (variable != null) {
|
||||||
Array data = variable.read();
|
String units = variable.findAttribute("units").getStringValue();
|
||||||
return data.getObject(0).toString();
|
units = units.replace("Hour since ","");
|
||||||
|
return units;
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -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<TransportTaskChild> childList;
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ public class WeatherData implements Serializable {
|
||||||
private LocalDateTime dataStartTime;
|
private LocalDateTime dataStartTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据来源(1-盘古模型,2-graphcast,3-再分析数据)
|
* 数据来源(1-盘古模型,2-graphcast,3-cra40,4-ncep)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "data_source")
|
@TableField(value = "data_source")
|
||||||
private Integer dataSource;
|
private Integer dataSource;
|
||||||
|
|
|
||||||
|
|
@ -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<TransportTaskChild> {
|
||||||
|
}
|
||||||
|
|
@ -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<TransportTaskLog> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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<TransportTask> {
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.constant.enums.SourceRebuildTaskStatusEnum;
|
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.properties.SystemStorageProperties;
|
||||||
import org.jeecg.common.system.query.PageRequest;
|
import org.jeecg.common.system.query.PageRequest;
|
||||||
import org.jeecg.modules.base.entity.SourceRebuildMonitoringData;
|
import org.jeecg.modules.base.entity.SourceRebuildMonitoringData;
|
||||||
|
|
@ -39,7 +39,7 @@ public class SourceRebuildTaskServiceImpl extends ServiceImpl<SourceRebuildTaskM
|
||||||
private final SourceRebuildMonitoringDataService monitoringDataService;
|
private final SourceRebuildMonitoringDataService monitoringDataService;
|
||||||
private final SourceRebuildTaskLogService sourceRebuildTaskLogService;
|
private final SourceRebuildTaskLogService sourceRebuildTaskLogService;
|
||||||
private final SystemStorageProperties systemStorageProperties;
|
private final SystemStorageProperties systemStorageProperties;
|
||||||
private final SourceRebuildParams sourceRebuildParams;
|
private final SourceRebuildProperties sourceRebuildProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询任务列表
|
* 分页查询任务列表
|
||||||
|
|
@ -148,9 +148,7 @@ public class SourceRebuildTaskServiceImpl extends ServiceImpl<SourceRebuildTaskM
|
||||||
}
|
}
|
||||||
//删除结果文件
|
//删除结果文件
|
||||||
StringBuilder outputPath = new StringBuilder();
|
StringBuilder outputPath = new StringBuilder();
|
||||||
outputPath.append(systemStorageProperties.getRootPath());
|
outputPath.append(sourceRebuildProperties.getROutput());
|
||||||
outputPath.append("/");
|
|
||||||
outputPath.append(systemStorageProperties.getROutput());
|
|
||||||
outputPath.append("/");
|
outputPath.append("/");
|
||||||
outputPath.append(sourceRebuildTask.getTaskName());
|
outputPath.append(sourceRebuildTask.getTaskName());
|
||||||
if(FileUtil.exist(outputPath.toString())){
|
if(FileUtil.exist(outputPath.toString())){
|
||||||
|
|
@ -179,15 +177,15 @@ public class SourceRebuildTaskServiceImpl extends ServiceImpl<SourceRebuildTaskM
|
||||||
throw new RuntimeException("监测数据为空,请补充监测数据");
|
throw new RuntimeException("监测数据为空,请补充监测数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
// SourceRebuildTaskExec sourceRebuildTaskExec = new SourceRebuildTaskExec();
|
SourceRebuildTaskExec sourceRebuildTaskExec = new SourceRebuildTaskExec();
|
||||||
// sourceRebuildTaskExec.init(
|
sourceRebuildTaskExec.init(
|
||||||
// systemStorageProperties,
|
taskMonitoringDatas,
|
||||||
// taskMonitoringDatas,
|
sourceRebuildTask,
|
||||||
// sourceRebuildTask,
|
sourceRebuildTaskLogService,
|
||||||
// sourceRebuildTaskLogService,
|
sourceRebuildProperties,
|
||||||
// sourceRebuildParams,this);
|
this);
|
||||||
// sourceRebuildTaskExec.setName(sourceRebuildTask.getId()+"_任务执行线程");
|
sourceRebuildTaskExec.setName(sourceRebuildTask.getId()+"_任务执行线程");
|
||||||
// sourceRebuildTaskExec.start();
|
sourceRebuildTaskExec.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package org.jeecg.service.impl;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.common.properties.SourceRebuildParams;
|
import org.jeecg.common.properties.SourceRebuildProperties;
|
||||||
import org.jeecg.common.util.DownloadUtils;
|
import org.jeecg.common.util.DownloadUtils;
|
||||||
import org.jeecg.modules.base.entity.SourceRebuildTask;
|
import org.jeecg.modules.base.entity.SourceRebuildTask;
|
||||||
import org.jeecg.service.SourceRebuildTaskService;
|
import org.jeecg.service.SourceRebuildTaskService;
|
||||||
|
|
@ -15,7 +15,6 @@ import org.rosuda.REngine.RList;
|
||||||
import org.rosuda.REngine.Rserve.RConnection;
|
import org.rosuda.REngine.Rserve.RConnection;
|
||||||
import org.rosuda.REngine.Rserve.RserveException;
|
import org.rosuda.REngine.Rserve.RserveException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
@ -27,7 +26,7 @@ import java.util.*;
|
||||||
public class TaskResultDataServiceImpl implements TaskResultDataService {
|
public class TaskResultDataServiceImpl implements TaskResultDataService {
|
||||||
|
|
||||||
private final SourceRebuildTaskService sourceRebuildTaskService;
|
private final SourceRebuildTaskService sourceRebuildTaskService;
|
||||||
private final SourceRebuildParams sourceRebuildParams;
|
private final SourceRebuildProperties sourceRebuildProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Rserve连接
|
* 获取Rserve连接
|
||||||
|
|
@ -36,8 +35,8 @@ public class TaskResultDataServiceImpl implements TaskResultDataService {
|
||||||
private RConnection getRConnection(){
|
private RConnection getRConnection(){
|
||||||
RConnection conn = null;
|
RConnection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = new RConnection(sourceRebuildParams.getServerAddr(),sourceRebuildParams.getPort());
|
conn = new RConnection(sourceRebuildProperties.getServerAddr(),sourceRebuildProperties.getPort());
|
||||||
conn.login(sourceRebuildParams.getUsername(), sourceRebuildParams.getPassword());
|
conn.login(sourceRebuildProperties.getUsername(), sourceRebuildProperties.getPassword());
|
||||||
} catch (RserveException e) {
|
} catch (RserveException e) {
|
||||||
throw new RuntimeException("Rserve连接失败");
|
throw new RuntimeException("Rserve连接失败");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ import cn.hutool.core.util.ArrayUtil;
|
||||||
import org.apache.commons.lang3.time.StopWatch;
|
import org.apache.commons.lang3.time.StopWatch;
|
||||||
import org.jeecg.common.constant.enums.SourceRebuildReleaseSourceEnum;
|
import org.jeecg.common.constant.enums.SourceRebuildReleaseSourceEnum;
|
||||||
import org.jeecg.common.constant.enums.SourceRebuildTaskStatusEnum;
|
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.modules.base.entity.SourceRebuildMonitoringData;
|
import org.jeecg.modules.base.entity.SourceRebuildMonitoringData;
|
||||||
import org.jeecg.modules.base.entity.SourceRebuildTask;
|
import org.jeecg.modules.base.entity.SourceRebuildTask;
|
||||||
import org.jeecg.modules.base.entity.SourceRebuildTaskLog;
|
import org.jeecg.modules.base.entity.SourceRebuildTaskLog;
|
||||||
|
|
@ -33,27 +32,24 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
public class SourceRebuildTaskExec extends Thread{
|
public class SourceRebuildTaskExec extends Thread{
|
||||||
|
|
||||||
private SystemStorageProperties systemStorageProperties;
|
|
||||||
private List<SourceRebuildMonitoringData> taskMonitoringDatas;
|
private List<SourceRebuildMonitoringData> taskMonitoringDatas;
|
||||||
private SourceRebuildTaskLogService sourceRebuildTaskLogService;
|
private SourceRebuildTaskLogService sourceRebuildTaskLogService;
|
||||||
private SourceRebuildTask sourceRebuildTask;
|
private SourceRebuildTask sourceRebuildTask;
|
||||||
private SourceRebuildParams sourceRebuildParams;
|
private SourceRebuildProperties sourceRebuildProperties;
|
||||||
private SourceRebuildTaskService sourceRebuildTaskService;
|
private SourceRebuildTaskService sourceRebuildTaskService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化
|
* 初始化
|
||||||
*/
|
*/
|
||||||
public void init(SystemStorageProperties systemStorageProperties,
|
public void init(List<SourceRebuildMonitoringData> taskMonitoringDatas,
|
||||||
List<SourceRebuildMonitoringData> taskMonitoringDatas,
|
|
||||||
SourceRebuildTask sourceRebuildTask,
|
SourceRebuildTask sourceRebuildTask,
|
||||||
SourceRebuildTaskLogService sourceRebuildTaskLogService,
|
SourceRebuildTaskLogService sourceRebuildTaskLogService,
|
||||||
SourceRebuildParams sourceRebuildParams,
|
SourceRebuildProperties sourceRebuildProperties,
|
||||||
SourceRebuildTaskService sourceRebuildTaskService){
|
SourceRebuildTaskService sourceRebuildTaskService){
|
||||||
this.systemStorageProperties = systemStorageProperties;
|
|
||||||
this.taskMonitoringDatas = taskMonitoringDatas;
|
this.taskMonitoringDatas = taskMonitoringDatas;
|
||||||
this.sourceRebuildTask = sourceRebuildTask;
|
this.sourceRebuildTask = sourceRebuildTask;
|
||||||
this.sourceRebuildTaskLogService = sourceRebuildTaskLogService;
|
this.sourceRebuildTaskLogService = sourceRebuildTaskLogService;
|
||||||
this.sourceRebuildParams = sourceRebuildParams;
|
this.sourceRebuildProperties = sourceRebuildProperties;
|
||||||
this.sourceRebuildTaskService = sourceRebuildTaskService;
|
this.sourceRebuildTaskService = sourceRebuildTaskService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +125,6 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
lines.add(formattedLine);
|
lines.add(formattedLine);
|
||||||
//把监测数据详情保存到日志
|
//把监测数据详情保存到日志
|
||||||
this.generateLog(formattedLine);
|
this.generateLog(formattedLine);
|
||||||
|
|
||||||
}
|
}
|
||||||
FileUtil.writeLines(lines,inputSubexp1,"UTF-8");
|
FileUtil.writeLines(lines,inputSubexp1,"UTF-8");
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +141,7 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
Path dirpath = Paths.get(srsFilePath);
|
Path dirpath = Paths.get(srsFilePath);
|
||||||
try(Stream<Path> walk = Files.walk(dirpath)) {
|
try(Stream<Path> walk = Files.walk(dirpath)) {
|
||||||
walk.filter(Files::isRegularFile)
|
walk.filter(Files::isRegularFile)
|
||||||
.filter(path -> path.toAbsolutePath().toString().contains(systemStorageProperties.getXeGZFileDirSign()))
|
.filter(path -> path.toAbsolutePath().toString().contains(sourceRebuildProperties.getXeGZFileDirSign()))
|
||||||
.forEach(filePath -> {
|
.forEach(filePath -> {
|
||||||
//USX77.fp.2024112115.f9.srm
|
//USX77.fp.2024112115.f9.srm
|
||||||
String[] nameArr = filePath.getFileName().toString().split("\\.");
|
String[] nameArr = filePath.getFileName().toString().split("\\.");
|
||||||
|
|
@ -212,8 +207,8 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
private void execSourceRebuild(){
|
private void execSourceRebuild(){
|
||||||
RConnection conn = null;
|
RConnection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = new RConnection(this.sourceRebuildParams.getServerAddr(), this.sourceRebuildParams.getPort());
|
conn = new RConnection(this.sourceRebuildProperties.getServerAddr(), this.sourceRebuildProperties.getPort());
|
||||||
conn.login(this.sourceRebuildParams.getUsername(), this.sourceRebuildParams.getPassword());
|
conn.login(this.sourceRebuildProperties.getUsername(), this.sourceRebuildProperties.getPassword());
|
||||||
if(conn.isConnected()){
|
if(conn.isConnected()){
|
||||||
String log = "Rserve 连接成功,设置运行参数";
|
String log = "Rserve 连接成功,设置运行参数";
|
||||||
this.generateLog(log);
|
this.generateLog(log);
|
||||||
|
|
@ -225,11 +220,11 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
//重建任务输出数据目录
|
//重建任务输出数据目录
|
||||||
conn.assign("outbasedir", this.getOutputPath());
|
conn.assign("outbasedir", this.getOutputPath());
|
||||||
//数据库相关
|
//数据库相关
|
||||||
conn.assign("dbHost", "192.168.42.54");
|
conn.assign("dbHost", this.sourceRebuildProperties.getDbHost());
|
||||||
conn.assign("dbPort", new REXPInteger(5432));
|
conn.assign("dbPort", new REXPInteger(this.sourceRebuildProperties.getDbPort()));
|
||||||
conn.assign("dbName", "stas");
|
conn.assign("dbName", this.sourceRebuildProperties.getDbName());
|
||||||
conn.assign("dbUser", "stas");
|
conn.assign("dbUser", this.sourceRebuildProperties.getUsername());
|
||||||
conn.assign("dbPassword", "123456");
|
conn.assign("dbPassword", this.sourceRebuildProperties.getPassword());
|
||||||
//任务关联ID
|
//任务关联ID
|
||||||
conn.assign("taskId", this.sourceRebuildTask.getId().toString());
|
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("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\")");
|
conn.eval("source(\"R_scripts/set_up.R\")");
|
||||||
REXP outputREXP = conn.eval("capture.output({source(\"test_case/expdir/main.R\")})");
|
REXP outputREXP = conn.eval("capture.output({source(\"R_scripts/main.R\")})");
|
||||||
// 将输出作为字符串数组获取
|
// 将输出作为字符串数组获取
|
||||||
String[] outputLines = outputREXP.asStrings();
|
String[] outputLines = outputREXP.asStrings();
|
||||||
if(ArrayUtil.isNotEmpty(outputLines)){
|
if(ArrayUtil.isNotEmpty(outputLines)){
|
||||||
|
|
@ -322,9 +317,7 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
*/
|
*/
|
||||||
private String getInputPath(){
|
private String getInputPath(){
|
||||||
StringBuilder inputPath = new StringBuilder();
|
StringBuilder inputPath = new StringBuilder();
|
||||||
inputPath.append(systemStorageProperties.getRootPath());
|
inputPath.append(sourceRebuildProperties.getRInput());
|
||||||
inputPath.append("/");
|
|
||||||
inputPath.append(systemStorageProperties.getRInput());
|
|
||||||
if(!FileUtil.exist(inputPath.toString())){
|
if(!FileUtil.exist(inputPath.toString())){
|
||||||
FileUtil.mkdir(inputPath.toString());
|
FileUtil.mkdir(inputPath.toString());
|
||||||
}
|
}
|
||||||
|
|
@ -337,9 +330,7 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
*/
|
*/
|
||||||
private String getSRSFilePath(){
|
private String getSRSFilePath(){
|
||||||
StringBuilder srsFilePath = new StringBuilder();
|
StringBuilder srsFilePath = new StringBuilder();
|
||||||
srsFilePath.append(systemStorageProperties.getRootPath());
|
srsFilePath.append(sourceRebuildProperties.getSrsFilePath());
|
||||||
srsFilePath.append("/");
|
|
||||||
srsFilePath.append(systemStorageProperties.getSrsFilePath());
|
|
||||||
// if(!FileUtil.exist(srsFilePath.toString())){
|
// if(!FileUtil.exist(srsFilePath.toString())){
|
||||||
// String srsNotExistLog = "SRS 文件存储目录不存在";
|
// String srsNotExistLog = "SRS 文件存储目录不存在";
|
||||||
// throw new RuntimeException(srsNotExistLog);
|
// throw new RuntimeException(srsNotExistLog);
|
||||||
|
|
@ -353,9 +344,7 @@ public class SourceRebuildTaskExec extends Thread{
|
||||||
*/
|
*/
|
||||||
private String getOutputPath(){
|
private String getOutputPath(){
|
||||||
StringBuilder outputPath = new StringBuilder();
|
StringBuilder outputPath = new StringBuilder();
|
||||||
outputPath.append(systemStorageProperties.getRootPath());
|
outputPath.append(sourceRebuildProperties.getROutput());
|
||||||
outputPath.append("/");
|
|
||||||
outputPath.append(systemStorageProperties.getROutput());
|
|
||||||
outputPath.append("/");
|
outputPath.append("/");
|
||||||
outputPath.append(sourceRebuildTask.getTaskName());
|
outputPath.append(sourceRebuildTask.getTaskName());
|
||||||
if(!FileUtil.exist(outputPath.toString())){
|
if(!FileUtil.exist(outputPath.toString())){
|
||||||
|
|
|
||||||
27
jeecg-module-transport/pom.xml
Normal file
27
jeecg-module-transport/pom.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-parent</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>jeecg-module-transport</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-base-core</artifactId>
|
||||||
|
<version>${jeecgboot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
|
@ -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<TransportTask> page = transportTaskService.page(pageRequest,taskName,taskMode,taskStatus,startDate,endDate);
|
||||||
|
Map<String, Object> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<TransportTask> {
|
||||||
|
}
|
||||||
|
|
@ -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<TransportTask> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询任务列表
|
||||||
|
* @param pageRequest
|
||||||
|
* @param taskName
|
||||||
|
* @param taskMode
|
||||||
|
* @param taskStatus
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<TransportTask> 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<TransportTaskLog> getTaskLog(Integer taskId);
|
||||||
|
}
|
||||||
|
|
@ -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<TransportTaskMapper,TransportTask> 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<TransportTask> page(PageRequest pageRequest, String taskName, Integer taskMode,Integer taskStatus, LocalDate startDate, LocalDate endDate) {
|
||||||
|
LambdaQueryWrapper<TransportTask> 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<TransportTask> 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<TransportTask> 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<TransportTaskChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(TransportTaskChild::getTaskId,transportTask.getId());
|
||||||
|
List<TransportTaskChild> 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<TransportTask> 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<TransportTaskChild> 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<TransportTaskChild> 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<TransportTaskLog> getTaskLog(Integer taskId) {
|
||||||
|
LambdaQueryWrapper<TransportTaskLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(TransportTaskLog::getTaskId,taskId);
|
||||||
|
return transportTaskLogMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ public class WeatherDataController {
|
||||||
@GetMapping(value = "getWeatherData")
|
@GetMapping(value = "getWeatherData")
|
||||||
public Result<?> getWeatherData(Integer dataType,
|
public Result<?> getWeatherData(Integer dataType,
|
||||||
Integer weatherType,
|
Integer weatherType,
|
||||||
LocalDateTime startTime,
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
||||||
int hour) {
|
int hour) {
|
||||||
return Result.OK(weatherDataService.getWeatherData(dataType, weatherType, startTime, hour));
|
return Result.OK(weatherDataService.getWeatherData(dataType, weatherType, startTime, hour));
|
||||||
}
|
}
|
||||||
|
|
@ -93,9 +93,8 @@ public class WeatherDataController {
|
||||||
*/
|
*/
|
||||||
@AutoLog(value = "气象预测-气象预览")
|
@AutoLog(value = "气象预测-气象预览")
|
||||||
@Operation(summary = "气象预测-气象预览")
|
@Operation(summary = "气象预测-气象预览")
|
||||||
@GetMapping(value = "getWeatherData")
|
@GetMapping(value = "getWeatherDataPreview")
|
||||||
public Result<?> getWeatherDataPreview(String weatherId,
|
public Result<?> getWeatherDataPreview(String weatherId,Integer weatherType) {
|
||||||
@RequestParam(required = false, defaultValue = "0")Integer weatherType) {
|
|
||||||
return Result.OK(weatherDataService.getWeatherDataPreview(weatherId, weatherType));
|
return Result.OK(weatherDataService.getWeatherDataPreview(weatherId, weatherType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +105,7 @@ public class WeatherDataController {
|
||||||
@AutoLog(value = "气象预测-气象折线图")
|
@AutoLog(value = "气象预测-气象折线图")
|
||||||
@Operation(summary = "气象预测-气象折线图")
|
@Operation(summary = "气象预测-气象折线图")
|
||||||
@GetMapping(value = "getDataLine")
|
@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));
|
return Result.OK(weatherDataService.getDataLine(dataType,startTime,endTime,longitude,latitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,7 +125,7 @@ public class WeatherDataController {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
//reftime_ISO
|
//reftime_ISO
|
||||||
String filePath = "F:\\工作\\五木\\放射性核素监测数据综合分析及氙本底源解析系统\\其他资料\\气象数据\\盘古模型预测数据\\panguweather_2025073118.grib";
|
String filePath = "E:\\runtimeEnv\\fileSystem\\weather\\pangu1\\panguweather_2025073118.grib";
|
||||||
try {
|
try {
|
||||||
String md5 = calculateMD5(filePath);
|
String md5 = calculateMD5(filePath);
|
||||||
System.out.println("MD5: " + md5);
|
System.out.println("MD5: " + md5);
|
||||||
|
|
|
||||||
|
|
@ -310,13 +310,12 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
|
||||||
File dataFile = new File(storagePath);
|
File dataFile = new File(storagePath);
|
||||||
if(dataFile.exists() && dataFile.length()>0){
|
if(dataFile.exists() && dataFile.length()>0){
|
||||||
//获取文件数据开始日期
|
//获取文件数据开始日期
|
||||||
// String reftime = "2025-10-16 00:00:00";//NcUtil.getReftime(dataFile.getAbsolutePath());
|
String reftime = NcUtil.getReftime(dataFile.getAbsolutePath());
|
||||||
// if(StringUtils.isBlank(reftime)) {
|
if(StringUtils.isBlank(reftime)) {
|
||||||
// throw new JeecgFileUploadException("解析气象文件起始时间数据异常,此文件可能损坏");
|
throw new JeecgFileUploadException("解析气象文件起始时间数据异常,此文件可能损坏");
|
||||||
// }
|
}
|
||||||
// Instant instant = Instant.parse(reftime);
|
Instant instant = Instant.parse(reftime);
|
||||||
// LocalDateTime utcDateTime = LocalDateTime.ofInstant(instant, ZoneId.of("UTC"));
|
LocalDateTime utcDateTime = LocalDateTime.ofInstant(instant, ZoneId.of("UTC"));
|
||||||
LocalDateTime utcDateTime = LocalDateTime.now();
|
|
||||||
queryResult.setDataStartTime(utcDateTime);
|
queryResult.setDataStartTime(utcDateTime);
|
||||||
//计算文件大小M
|
//计算文件大小M
|
||||||
BigDecimal divideVal = new BigDecimal("1024");
|
BigDecimal divideVal = new BigDecimal("1024");
|
||||||
|
|
@ -347,6 +346,7 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
flag = false;
|
flag = false;
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果单文件上传失败或者分片上传失败则删除数据
|
//如果单文件上传失败或者分片上传失败则删除数据
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>stas-cloud-gateway</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>stas-cloud-nacos</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,13 @@
|
||||||
<version>${jeecgboot.version}</version>
|
<version>${jeecgboot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>stas-cloud-data-analyze</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -33,4 +33,13 @@
|
||||||
<version>${jeecgboot.version}</version>
|
<version>${jeecgboot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>stas-cloud-event-simulation</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -33,4 +33,13 @@
|
||||||
<version>${jeecgboot.version}</version>
|
<version>${jeecgboot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>stas-cloud-source-rebuild</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -33,4 +33,13 @@
|
||||||
<version>${jeecgboot.version}</version>
|
<version>${jeecgboot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>stas-cloud-data-sync</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>stas-cloud-system</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
||||||
45
jeecg-server-cloud/jeecg-transport-start/pom.xml
Normal file
45
jeecg-server-cloud/jeecg-transport-start/pom.xml
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-server-cloud</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>jeecg-transport-start</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-boot-starter3-cloud</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-system-cloud-api</artifactId>
|
||||||
|
<version>${jeecgboot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-module-transport</artifactId>
|
||||||
|
<version>${jeecgboot.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>stas-cloud-transport-simulation</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
@ -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<String, Object> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration debug="false">
|
||||||
|
<!--定义日志文件的存储地址 -->
|
||||||
|
<property name="LOG_HOME" value="logs" />
|
||||||
|
|
||||||
|
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 按照每天生成日志文件 -->
|
||||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
|
<!--日志文件输出的文件名 -->
|
||||||
|
<FileNamePattern>${LOG_HOME}/stas-transport-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||||
|
<!--日志文件保留天数 -->
|
||||||
|
<MaxHistory>30</MaxHistory>
|
||||||
|
<maxFileSize>10MB</maxFileSize>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
<!--myibatis log configure -->
|
||||||
|
<logger name="com.apache.ibatis" level="TRACE" />
|
||||||
|
<logger name="java.sql.Connection" level="DEBUG" />
|
||||||
|
<logger name="java.sql.Statement" level="DEBUG" />
|
||||||
|
<logger name="java.sql.PreparedStatement" level="DEBUG" />
|
||||||
|
|
||||||
|
<!-- 日志输出级别 -->
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
<appender-ref ref="FILE" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
@ -33,4 +33,13 @@
|
||||||
<version>${jeecgboot.version}</version>
|
<version>${jeecgboot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<finalName>stas-cloud-weather</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
<module>jeecg-sync-start</module>
|
<module>jeecg-sync-start</module>
|
||||||
<module>jeecg-data-analyze-start</module>
|
<module>jeecg-data-analyze-start</module>
|
||||||
<module>jeecg-source-rebuild-start</module>
|
<module>jeecg-source-rebuild-start</module>
|
||||||
|
<module>jeecg-transport-start</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
3
pom.xml
3
pom.xml
|
|
@ -89,7 +89,8 @@
|
||||||
<module>jeecg-module-sync</module>
|
<module>jeecg-module-sync</module>
|
||||||
<module>jeecg-module-data-analyze</module>
|
<module>jeecg-module-data-analyze</module>
|
||||||
<module>jeecg-module-source-rebuild</module>
|
<module>jeecg-module-source-rebuild</module>
|
||||||
</modules>
|
<module>jeecg-module-transport</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user