mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-19 06:39:50 +08:00
同步充电桩数据
This commit is contained in:
@@ -8,7 +8,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -52,7 +51,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("LOGIN")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(loginData)
|
||||
.data(JSON.toJSONString(loginData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -77,7 +76,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("HEARTBEAT")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(heartbeatData)
|
||||
.data(JSON.toJSONString(heartbeatData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -101,7 +100,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("QUERY_PRICING")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(queryData)
|
||||
.data(JSON.toJSONString(queryData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -130,7 +129,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("START_CHARGE")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(startData)
|
||||
.data(JSON.toJSONString(startData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -163,7 +162,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("REAL_TIME_DATA")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(realTimeData)
|
||||
.data(JSON.toJSONString(realTimeData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -196,7 +195,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("TRANSACTION_RECORD")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(transactionData)
|
||||
.data(JSON.toJSONString(transactionData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -224,7 +223,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("REMOTE_START_RESULT")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(resultData)
|
||||
.data(JSON.toJSONString(resultData))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
@@ -245,7 +244,7 @@ public class JcppMessageControllerTest {
|
||||
.pileCode("TEST001")
|
||||
.messageType("INVALID_TYPE")
|
||||
.timestamp(System.currentTimeMillis())
|
||||
.data(new HashMap<>())
|
||||
.data(JSON.toJSONString(new HashMap<>()))
|
||||
.build();
|
||||
|
||||
mockMvc.perform(post("/api/jcpp/uplink")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jsowell.jcpp;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.pile.jcpp.dto.JcppPricingModel;
|
||||
import com.jsowell.pile.jcpp.util.PricingModelConverter;
|
||||
import com.jsowell.pile.vo.web.BillingDetailVO;
|
||||
@@ -25,17 +26,17 @@ public class PricingModelConverterTest {
|
||||
@Test
|
||||
public void testConvertStandardPricing() {
|
||||
BillingTemplateVO template = new BillingTemplateVO();
|
||||
template.setId(1L);
|
||||
template.setName("标准计费模板");
|
||||
template.setTemplateId("1L");
|
||||
template.setTemplateName("标准计费模板");
|
||||
|
||||
List<BillingDetailVO> details = new ArrayList<>();
|
||||
BillingDetailVO detail = new BillingDetailVO();
|
||||
detail.setTimeType("3"); // 平时
|
||||
detail.setElectricityPrice(new BigDecimal("0.8"));
|
||||
detail.setServicePrice(new BigDecimal("0.4"));
|
||||
detail.setApplyTime("00:00-24:00");
|
||||
detail.setApplyTime(Lists.newArrayList("00:00-24:00"));
|
||||
details.add(detail);
|
||||
template.setBillingDetailList(details);
|
||||
// template.setBillingDetailList(details);
|
||||
|
||||
JcppPricingModel model = PricingModelConverter.convert(template);
|
||||
|
||||
@@ -53,8 +54,8 @@ public class PricingModelConverterTest {
|
||||
@Test
|
||||
public void testConvertPeakValleyPricing() {
|
||||
BillingTemplateVO template = new BillingTemplateVO();
|
||||
template.setId(2L);
|
||||
template.setName("峰谷计费模板");
|
||||
template.setTemplateId("2L");
|
||||
template.setTemplateName("峰谷计费模板");
|
||||
|
||||
List<BillingDetailVO> details = new ArrayList<>();
|
||||
|
||||
@@ -63,7 +64,7 @@ public class PricingModelConverterTest {
|
||||
sharpDetail.setTimeType("1");
|
||||
sharpDetail.setElectricityPrice(new BigDecimal("1.2"));
|
||||
sharpDetail.setServicePrice(new BigDecimal("0.6"));
|
||||
sharpDetail.setApplyTime("10:00-12:00,18:00-20:00");
|
||||
sharpDetail.setApplyTime(Lists.newArrayList("10:00-12:00","18:00-20:00"));
|
||||
details.add(sharpDetail);
|
||||
|
||||
// 峰时
|
||||
@@ -71,7 +72,7 @@ public class PricingModelConverterTest {
|
||||
peakDetail.setTimeType("2");
|
||||
peakDetail.setElectricityPrice(new BigDecimal("1.0"));
|
||||
peakDetail.setServicePrice(new BigDecimal("0.5"));
|
||||
peakDetail.setApplyTime("08:00-10:00,12:00-18:00");
|
||||
peakDetail.setApplyTime(Lists.newArrayList("08:00-10:00","12:00-18:00"));
|
||||
details.add(peakDetail);
|
||||
|
||||
// 平时
|
||||
@@ -79,7 +80,7 @@ public class PricingModelConverterTest {
|
||||
flatDetail.setTimeType("3");
|
||||
flatDetail.setElectricityPrice(new BigDecimal("0.8"));
|
||||
flatDetail.setServicePrice(new BigDecimal("0.4"));
|
||||
flatDetail.setApplyTime("06:00-08:00,20:00-22:00");
|
||||
flatDetail.setApplyTime(Lists.newArrayList("06:00-08:00","20:00-22:00"));
|
||||
details.add(flatDetail);
|
||||
|
||||
// 谷时
|
||||
@@ -87,10 +88,10 @@ public class PricingModelConverterTest {
|
||||
valleyDetail.setTimeType("4");
|
||||
valleyDetail.setElectricityPrice(new BigDecimal("0.4"));
|
||||
valleyDetail.setServicePrice(new BigDecimal("0.2"));
|
||||
valleyDetail.setApplyTime("00:00-06:00,22:00-24:00");
|
||||
valleyDetail.setApplyTime(Lists.newArrayList("00:00-06:00","22:00-24:00"));
|
||||
details.add(valleyDetail);
|
||||
|
||||
template.setBillingDetailList(details);
|
||||
// template.setBillingDetailList(details);
|
||||
|
||||
JcppPricingModel model = PricingModelConverter.convert(template);
|
||||
|
||||
@@ -131,9 +132,9 @@ public class PricingModelConverterTest {
|
||||
@Test
|
||||
public void testConvertTemplateWithoutDetails() {
|
||||
BillingTemplateVO template = new BillingTemplateVO();
|
||||
template.setId(3L);
|
||||
template.setName("无详情模板");
|
||||
template.setBillingDetailList(null);
|
||||
template.setTemplateId("3L");
|
||||
template.setTemplateName("无详情模板");
|
||||
// template.setBillingDetailList(null);
|
||||
|
||||
JcppPricingModel model = PricingModelConverter.convert(template);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user