Commit 7ae2ab4e authored by tianchao's avatar tianchao

1增加光伏预测模块

parent 591d2c56
......@@ -167,7 +167,7 @@
'ou' as type
from sys_organization so
left join sys_organization_rel sor on sor.ou_id = so.id
where so.is_deleted = #{isDeleted}
where so.is_deleted = #{isDeleted} and sor.end_time >= NOW()
<if test="parentOuId != null and parentOuId != ''">
and parent_ou_id =#{parentOuId}
</if>
......
package pps.cloud.base.service;
import pps.cloud.base.service.data.base_photovoltaic_plant.GetBasePhotovoltaicPlantCloudInput;
import pps.cloud.base.service.data.base_photovoltaic_plant.GetBasePhotovoltaicPlantCloudOutput;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.data.XListResult;
@XService
public interface BasePhotovoltaicPlantCloudService {
@XText("获取电站")
XListResult<GetBasePhotovoltaicPlantCloudOutput> getBasePhotovoltaicPlantList(XContext context, GetBasePhotovoltaicPlantCloudInput input);
}
......@@ -8,6 +8,9 @@ import xstartup.data.XServiceResult;
@XService
public interface BaseWatherCloudService {
@XText("获取电站天气信息")
XServiceResult crawlPlantBaseWatherData(XContext context);
@XText("获取天气信息")
XServiceResult crawlBaseWatherData(XContext context);
......
package pps.cloud.base.service.data.base_photovoltaic_plant;
import lombok.Data;
import xstartup.annotation.XText;
@Data
public class GetBasePhotovoltaicPlantCloudInput {
@XText("ID")
private String id;
@XText("是否删除(1_是;0_否)")
private Integer isDeleted;
}
package pps.cloud.base.service.data.base_photovoltaic_plant;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import xstartup.annotation.XText;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class GetBasePhotovoltaicPlantCloudOutput {
@XText("ID")
private String id;
@XText("是否删除(1_是;0_否)")
private Integer isDeleted;
@XText("创建人ID")
private String createById;
@XText("创建人名称")
private String createByName;
@XText("创建时间")
private Date createTime;
@XText("修改人ID")
private String modifyById;
@XText("修改人名称")
private String modifyByName;
@XText("修改时间")
private Date modifyTime;
@XText("组织机构ID")
private String ouId;
@XText("电站名称")
private String stationName;
@XText("出厂编号")
private String makerNumber;
@XText("光伏设备规格型号key(字典获取)")
private String photovoltaicModelKey;
@XText("安装倾角")
private BigDecimal mountingAngle;
@XText("装机总量(KWP)")
private BigDecimal totalPower;
@XText("阵列朝向")
private BigDecimal arrayOrientation;
@XText("组织机构name")
private String ouName;
@XText("光伏设备规格型号name(字典获取)")
private String photovoltaicModelName;
@XText("所属城市")
private String cityCode;
@XText("所属省份")
private String provinceCode;
}
......@@ -77,4 +77,12 @@ public class BasePhotovoltaicPlantView implements Serializable {
@TableField
private String photovoltaicModelName;
@XText("所属城市")
@TableField(exist = false)
private String cityCode;
@XText("所属省份")
@TableField(exist = false)
private String provinceCode;
}
package pps.core.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 lombok.Data;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("plant_predicted_power_data")
public class PlantPredictedPowerDataEnt implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id;
@XText("线路id")
@TableField
private String plantId;
@XText("日期")
@TableField
private String dataDate;
@XText("年")
@TableField
private String yearTime;
@XText("月")
@TableField
private String monthTime;
@XText("日")
@TableField
private String dayTime;
@XText("时")
@TableField
private String hourTime;
@XText("分")
@TableField
private String minTime;
@XText("温度")
@TableField
private BigDecimal temperature;
@XText("湿度")
@TableField
private BigDecimal humidity;
@XText("风速")
@TableField
private BigDecimal windSpeed;
@XText("风向")
@TableField
private BigDecimal windDirection;
@XText("压强")
@TableField
private BigDecimal pressure;
@XText("组件平面辐照度")
@TableField
private BigDecimal planeIrradiance;
@XText("全水平辐照度")
@TableField
private BigDecimal horizontalIrradiance;
@XText("预测功率")
@TableField
private BigDecimal power;
@XText("创建时间")
@TableField
private Date createTime;
}
package pps.core.base.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import pps.core.common.enums.DictEnum;
public enum WindDirection implements DictEnum {
N(90, "东风"),
S(180, "南风"),
E(270, "西风"),
W(0, "北风"),
NW(45, "东北风"),
NS(135, "东南风"),
ES(225, "西南风"),
EW(315, "西北风");
@EnumValue
private Integer value = 0;
private String desc = "";
WindDirection(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
@Override
public Integer getValue() {
return value;
}
@Override
public String getDesc() {
return desc;
}
public static WindDirection findByValue(String v){
for(WindDirection e : values()){
if( e.getDesc() .equals(v) ){
return e;
}
}
return null;
}
}
......@@ -9,4 +9,5 @@ import java.util.List;
public interface BasePhotovoltaicPlantViewMapper {
BasePhotovoltaicPlantView selectOne(BasePhotovoltaicPlantView record);
List<BasePhotovoltaicPlantView> selectList(BasePhotovoltaicPlantView record);
List<BasePhotovoltaicPlantView> selectPlantDetailList(BasePhotovoltaicPlantView record);
}
package pps.core.base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import pps.core.base.entity.PlantPredictedPowerDataEnt;
@Repository(value="pps.core.base.mapper.PlantPredictedPowerDataMapper")
public interface PlantPredictedPowerDataMapper extends BaseMapper<PlantPredictedPowerDataEnt> {
}
package pps.core.base.service;
import pps.cloud.base.service.BasePhotovoltaicPlantCloudService;
import pps.cloud.base.service.data.base_photovoltaic_plant.GetBasePhotovoltaicPlantCloudInput;
import pps.cloud.base.service.data.base_photovoltaic_plant.GetBasePhotovoltaicPlantCloudOutput;
import pps.core.base.constant.ScadaConstant;
import pps.core.base.entity.BasePhotovoltaicPlantView;
import pps.core.base.mapper.BasePhotovoltaicPlantViewMapper;
import xstartup.annotation.XService;
import xstartup.base.XContext;
import xstartup.data.XListResult;
import java.util.List;
@XService
public class BasePhotovoltaicPlantCloudServiceImpl implements BasePhotovoltaicPlantCloudService {
@Override
public XListResult<GetBasePhotovoltaicPlantCloudOutput> getBasePhotovoltaicPlantList(XContext context, GetBasePhotovoltaicPlantCloudInput input) {
BasePhotovoltaicPlantViewMapper mapper = context.getBean(BasePhotovoltaicPlantViewMapper.class);
BasePhotovoltaicPlantView view = new BasePhotovoltaicPlantView();
view.setIsDeleted(ScadaConstant.IS_DELETE_FLASE);
List<BasePhotovoltaicPlantView> plantList = mapper.selectPlantDetailList(view);
return null;
}
}
......@@ -13,8 +13,6 @@ import pps.core.common.session.PpsUserSession;
import pps.core.system.constant.SysOrganizationCode;
import pps.core.system.entity.SysOrganizationView;
import pps.core.system.mapper.SysOrganizationViewMapper;
import pps.core.system.service.data.sys_organization.GetSysOrganizationViewOutput;
import pps.core.system.service.data.sys_organization_rel.GetSysOrganizationRelInput;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
......@@ -115,6 +113,7 @@ public class BasePhotovoltaicPlantService extends BaseService{
if (entity == null) {
return XSingleResult.error(context, XError.NotFound);
}
//根据组织机构的路径获取
GetBasePhotovoltaicPlantOutput output = new GetBasePhotovoltaicPlantOutput();
XCopyUtils.copyObject(entity, output);
return XSingleResult.success(output);
......@@ -139,8 +138,8 @@ public class BasePhotovoltaicPlantService extends BaseService{
}
@XText("根据父级id查询儿子级(含电站)")
@XApiPost
public XListResult<GetSysOrganizationViewOutput> selectOuAndPhotovoltaicPlantInfoByParentOuId(XContext context, GetSysOrganizationRelInput input) {
@XApiGet
public XListResult<GetSysOrganizationAndPlantViewOutput> selectOuAndPhotovoltaicPlantInfoByParentOuId(XContext context, GetSysOrganizationAndPlantInput input) {
SysOrganizationViewMapper mapper = context.getBean(SysOrganizationViewMapper.class);
BasePhotovoltaicPlantMapper plantMapper = context.getBean(BasePhotovoltaicPlantMapper.class);
QueryWrapper<BasePhotovoltaicPlantEnt> queryWrapper = new QueryWrapper<>();
......@@ -165,17 +164,17 @@ public class BasePhotovoltaicPlantService extends BaseService{
ouId = input.getParentOuId();
viewList = mapper.selectOuSonByParentOuId(record);
}
queryWrapper.lambda().eq(BasePhotovoltaicPlantEnt::getOuId , ouId);
queryWrapper.lambda().eq(BasePhotovoltaicPlantEnt::getOuId , ouId).eq(BasePhotovoltaicPlantEnt::getIsDeleted , 0);
List<BasePhotovoltaicPlantEnt> plantList = plantMapper.selectList(queryWrapper);
plantList.forEach(item->{
SysOrganizationView view = new SysOrganizationView();
view.setId(item.getId());
view.setOuName(item.getStationName());
view.setShortName(item.getStationName());
view.setOuLevel("PLANT");
view.setOuLevel("PHOTOVOLTAIC");
viewList.add(view);
});
List<GetSysOrganizationViewOutput> outputs = XCopyUtils.copyNewList(viewList, GetSysOrganizationViewOutput.class);
List<GetSysOrganizationAndPlantViewOutput> outputs = XCopyUtils.copyNewList(viewList, GetSysOrganizationAndPlantViewOutput.class);
return XListResult.success(outputs);
}
......
......@@ -52,9 +52,14 @@ public class GetBasePhotovoltaicPlantOutput {
@XText("阵列朝向")
private BigDecimal arrayOrientation;
@XText("组织机构name")
private String ouName;
@XText("光伏设备规格型号name(字典获取)")
private String photovoltaicModelName;
@XText("所在地区")
private String province;
}
package pps.core.base.service.data.base_photovoltaic_plant;
import xstartup.annotation.XText;
import java.util.Date;
public class GetSysOrganizationAndPlantInput {
@XText("主键")
private String id;
@XText("组织机构表id")
private String ouId;
@XText("上级组织机构表id")
private String parentOuId;
@XText("层级")
private Integer levels;
@XText("级别")
private String ouLevel;
@XText("组织机构ID路径")
private String ouIdPath;
@XText("是否包含子ou:0->否;1->是;")
private Integer isHasChildren;
@XText("生效时间")
private Date effectTime;
@XText("结束时间")
private Date endTime;
@XText("序号")
private Integer sort;
@XText("创建人")
private String createById;
@XText("创建人名称")
private String createByName;
@XText("创建时间")
private Date createTime;
@XText("修改人")
private String modifyById;
@XText("修改人名称")
private String modifyByName;
@XText("修改时间")
private Date modifyTime;
public String getOuLevel() {
return ouLevel;
}
public void setOuLevel(String ouLevel) {
this.ouLevel = ouLevel;
}
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public String getOuId() {
return this.ouId;
}
public void setOuId(String value) {
this.ouId = value;
}
public String getParentOuId() {
return this.parentOuId;
}
public void setParentOuId(String value) {
this.parentOuId = value;
}
public Integer getLevels() {
return this.levels;
}
public void setLevels(Integer value) {
this.levels = value;
}
public String getOuIdPath() {
return this.ouIdPath;
}
public void setOuIdPath(String value) {
this.ouIdPath = value;
}
public Integer getIsHasChildren() {
return this.isHasChildren;
}
public void setIsHasChildren(Integer value) {
this.isHasChildren = value;
}
public Date getEffectTime() {
return this.effectTime;
}
public void setEffectTime(Date value) {
this.effectTime = value;
}
public Date getEndTime() {
return this.endTime;
}
public void setEndTime(Date value) {
this.endTime = value;
}
public Integer getSort() {
return this.sort;
}
public void setSort(Integer value) {
this.sort = value;
}
public String getCreateById() {
return this.createById;
}
public void setCreateById(String value) {
this.createById = value;
}
public String getCreateByName() {
return this.createByName;
}
public void setCreateByName(String value) {
this.createByName = value;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date value) {
this.createTime = value;
}
public String getModifyById() {
return this.modifyById;
}
public void setModifyById(String value) {
this.modifyById = value;
}
public String getModifyByName() {
return this.modifyByName;
}
public void setModifyByName(String value) {
this.modifyByName = value;
}
public Date getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(Date value) {
this.modifyTime = value;
}
}
package pps.core.base.service.data.base_photovoltaic_plant;
import xstartup.annotation.XText;
import java.math.BigDecimal;
import java.util.Date;
public class GetSysOrganizationAndPlantViewOutput {
@XText("主键")
private String id;
@XText("组织机构编码")
private String ouCode;
@XText("组织机构名称")
private String ouName;
@XText("简称")
private String shortName;
@XText("单位级别(从系统字典中来)")
private String ouLevel;
@XText("描述")
private String description;
@XText("创建人")
private String createById;
@XText("创建人名称")
private String createByName;
@XText("创建时间")
private Date createTime;
@XText("修改人")
private String modifyById;
@XText("修改人名称")
private String modifyByName;
@XText("修改时间")
private Date modifyTime;
@XText("邮编")
private String postCode;
@XText("地址")
private String postAddress;
@XText("传真")
private String faxNo;
@XText("电话")
private String phone;
@XText("国家")
private String country;
@XText("省份")
private Integer province;
@XText("父级id")
private String parentOuId;
private String type;
@XText("经度")
private BigDecimal longitude;
@XText("纬度")
private BigDecimal latitude;
@XText("高程")
private BigDecimal elevation;
public BigDecimal getLongitude() {
return longitude;
}
public void setLongitude(BigDecimal longitude) {
this.longitude = longitude;
}
public BigDecimal getLatitude() {
return latitude;
}
public void setLatitude(BigDecimal latitude) {
this.latitude = latitude;
}
public BigDecimal getElevation() {
return elevation;
}
public void setElevation(BigDecimal elevation) {
this.elevation = elevation;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getId() {
return this.id;
}
public void setId(String value) {
this.id = value;
}
public String getOuCode() {
return this.ouCode;
}
public void setOuCode(String value) {
this.ouCode = value;
}
public String getOuName() {
return this.ouName;
}
public void setOuName(String value) {
this.ouName = value;
}
public String getShortName() {
return this.shortName;
}
public void setShortName(String value) {
this.shortName = value;
}
public String getOuLevel() {
return this.ouLevel;
}
public void setOuLevel(String value) {
this.ouLevel = value;
}
public String getDescription() {
return this.description;
}
public void setDescription(String value) {
this.description = value;
}
public String getCreateById() {
return this.createById;
}
public void setCreateById(String value) {
this.createById = value;
}
public String getCreateByName() {
return this.createByName;
}
public void setCreateByName(String value) {
this.createByName = value;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date value) {
this.createTime = value;
}
public String getModifyById() {
return this.modifyById;
}
public void setModifyById(String value) {
this.modifyById = value;
}
public String getModifyByName() {
return this.modifyByName;
}
public void setModifyByName(String value) {
this.modifyByName = value;
}
public Date getModifyTime() {
return this.modifyTime;
}
public void setModifyTime(Date value) {
this.modifyTime = value;
}
public String getPostCode() {
return this.postCode;
}
public void setPostCode(String value) {
this.postCode = value;
}
public String getPostAddress() {
return this.postAddress;
}
public void setPostAddress(String value) {
this.postAddress = value;
}
public String getFaxNo() {
return this.faxNo;
}
public void setFaxNo(String value) {
this.faxNo = value;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String value) {
this.phone = value;
}
public String getCountry() {
return this.country;
}
public void setCountry(String value) {
this.country = value;
}
public Integer getProvince() {
return this.province;
}
public void setProvince(Integer value) {
this.province = value;
}
public String getParentOuId() {
return parentOuId;
}
public void setParentOuId(String parentOuId) {
this.parentOuId = parentOuId;
}
}
......@@ -19,6 +19,8 @@
<result column="mounting_angle" property="mountingAngle" jdbcType="DECIMAL" />
<result column="total_power" property="totalPower" jdbcType="DECIMAL" />
<result column="array_orientation" property="arrayOrientation" jdbcType="DECIMAL" />
<result column="city_code" property="cityCode" jdbcType="VARCHAR" />
<result column="province_code" property="provinceCode" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id,
......@@ -53,4 +55,32 @@
where
id=#{id}
</select>
<select id="selectPlantDetailList" parameterType="pps.core.base.entity.BasePhotovoltaicPlantView" resultMap="BaseResultMap">
select
p.id,
p.is_deleted,
p.create_by_id,
p.create_by_name,
p.create_time,
p.modify_by_id,
p.modify_by_name,
p.modify_time,
p.ou_id,
p.ou_name,
p.station_name,
p.maker_number,
p.photovoltaic_model_key,
p.photovoltaic_model_name,
p.mounting_angle,
p.total_power,
p.array_orientation ,
sa.city_code ,
sa.province_code
from
base_photovoltaic_plant p
join sys_organization so on so.id = p.ou_id
left join sys_area sa on sa.id = so.province
where
p.is_deleted = #{isDeleted}
</select>
</mapper>
\ No newline at end of file
......@@ -13,11 +13,11 @@ import xstartup.service.job.annotation.XCronTrigger;
@XText("天气数据,每8小时执行一次")
@XService
public class WeatherJob implements XJob {
@XCronTrigger(value = "0 0 0/4 * * ?")
@XCronTrigger(value = "0 0/30 * * * ?")
@Override
public XServiceResult execute(XContext context) {
BaseWatherCloudService cloudService = context.getBean(BaseWatherCloudService.class);
cloudService.crawlBaseWatherData(context);
cloudService.crawlPlantBaseWatherData(context);
return XServiceResult.error(context, XError.NotFound);
}
......
package pps.core.prediction.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 lombok.Data;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("plant_predicted_power_data")
public class PlantPredictedPowerDataEnt implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id;
@XText("线路id")
@TableField
private String plantId;
@XText("日期")
@TableField
private String dataDate;
@XText("年")
@TableField
private String yearTime;
@XText("月")
@TableField
private String monthTime;
@XText("日")
@TableField
private String dayTime;
@XText("时")
@TableField
private String hourTime;
@XText("分")
@TableField
private String minTime;
@XText("温度")
@TableField
private BigDecimal temperature;
@XText("湿度")
@TableField
private BigDecimal humidity;
@XText("风速")
@TableField
private BigDecimal windSpeed;
@XText("风向")
@TableField
private BigDecimal windDirection;
@XText("压强")
@TableField
private BigDecimal pressure;
@XText("组件平面辐照度")
@TableField
private BigDecimal planeIrradiance;
@XText("全水平辐照度")
@TableField
private BigDecimal horizontalIrradiance;
@XText("预测功率")
@TableField
private BigDecimal power;
@XText("创建时间")
@TableField
private Date createTime;
}
package pps.core.prediction.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import pps.core.prediction.entity.PlantPredictedPowerDataEnt;
@Repository(value="pps.core.prediction.mapper.PlantPredictedPowerDataMapper")
public interface PlantPredictedPowerDataMapper extends BaseMapper<PlantPredictedPowerDataEnt> {
}
package pps.core.prediction.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.core.prediction.entity.PlantPredictedPowerDataEnt;
import pps.core.prediction.mapper.PlantPredictedPowerDataMapper;
import pps.core.prediction.service.data.plant_predicted_power_data.GetPlantPredictedPowerDataInput;
import pps.core.prediction.service.data.plant_predicted_power_data.GetPlantPredictedPowerDataOutput;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.util.XCopyUtils;
import xstartup.base.util.XDateUtils;
import xstartup.base.util.XStringUtils;
import xstartup.data.XListResult;
import xstartup.feature.api.annotation.XApiGet;
import java.util.Date;
import java.util.List;
@XService
@XText("电站预测发电数据表")
public class PlantPredictedPowerDataService {
@XApiGet
@XText("根据电站预测4小时内的预测数据")
public XListResult<GetPlantPredictedPowerDataOutput> getFourPlantPredictedPowerData(XContext context, GetPlantPredictedPowerDataInput input){
PlantPredictedPowerDataMapper mapper = context.getBean(PlantPredictedPowerDataMapper.class);
Date date = new Date();
QueryWrapper<PlantPredictedPowerDataEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PlantPredictedPowerDataEnt::getPlantId ,input.getPlantId());
if(XStringUtils.isEmpty(input.getStartTime())){
queryWrapper.lambda().ge(PlantPredictedPowerDataEnt::getDataDate , date);
queryWrapper.lambda().le(PlantPredictedPowerDataEnt::getDataDate , XDateUtils.addHours(date , 4));
} else{
String dataDate = XDateUtils.getDateString(new Date()) + " " + input.getStartTime() + ":00";
queryWrapper.lambda().ge(PlantPredictedPowerDataEnt::getDataDate , dataDate);
queryWrapper.lambda().le(PlantPredictedPowerDataEnt::getDataDate , XDateUtils.addHours(XDateUtils.parse(dataDate) , 4));
}
queryWrapper.lambda().orderByAsc(PlantPredictedPowerDataEnt::getDataDate);
List<PlantPredictedPowerDataEnt> list = mapper.selectList(queryWrapper);
List<GetPlantPredictedPowerDataOutput> outputs = XCopyUtils.copyNewList(list , GetPlantPredictedPowerDataOutput.class);
return XListResult.success(outputs);
}
@XApiGet
@XText("根据电站预测7天的预测数据")
public XListResult<GetPlantPredictedPowerDataOutput> getSevenPlantPredictedPowerData(XContext context, GetPlantPredictedPowerDataInput input){
PlantPredictedPowerDataMapper mapper = context.getBean(PlantPredictedPowerDataMapper.class);
Date date = new Date();
QueryWrapper<PlantPredictedPowerDataEnt> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(PlantPredictedPowerDataEnt::getPlantId ,input.getPlantId());
if(XStringUtils.isEmpty(input.getStartTime())){
queryWrapper.lambda().ge(PlantPredictedPowerDataEnt::getDataDate , date);
queryWrapper.lambda().le(PlantPredictedPowerDataEnt::getDataDate , XDateUtils.addDays(date , 7));
} else{
queryWrapper.lambda().ge(PlantPredictedPowerDataEnt::getDataDate , input.getStartTime());
queryWrapper.lambda().le(PlantPredictedPowerDataEnt::getDataDate , XDateUtils.addDays(XDateUtils.parse(input.getStartTime()) , 7));
}
queryWrapper.lambda().orderByAsc(PlantPredictedPowerDataEnt::getDataDate);
List<PlantPredictedPowerDataEnt> list = mapper.selectList(queryWrapper);
List<GetPlantPredictedPowerDataOutput> outputs = XCopyUtils.copyNewList(list , GetPlantPredictedPowerDataOutput.class);
outputs.forEach(item->{
item.setPredictedPower(item.getPower());
});
return XListResult.success(outputs);
}
}
package pps.core.prediction.service.data.plant_predicted_power_data;
import lombok.Data;
import xstartup.annotation.XText;
@Data
public class GetPlantPredictedPowerDataInput {
@XText("电站id")
private String plantId;
@XText("开始时间")
private String startTime;
}
package pps.core.prediction.service.data.plant_predicted_power_data;
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 lombok.Data;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class GetPlantPredictedPowerDataOutput implements Serializable {
@TableId(type = IdType.AUTO)
private Integer id;
@XText("线路id")
private String plantId;
@XText("日期")
private String dataDate;
@XText("年")
private String yearTime;
@XText("月")
private String monthTime;
@XText("日")
private String dayTime;
@XText("时")
private String hourTime;
@XText("分")
private String minTime;
@XText("温度")
private BigDecimal temperature;
@XText("湿度")
private BigDecimal humidity;
@XText("风速")
private BigDecimal windSpeed;
@XText("风向")
private BigDecimal windDirection;
@XText("压强")
private BigDecimal pressure;
@XText("组件平面辐照度")
private BigDecimal planeIrradiance;
@XText("全水平辐照度")
private BigDecimal horizontalIrradiance;
@XText("预测功率")
private BigDecimal predictedPower;
@XText("实际功率")
private BigDecimal power;
@XText("创建时间")
private Date createTime;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment