Merge remote-tracking branch 'origin/master'

This commit is contained in:
little-cat-sweet 2021-08-04 17:58:05 +08:00
commit af68f5c475
6 changed files with 56 additions and 32 deletions

View File

@ -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);

View File

@ -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);

View File

@ -543,7 +543,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
</if>
<if test="null != remark and '' != remark">
remark
remark,
</if>
<if test="null != rateValue">
rate_value
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -578,7 +581,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
#{remark},
</if>
<if test="null != rateValue">
#{rateValue}
</if>
</trim>
</insert>
@ -625,10 +631,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
</if>
<if test="null != remark and '' != remark">
remark
remark,
</if>
<if test="null != type ">
type
type,
</if>
<if test="null != rateValue ">
rate_value
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -669,10 +678,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
#{remark},
</if>
<if test="null != type ">
#{type}
#{type},
</if>
<if test="null != rateValue ">
#{rateValue}
</if>
</trim>
</insert>
@ -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

View File

@ -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<String> 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);

View File

@ -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<PowerPileServic
return R.fail("删除充电桩白名单失败:" + cause.getMessage());
}
@Override
public R terminalStatus(String terminalSn) {
return R.fail("查询终端状态失败:" + cause.getMessage());
}
@Override
public R setStationRateModel(Long stationId, Long rateModelId, CacheRateModel rateModel) {

View File

@ -2,10 +2,7 @@ package com.xhpc.pp.controller;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.core.domain.R;
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.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.Set;
@ -64,4 +61,10 @@ public class PileController {
return R.ok();
}
@GetMapping("terminal/{terminalSn}/status")
public Object terminalStatus(@PathVariable("terminalSn")String terminalSn) {
return R.ok();
}
}