Commit b647e62c by levphon

设备位置点数据落库单元测试

1 parent 83008498
package cn.com.glsx.stdinterface.modules.service; package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.stdinterface.modules.mapper.ElectricInStoreMapper; import cn.com.glsx.stdinterface.dto.DeviceLocationDto;
import cn.com.glsx.stdinterface.modules.entity.VehicleDevice; import cn.com.glsx.stdinterface.modules.entity.VehicleDevice;
import cn.com.glsx.stdinterface.modules.mapper.DeviceLocationMapper;
import cn.com.glsx.stdinterface.modules.mapper.ElectricInStoreMapper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.util.HashMap; import javax.annotation.Resource;
import java.util.List; import java.util.*;
import java.util.Map;
@Slf4j @Slf4j
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
...@@ -25,6 +27,9 @@ class ElectricInStoreServiceTest { ...@@ -25,6 +27,9 @@ class ElectricInStoreServiceTest {
@Autowired @Autowired
ElectricInStoreMapper electricInStoreMapper; ElectricInStoreMapper electricInStoreMapper;
@Resource
private DeviceLocationMapper deviceLocationMapper;
@Test @Test
public void calculateInStoreDateEveryDay() { public void calculateInStoreDateEveryDay() {
System.out.println("electricInStoreService start=== "); System.out.println("electricInStoreService start=== ");
...@@ -42,4 +47,22 @@ class ElectricInStoreServiceTest { ...@@ -42,4 +47,22 @@ class ElectricInStoreServiceTest {
System.out.println("allSnVdIdMap = " + JSON.toJSONString(snVdIdMap)); System.out.println("allSnVdIdMap = " + JSON.toJSONString(snVdIdMap));
} }
@Test
public void testBatchHandleDeviceLocation() {
Collection<DeviceLocationDto> list = Lists.newArrayList();
DeviceLocationDto locationDto = new DeviceLocationDto();
locationDto.setSn("123456789");
locationDto.setSpeed(500);
locationDto.setLastGpsTime(new Date());
DeviceLocationDto locationDto2 = new DeviceLocationDto();
locationDto2.setSn("123456788");
locationDto2.setSpeed(1500);
locationDto2.setLastGpsTime(new Date());
list.add(locationDto);
list.add(locationDto2);
deviceLocationMapper.batchInsertOrUpdate(list);
}
} }
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!