|
@@ -8,8 +8,8 @@ import com.gyee.gaia.meter.adapter.Adapter;
|
|
|
import com.gyee.gaia.meter.entity.*;
|
|
|
import com.gyee.gaia.meter.service.impl.*;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
-
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
@@ -29,7 +29,7 @@ class AdapterServiceTest {
|
|
|
Adapter adapter;
|
|
|
|
|
|
|
|
|
- //测试获取和保存数据
|
|
|
+ //测试适配器读取数据,测试实体类直接保存数据到数据库.
|
|
|
@Test
|
|
|
void getHistorySection() {
|
|
|
|
|
@@ -51,10 +51,14 @@ class AdapterServiceTest {
|
|
|
@Resource
|
|
|
EquipmentServiceImpl equipmentService;
|
|
|
|
|
|
+ @Value("${start.time}")
|
|
|
+ private String adapterUrl;
|
|
|
+
|
|
|
//测试读取设备发电量,并写入pg数据库
|
|
|
@Test
|
|
|
void saveEquipmentRfdl() {
|
|
|
|
|
|
+
|
|
|
//1,在testingpoint中根据 uniform_code=AI064 和code like "%_FJ_%" 取出所有风机的电量测点code
|
|
|
List<TestingPoint> list = testingPointService.list(new QueryWrapper<TestingPoint>().eq("uniform_code", "AI064").like("code", "%_FJ_%"));
|
|
|
|
|
@@ -69,7 +73,7 @@ class AdapterServiceTest {
|
|
|
String thingId = testingPoint.getThingId();
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime2 = DateUtil.endOfDay(dateTime);
|
|
@@ -155,7 +159,7 @@ class AdapterServiceTest {
|
|
|
String pointcode = meterPoint.getNemCode();
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime2 = DateUtil.endOfDay(dateTime);
|
|
@@ -233,7 +237,7 @@ class AdapterServiceTest {
|
|
|
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime1 = dateTime;
|
|
@@ -468,7 +472,7 @@ class AdapterServiceTest {
|
|
|
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime1 = dateTime;
|
|
@@ -660,7 +664,7 @@ class AdapterServiceTest {
|
|
|
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime1 = dateTime;
|
|
@@ -839,7 +843,7 @@ class AdapterServiceTest {
|
|
|
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime1 = dateTime;
|
|
@@ -938,7 +942,7 @@ class AdapterServiceTest {
|
|
|
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime1 = dateTime;
|
|
@@ -1040,7 +1044,7 @@ class AdapterServiceTest {
|
|
|
|
|
|
|
|
|
//6,设置取值开始日期前一天
|
|
|
- String str = "2023-04-30";
|
|
|
+ String str = adapterUrl;
|
|
|
|
|
|
DateTime dateTime = DateUtil.parse(str);
|
|
|
DateTime dateTime1 = dateTime;
|