From 8c24b294ea3c87512c1047deaf7bd70f13e51c68 Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Thu, 29 Jul 2021 17:39:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B4=B9=E7=8E=87=EF=BC=8Cid?= =?UTF-8?q?=20Long=E5=8F=98=E6=88=90String=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/XhpcChargingPileMapper.java | 1 - .../XhpcChargingStationServiceImpl.java | 46 +++++++++++-------- .../mapper/XhpcChargingPileMapper.xml | 2 +- .../mapper/XhpcChargingStationMapper.xml | 4 +- .../main/resources/mapper/XhpcRateMapper.xml | 1 + .../resources/mapper/XhpcRateTimeMapper.xml | 1 + .../resources/mapper/XhpcTerminalMapper.xml | 1 + .../api/dto/XhpcChargingStationDto.java | 6 +-- .../com/xhpc/common/api/dto/XhpcRateDto.java | 6 +-- .../xhpc/common/api/dto/XhpcRateTimeDto.java | 6 +-- .../java/com/xhpc/common/domain/XhpcRate.java | 13 ++++++ .../com/xhpc/common/domain/XhpcRateTime.java | 14 ++++++ 12 files changed, 70 insertions(+), 31 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java index 3433acc0..b7d66b72 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/mapper/XhpcChargingPileMapper.java @@ -1,7 +1,6 @@ package com.xhpc.charging.station.mapper; import com.xhpc.common.domain.XhpcChargingPile; -import com.xhpc.common.domain.XhpcChargingStation; import org.apache.ibatis.annotations.Param; import java.util.List; diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index 74be454e..a2bd42c2 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -306,7 +306,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi Long chargingStationId = xhpcChargingStation.getChargingStationId(); //添加费率 - Map map =new HashMap<>(); + Map map =new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { //存费率信息,并存储Map,费率时段使用,找到费率id @@ -317,6 +317,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); xhpcRate.setServiceFee(xhpcRateDto.getServiceFee()); xhpcRate.setRateModelId(rateModelId); + xhpcRate.setRateValue(xhpcRateDto.getId()); xhpcChargingStationMapper.addXhpcRate(xhpcRate); map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); } @@ -336,39 +337,43 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ defaultPeriodId=map.get(xhpcChargingStationDto.getDefaultPeriodId()); } + //默认费率类型值 + String rateValue =xhpcChargingStationDto.getDefaultPeriodId(); int sort =1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); String startTime = xhpcRateTimeDto.getStartTime(); String endTime = xhpcRateTimeDto.getEndTime(); - Long defaultPeriodIdMap = map.get(xhpcRateTimeDto.getId()); + String rateValues = xhpcRateTimeDto.getId(); + Long defaultPeriodIdMap = map.get(rateValues); + if(k==0){ if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){ //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue); } //并把本条数据也添加上 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues); }else if(k map =new HashMap<>(); + Map map =new HashMap<>(); List xhpcRateList = xhpcChargingStationDto.getXhpcRateList(); for (int k = 0; k < xhpcRateList.size(); k++) { //存费率信息,并存储Map,费率时段使用,找到费率id @@ -643,6 +649,7 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); xhpcRate.setServiceFee(xhpcRateDto.getServiceFee()); xhpcRate.setRateModelId(rateModelId); + xhpcRate.setRateValue(xhpcRateDto.getId()); xhpcChargingStationMapper.addXhpcRate(xhpcRate); map.put(xhpcRateDto.getId(),xhpcRate.getRateId()); } @@ -662,39 +669,42 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi if(xhpcChargingStationDto.getDefaultPeriodId() !=null){ defaultPeriodId=map.get(xhpcChargingStationDto.getDefaultPeriodId()); } + //默认费率类型值 + String rateValue =xhpcChargingStationDto.getDefaultPeriodId(); int sort =1; for (int k = 0; k < list.size(); k++) { XhpcRateTimeDto xhpcRateTimeDto = list.get(k); String startTime = xhpcRateTimeDto.getStartTime(); String endTime = xhpcRateTimeDto.getEndTime(); Long defaultPeriodIdMap = map.get(xhpcRateTimeDto.getId()); + String rateValues = xhpcRateTimeDto.getId(); if(k==0){ if(!"00:00:00".equals(xhpcRateTimeDto.getStartTime())){ //添加一条默认费率时段 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodId,"00:00:00",startTime,sort,2,rateValue); } //并把本条数据也添加上 - sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1); + sort = addXhpcRateTime(chargingStationId,rateModelId,defaultPeriodIdMap,startTime,endTime,sort,1,rateValues); }else if(k - + update xhpc_charging_pile charging_station_id = #{chargingStationId}, diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml index cf7e1ee2..dca26a0e 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcChargingStationMapper.xml @@ -156,7 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update xhpc_charging_station set del_flag =1 where charging_station_id = #{chargingStationId} - + update xhpc_charging_station set del_flag =1 where charging_station_id in #{chargingStationId} @@ -726,7 +726,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update xhpc_rate_time set del_flag =1 where charging_station_id = #{chargingStationId} and del_flag =0 - select serial_number as pileNo from xhpc_charging_pile diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml index 4b4998ef..6c5ca284 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateMapper.xml @@ -17,6 +17,7 @@ + \ No newline at end of file diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml index 4af2d986..a7674e55 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/mapper/XhpcRateTimeMapper.xml @@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +