diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java index e668066b..06eab553 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingPileServiceImpl.java @@ -59,8 +59,8 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{ XhpcTerminal xhpcTerminal =new XhpcTerminal(); xhpcTerminal.setChargingStationId(chargingStationId); xhpcTerminal.setChargingPileId(chargingPileId); - xhpcTerminal.setName(serialNumber + "-" + (i + 1)); - xhpcTerminal.setPileSerialNumber(serialNumber); + xhpcTerminal.setName(serialNumber + "-" + (i)); + xhpcTerminal.setPileSerialNumber(serialNumber+ "0" + i); xhpcTerminal.setWorkStatus(2); xhpcTerminal.setStatus(0); xhpcTerminalMapper.addXhpcTerminal(xhpcTerminal); 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 68fd7948..032cd781 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 @@ -1,10 +1,13 @@ package com.xhpc.charging.station.service; -import cn.hutool.core.date.BetweenFormatter; + import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; +import com.xhpc.charging.station.mapper.XhpcChargingStationMapper; import com.xhpc.common.api.PowerPileService; -import com.xhpc.common.api.dto.ChargingPileDto; +import com.xhpc.common.api.dto.XhpcChargingStationDto; +import com.xhpc.common.api.dto.XhpcRateDto; +import com.xhpc.common.api.dto.XhpcRateTimeDto; import com.xhpc.common.core.domain.R; import com.xhpc.common.core.utils.DateUtils; import com.xhpc.common.core.web.domain.AjaxResult; @@ -13,14 +16,8 @@ import com.xhpc.common.domain.XhpcChargingStation; import com.xhpc.common.domain.XhpcRate; import com.xhpc.common.domain.XhpcRateModel; import com.xhpc.common.domain.XhpcRateTime; -import com.xhpc.common.api.dto.XhpcChargingStationDto; -import com.xhpc.common.api.dto.XhpcRateDto; -import com.xhpc.common.api.dto.XhpcRateTimeDto; -import com.xhpc.charging.station.mapper.XhpcChargingStationMapper; -import org.checkerframework.checker.units.qual.A; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.annotation.Version; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -330,7 +327,15 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi XhpcRateDto xhpcRateDto = xhpcRateList.get(k); XhpcRate xhpcRate =new XhpcRate(); xhpcRate.setChargingStationId(chargingStationId); - xhpcRate.setName(xhpcRateDto.getName()); + if("00".equals(xhpcRateDto.getId())){ + xhpcRate.setName("尖费率"); + }else if ("01".equals(xhpcRateDto.getId())){ + xhpcRate.setName("峰费率"); + }else if ("02".equals(xhpcRateDto.getId())){ + xhpcRate.setName("平费率"); + }else{ + xhpcRate.setName("谷费率"); + } xhpcRate.setPowerFee(xhpcRateDto.getPowerFee()); xhpcRate.setServiceFee(xhpcRateDto.getServiceFee()); xhpcRate.setRateModelId(rateModelId); 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 0ebb4bd9..b96f9be6 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 @@ -543,7 +543,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, - remark + remark, + + + rate_value @@ -578,7 +581,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, - #{remark} + #{remark}, + + + #{rateValue} @@ -625,10 +631,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by, - remark + remark, - type + type, + + + rate_value @@ -669,10 +678,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateBy}, - #{remark} + #{remark}, - #{type} + #{type}, + + + #{rateValue} @@ -682,7 +694,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" power_fee as powerFee, service_fee as serviceFee, name as name, - rate_value as rateValue + rate_value as id from xhpc_rate where charging_station_id=#{chargingStationId} and del_flag =0 GROUP BY rate_value @@ -694,7 +706,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" rt.start_time as startTime, replace(rt.end_time,'00:00:00','24:00:00') AS endTime, rt.rate_id as rateId, - rt.rate_value as rateValue, + rt.rate_value as id, ra.name as rateName from xhpc_rate_time as rt left join xhpc_rate as ra on ra.rate_id =rt.rate_id @@ -705,7 +717,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" rt.start_time as startTime, replace(rt.end_time,'00:00:00','24:00:00') AS endTime, rt.rate_id as rateId, - rt.rate_value as rateValue, + rt.rate_value as id, ra.name as rateName from xhpc_rate_time as rt left join xhpc_rate as ra on ra.rate_id =rt.rate_id diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java index 83e05df7..076626ce 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PowerPileService.java @@ -1,18 +1,14 @@ package com.xhpc.common.api; -import com.xhpc.common.api.dto.ChargingPileDto; +import com.xhpc.common.api.factory.PowerPileFallbackFactory; import com.xhpc.common.core.constant.ServiceNameConstants; import com.xhpc.common.core.domain.R; -import com.xhpc.common.api.factory.PowerPileFallbackFactory; import com.xhpc.common.data.down.StartChargingData; import com.xhpc.common.data.redis.CacheRateModel; import org.apache.ibatis.annotations.Param; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.*; import java.util.Set; @@ -28,6 +24,9 @@ public interface PowerPileService { @DeleteMapping("/pile/whitelist/delete/{stationId}") R deletePileWhitelist(@PathVariable("stationId") Long stationId, @RequestBody Set pileNoSet); + @GetMapping("terminal/{terminalSn}/status") + R terminalStatus(@PathVariable("terminalSn")String terminalSn); + @PostMapping("/station/rateModel/{stationId}/{rateModelId}") R setStationRateModel(@PathVariable("stationId") @Param("stationId") Long stationId, @PathVariable("rateModelId") @Param("rateModelId") Long rateModelId, @RequestBody @Param("rateModel") CacheRateModel rateModel); diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java index 147c6328..74bbdea8 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PowerPileFallbackFactory.java @@ -1,8 +1,7 @@ package com.xhpc.common.api.factory; -import com.xhpc.common.api.dto.ChargingPileDto; -import com.xhpc.common.core.domain.R; import com.xhpc.common.api.PowerPileService; +import com.xhpc.common.core.domain.R; import com.xhpc.common.data.down.StartChargingData; import com.xhpc.common.data.redis.CacheRateModel; import org.slf4j.Logger; @@ -41,6 +40,12 @@ public class PowerPileFallbackFactory implements FallbackFactory