Browse Source

新增短期实时表一期二期的service类和repository类

xusl 2 years ago
parent
commit
c25ea3f5d3

+ 35 - 0
ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/ForecastPowerShortTermOneRepository.java

@@ -0,0 +1,35 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+
+import com.jiayue.ipfcst.common.data.entity.ForecastPowerShortTermOne;
+
+import java.util.List;
+
+/**
+ * 实时短期预测功率仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/2 10:57
+ */
+public interface ForecastPowerShortTermOneRepository extends BaseRepository<ForecastPowerShortTermOne, Integer> {
+
+
+	/**
+	 * 按时间段删除数据
+	 *
+	 * @param startTime
+	 * @param endTime
+	 */
+	void deleteByForecastTimeBetween(Long startTime, Long endTime);
+
+	/**
+	 * 按时间段查询数据
+	 *
+	 * @param startTime
+	 * @param endTime
+	 */
+	List<ForecastPowerShortTermOne> findByForecastTimeBetween(Long startTime, Long endTime);
+
+
+}

+ 35 - 0
ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/ForecastPowerShortTermTwoRepository.java

@@ -0,0 +1,35 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+
+import com.jiayue.ipfcst.common.data.entity.ForecastPowerShortTermTwo;
+
+import java.util.List;
+
+/**
+ * 实时短期预测功率仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/2 10:57
+ */
+public interface ForecastPowerShortTermTwoRepository extends BaseRepository<ForecastPowerShortTermTwo, Integer> {
+
+
+	/**
+	 * 按时间段删除数据
+	 *
+	 * @param startTime
+	 * @param endTime
+	 */
+	void deleteByForecastTimeBetween(Long startTime, Long endTime);
+
+	/**
+	 * 按时间段查询数据
+	 *
+	 * @param startTime
+	 * @param endTime
+	 */
+	List<ForecastPowerShortTermTwo> findByForecastTimeBetween(Long startTime, Long endTime);
+
+
+}

+ 37 - 0
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerShortTermOneService.java

@@ -0,0 +1,37 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.data.entity.*;
+import com.jiayue.ipfcst.common.data.repository.ForecastPowerShortTermOneRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+@Service
+@Slf4j
+public class ForecastPowerShortTermOneService extends BaseService {
+
+  @Autowired
+  ForecastPowerShortTermOneRepository forecastPowerShortTermOneRepository;
+
+
+  /**
+   * 按时间段删除数据
+   *
+   * @param startTime
+   * @param endTime
+   * @param listDq
+   */
+  @Transactional(propagation = Propagation.REQUIRED)
+  public void deleteBetweenAndGenTime(Long startTime, Long endTime, List<ForecastPowerShortTermOne> listDq) {
+    forecastPowerShortTermOneRepository.deleteByForecastTimeBetween(startTime, endTime);
+    //保存短期数据
+    forecastPowerShortTermOneRepository.saveAll(listDq);
+  }
+
+
+}

+ 37 - 0
ipfcst/ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerShortTermTwoService.java

@@ -0,0 +1,37 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.data.entity.*;
+import com.jiayue.ipfcst.common.data.repository.ForecastPowerShortTermTwoRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+
+@Service
+@Slf4j
+public class ForecastPowerShortTermTwoService extends BaseService {
+
+  @Autowired
+  ForecastPowerShortTermTwoRepository forecastPowerShortTermTwoRepository;
+
+
+  /**
+   * 按时间段删除数据
+   *
+   * @param startTime
+   * @param endTime
+   * @param listDq
+   */
+  @Transactional(propagation = Propagation.REQUIRED)
+  public void deleteBetweenAndGenTime(Long startTime, Long endTime, List<ForecastPowerShortTermTwo> listDq) {
+    forecastPowerShortTermTwoRepository.deleteByForecastTimeBetween(startTime, endTime);
+    //保存短期数据
+    forecastPowerShortTermTwoRepository.saveAll(listDq);
+  }
+
+
+}