| | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | public interface EmindStorageDashboardMapper { |
| | | int upsertSnapshot(@Param("station") EmindStation station, @Param("data") EmindMainTotalDto data, |
| | |
| | | @Param("endDate") LocalDate endDate); |
| | | List<Map<String, Object>> selectCurveRows(@Param("stationId") Long stationId, @Param("platformNames") List<String> platformNames); |
| | | List<Map<String, Object>> selectEnergyBlockRows(@Param("stationId") Long stationId, @Param("platformNames") List<String> platformNames); |
| | | |
| | | void deleteByStationIdDay(@Param("stationId") Long stationId, @Param("dateSet") Set<LocalDate> dateSet); |
| | | } |
| | |
| | | public EmindStation add(EmindStation input) { |
| | | LocalDateTime now = LocalDateTime.now(clock); |
| | | EmindStation station = new EmindStation(); |
| | | station.setStationId(input.getStationId() == null ? -System.currentTimeMillis() : input.getStationId()); |
| | | station.setStationId(input.getStationId() == null ? System.currentTimeMillis() : input.getStationId()); |
| | | station.setName(input.getName()); |
| | | station.setAddress(input.getAddress()); |
| | | station.setProvince(input.getProvince()); |
| | |
| | | import com.ruoyi.other.udan.model.UdanEmsDeviceState; |
| | | import com.ruoyi.other.udan.util.UdanEmsKafkaUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** 将 IEmsAllDeviceState 中模型已有的 EMS 和能耗计字段转换为业务对象。 */ |
| | | @Slf4j |
| | |
| | | EmindStation station = stations.stream().filter(s -> udanEmsDeviceState.getEmsDeviceId().equals(s.getStationCode())).findFirst().orElse(null); |
| | | if(Objects.nonNull(station)) { |
| | | List<EmindIncomeHistoryDto> daily = udanEmsDeviceState.convert(station.getStationId()); |
| | | dashboardMapper.upsertDaily(station.getStationId(), daily, now); |
| | | Set<LocalDate> dateSet = daily.stream().map(EmindIncomeHistoryDto::getDate).collect(Collectors.toSet()); |
| | | // 删除电站下该天已存在的旧数据 |
| | | if(CollectionUtils.isNotEmpty(dateSet)) { |
| | | dashboardMapper.deleteByStationIdDay(station.getStationId(), dateSet); |
| | | } |
| | | if(CollectionUtils.isNotEmpty(daily)) { |
| | | dashboardMapper.upsertDaily(station.getStationId(), daily, now); |
| | | } |
| | | }else{ |
| | | log.info("UDAN EMS数据同步错误-电站信息不存在!"); |
| | | log.error("UDAN EMS数据同步错误-电站信息不存在!"); |
| | | } |
| | | } |
| | | |
| | |
| | | <select id="selectRemoteActiveStations" resultMap="stationResultMap"> |
| | | SELECT id, station_id, name, address, province, city, longitude, latitude, |
| | | max_power, capacity, commissioning_time, platform_name, source_type, |
| | | management_deleted, del_flag, synced_at, create_time, update_time |
| | | management_deleted, del_flag, synced_at, create_time, update_time, station_code |
| | | FROM t_emind_station |
| | | WHERE source_type = 1 AND del_flag = 0 AND management_deleted = 0 |
| | | WHERE del_flag = 0 AND management_deleted = 0 |
| | | ORDER BY id |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="stationId != null">AND block.station_id=#{stationId}</if> |
| | | <if test="platformNames != null and platformNames.size() > 0">AND snapshot.platform_name IN <foreach collection="platformNames" item="name" open="(" separator="," close=")">#{name}</foreach></if> |
| | | </select> |
| | | <select id="deleteByStationIdDay"> |
| | | delete from t_emind_dashboard_daily |
| | | where station_id=#{stationId} |
| | | and stat_date in <foreach collection="dateSet" item="dateValue" open="(" separator="," close=")">#{dateValue}</foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | -- ---------------------------- |
| | | -- 1、增加大屏名称配置字段 |
| | | alter table t_screen_content add column screen_name varchar(255) default 'NULL' null comment '大屏名称'; |
| | | alter table t_screen_content add column screen_name varchar(255) default '' null comment '大屏名称'; |
| | | |
| | | -- 2、增加储能电站表设备编号 |
| | | alter table t_emind_station add column station_code varchar(255) default 'NULL' null comment '设备编号'; |
| | | alter table t_emind_station add column station_code varchar(255) default '' null comment '设备编号'; |
| | | |
| | | ALTER TABLE t_emind_dashboard_daily MODIFY COLUMN id BIGINT NOT NULL AUTO_INCREMENT comment '主键ID'; |
| | | |
| | | |