Commit f73d0b7e authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.长庆演示首页功能开发,新增查询井场/场站列表接口,添加接口文档并完成接口冒烟测试;
2.长庆演示首页功能开发,新增总览信息统计接口,添加接口文档并完成接口冒烟测试;
3.长庆演示首页功能开发,新增用能分析统计接口,添加接口文档并完成接口冒烟测试;
4.长庆演示首页功能开发,新增累计用电统计接口,添加接口文档并完成接口冒烟测试;
5.长庆演示首页功能开发,新增光伏实时监控统计接口,添加接口文档并完成接口冒烟测试;
6.长庆演示首页功能开发,新增先导实验井间开制度统计接口,添加接口文档并完成接口冒烟测试;
7.长庆演示首页功能开发,新增零碳井场收益分析统计接口,添加接口文档并完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 98ad1b3b
...@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.io.Serializable; import java.io.Serializable;
...@@ -12,6 +15,9 @@ import java.math.BigDecimal; ...@@ -12,6 +15,9 @@ import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("plant_predicted_power_data") @TableName("plant_predicted_power_data")
public class PlantPredictedPowerDataEnt implements Serializable { public class PlantPredictedPowerDataEnt implements Serializable {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
...@@ -80,5 +86,4 @@ public class PlantPredictedPowerDataEnt implements Serializable { ...@@ -80,5 +86,4 @@ public class PlantPredictedPowerDataEnt implements Serializable {
@XText("创建时间") @XText("创建时间")
@TableField @TableField
private Date createTime; private Date createTime;
} }
package pps.core.base.mapper; package pps.core.base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import pps.core.base.entity.PlantPredictedPowerDataEnt; import pps.core.base.entity.PlantPredictedPowerDataEnt;
import java.util.List; import java.util.List;
@Repository(value="pps.core.base.mapper.PlantPredictedPowerDataViewMapper") @Repository(value = "pps.core.base.mapper.PlantPredictedPowerDataViewMapper")
public interface PlantPredictedPowerDataViewMapper{ public interface PlantPredictedPowerDataViewMapper {
/**
* 批量新增
*
* @param list 列表
* @return int
*/
int insertBatch(List<PlantPredictedPowerDataEnt> list); int insertBatch(List<PlantPredictedPowerDataEnt> list);
} }
...@@ -127,9 +127,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -127,9 +127,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
//遍历预测数据列表 //遍历预测数据列表
for (DailyData dailyData : dailyDataList) { for (DailyData dailyData : dailyDataList) {
for (BasePhotovoltaicPlantView plant : plantViewList) { for (BasePhotovoltaicPlantView plant : plantViewList) {
List<PlantPredictedPowerDataEnt> batchList = new ArrayList<>(); List<PlantPredictedPowerDataEnt> batchList = new ArrayList<>(2048);
List<PlantPredictedPowerDataEnt> allList = new ArrayList<>(); List<PlantPredictedPowerDataEnt> deleteList = new ArrayList<>(2048);
List<PlantPredictedPowerDataEnt> objList = new ArrayList<>(); List<PlantPredictedPowerDataEnt> allList = new ArrayList<>(2048);
List<PlantPredictedPowerDataEnt> objList = new ArrayList<>(2048);
DateTime dateTime = DateTime.of(dailyData.getDateTime()); DateTime dateTime = DateTime.of(dailyData.getDateTime());
int hours = 0; int hours = 0;
String plantId = plant.getId(); String plantId = plant.getId();
...@@ -153,13 +154,13 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -153,13 +154,13 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
this.int2Str(dateTime.dayOfMonth()) this.int2Str(dateTime.dayOfMonth())
); );
// 5.执行SQL // 5.执行SQL
mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>() deleteList.add(PlantPredictedPowerDataEnt.builder()
.eq(PlantPredictedPowerDataEnt::getPlantId, plantId) .plantId(plantId)
.eq(PlantPredictedPowerDataEnt::getYearTime, dao.getYearTime()) .yearTime(dao.getYearTime())
.eq(PlantPredictedPowerDataEnt::getMonthTime, dao.getMonthTime()) .monthTime(dao.getMonthTime())
.eq(PlantPredictedPowerDataEnt::getDayTime, dao.getDayTime()) .dayTime(dao.getDayTime())
.eq(PlantPredictedPowerDataEnt::getHourTime, dao.getHourTime()) .hourTime(dao.getHourTime())
); .build());
allList.add(dao); allList.add(dao);
PlantPredictedPowerDataEnt isExit = objList.stream().filter(item -> PlantPredictedPowerDataEnt isExit = objList.stream().filter(item ->
CharSequenceUtil.equals(item.getYearTime(), dao.getYearTime()) && CharSequenceUtil.equals(item.getYearTime(), dao.getYearTime()) &&
...@@ -204,13 +205,13 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -204,13 +205,13 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
this.int2Str(date.dayOfMonth()) this.int2Str(date.dayOfMonth())
); );
// 5.执行SQL // 5.执行SQL
mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>() deleteList.add(PlantPredictedPowerDataEnt.builder()
.eq(PlantPredictedPowerDataEnt::getPlantId, plantId) .plantId(plantId)
.eq(PlantPredictedPowerDataEnt::getYearTime, dao.getYearTime()) .yearTime(dao.getYearTime())
.eq(PlantPredictedPowerDataEnt::getMonthTime, dao.getMonthTime()) .monthTime(dao.getMonthTime())
.eq(PlantPredictedPowerDataEnt::getDayTime, dao.getDayTime()) .dayTime(dao.getDayTime())
.eq(PlantPredictedPowerDataEnt::getHourTime, dao.getHourTime()) .hourTime(dao.getHourTime())
); .build());
allList.add(dao); allList.add(dao);
} }
} }
...@@ -253,8 +254,40 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -253,8 +254,40 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
} }
} }
} }
int size;
if (CollUtil.isNotEmpty(deleteList)) {
size = deleteList.size();
logger.info("------ weatherDataProcess batchDelete delete plantId: {} size: {}", plantId, size);
if (size > BaseUtils.BATCH_SIZE) {
List<List<PlantPredictedPowerDataEnt>> subList = BaseUtils.getSubList(deleteList);
for (List<PlantPredictedPowerDataEnt> list : subList) {
LambdaQueryWrapper<PlantPredictedPowerDataEnt> wrapper = new LambdaQueryWrapper<PlantPredictedPowerDataEnt>()
.eq(PlantPredictedPowerDataEnt::getPlantId, plantId);
for (PlantPredictedPowerDataEnt dataEnt : list) {
wrapper.or(w -> w.eq(PlantPredictedPowerDataEnt::getPlantId, plantId)
.eq(PlantPredictedPowerDataEnt::getYearTime, dataEnt.getYearTime())
.eq(PlantPredictedPowerDataEnt::getMonthTime, dataEnt.getMonthTime())
.eq(PlantPredictedPowerDataEnt::getDayTime, dataEnt.getDayTime())
.eq(PlantPredictedPowerDataEnt::getHourTime, dataEnt.getHourTime())
);
}
mapper.delete(wrapper);
}
} else {
LambdaQueryWrapper<PlantPredictedPowerDataEnt> wrapper = new LambdaQueryWrapper<>();
for (PlantPredictedPowerDataEnt dataEnt : deleteList) {
wrapper.or(w -> w.eq(PlantPredictedPowerDataEnt::getPlantId, plantId)
.eq(PlantPredictedPowerDataEnt::getYearTime, dataEnt.getYearTime())
.eq(PlantPredictedPowerDataEnt::getMonthTime, dataEnt.getMonthTime())
.eq(PlantPredictedPowerDataEnt::getDayTime, dataEnt.getDayTime())
.eq(PlantPredictedPowerDataEnt::getHourTime, dataEnt.getHourTime())
);
}
mapper.delete(wrapper);
}
}
if (CollUtil.isNotEmpty(batchList)) { if (CollUtil.isNotEmpty(batchList)) {
int size = batchList.size(); size = batchList.size();
logger.info("------ weatherDataProcess batchList insert plantId: {} size: {}", plantId, size); logger.info("------ weatherDataProcess batchList insert plantId: {} size: {}", plantId, size);
if (size > BaseUtils.BATCH_SIZE) { if (size > BaseUtils.BATCH_SIZE) {
List<List<PlantPredictedPowerDataEnt>> subList = BaseUtils.getSubList(batchList); List<List<PlantPredictedPowerDataEnt>> subList = BaseUtils.getSubList(batchList);
...@@ -322,7 +355,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -322,7 +355,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
return dao; return dao;
} }
/** /**
* 计算 * 计算
* *
...@@ -345,7 +377,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -345,7 +377,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
return num < 10 ? "0" + num : String.valueOf(num); return num < 10 ? "0" + num : String.valueOf(num);
} }
/** /**
* 保存附件 * 保存附件
* *
......
...@@ -4,38 +4,38 @@ ...@@ -4,38 +4,38 @@
<insert id="insertBatch" parameterType="java.util.List"> <insert id="insertBatch" parameterType="java.util.List">
INSERT INTO plant_predicted_power_data INSERT INTO plant_predicted_power_data
(plant_id, (plant_id,
data_date, data_date,
year_time, year_time,
month_time, month_time,
day_time, day_time,
hour_time, hour_time,
min_time, min_time,
temperature, temperature,
humidity, humidity,
wind_speed, wind_speed,
wind_direction, wind_direction,
pressure, pressure,
plane_irradiance, plane_irradiance,
horizontal_irradiance, horizontal_irradiance,
power, power,
create_time) VALUES create_time) VALUES
<foreach collection="list" separator="," item="item"> <foreach collection="list" separator="," item="item">
(#{item.plantId}, (#{item.plantId},
#{item.dataDate}, #{item.dataDate},
#{item.yearTime}, #{item.yearTime},
#{item.monthTime}, #{item.monthTime},
#{item.dayTime}, #{item.dayTime},
#{item.hourTime}, #{item.hourTime},
#{item.minTime}, #{item.minTime},
#{item.temperature}, #{item.temperature},
#{item.humidity}, #{item.humidity},
#{item.windSpeed}, #{item.windSpeed},
#{item.windDirection}, #{item.windDirection},
#{item.pressure}, #{item.pressure},
#{item.planeIrradiance}, #{item.planeIrradiance},
#{item.horizontalIrradiance}, #{item.horizontalIrradiance},
#{item.power}, #{item.power},
#{item.createTime}) #{item.createTime})
</foreach> </foreach>
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file
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