保存蓝牙充电记录

This commit is contained in:
Guoqs
2024-11-19 16:20:10 +08:00
parent 4df6a9f53a
commit 54d9a4e91e
4 changed files with 183 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ import com.jsowell.pile.vo.PileReservationInfoVO;
import com.jsowell.pile.vo.uniapp.customer.PersonPileConnectorSumInfoVO;
import com.jsowell.pile.vo.uniapp.customer.PersonPileRealTimeVO;
import com.jsowell.pile.vo.uniapp.customer.PersonalPileInfoVO;
import com.jsowell.service.OrderService;
import com.jsowell.service.PileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -39,6 +40,9 @@ public class PersonPileController extends BaseController {
@Autowired
private PileService pileService;
@Autowired
private OrderService orderService;
@Autowired
private PileMerchantInfoService pileMerchantInfoService;
@@ -482,4 +486,27 @@ public class PersonPileController extends BaseController {
logger.info("根据充电桩查询预约状态params:{}, result:{}", dto, JSON.toJSONString(response));
return response;
}
/**
* 保存蓝牙充电记录
* http://localhost:8080/uniapp/personalPile/saveBluetoothChargingRecord
*/
@PostMapping("/saveBluetoothChargingRecord")
public RestApiResponse<?> saveBluetoothChargingRecord(HttpServletRequest request, @RequestBody BluetoothChargingRecordDTO dto) {
RestApiResponse<?> response = null;
try {
String memberId = getMemberIdByAuthorization(request);
dto.setMemberId(memberId);
orderService.saveBluetoothChargingRecord(dto);
response = new RestApiResponse<>();
} catch (BusinessException e) {
logger.error("保存蓝牙充电记录error, params:{}", dto, e);
response = new RestApiResponse<>(e.getCode(), e.getMessage());
} catch (Exception e) {
logger.error("保存蓝牙充电记录error, params:{}", dto, e);
response = new RestApiResponse<>(ReturnCodeEnum.CODE_QUERY_RESERVATION_STATUS_ERROR);
}
logger.info("保存蓝牙充电记录params:{}, result:{}", dto, JSON.toJSONString(response));
return response;
}
}

View File

@@ -1445,4 +1445,11 @@ public class OrderService {
// }
return true;
}
/**
* 保存蓝牙充电记录
* @param dto
*/
public void saveBluetoothChargingRecord(BluetoothChargingRecordDTO dto) {
}
}

View File

@@ -368,6 +368,16 @@ public class YKCUtils {
}
}
/**
* 根据的交易码获取当前soc
* @param transactionCode
*/
public static String getCurrentSOC(String transactionCode) {
String hashKey = CacheConstants.GET_THE_SOC + transactionCode;
RedisCache staticRedisCache = StaticRedisCache.staticRedisCache;
Map<String, Object> cacheMap = staticRedisCache.getCacheMap(hashKey);
// 获取最小值和最大值, 两个值中最大的为当前soc
return (String) cacheMap.get("max");
}
}

View File

@@ -0,0 +1,138 @@
package com.jsowell.pile.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 蓝牙充电记录
*/
@Data
public class BluetoothChargingRecordDTO {
// 会员id
private String memberId;
// 充电流水号
@JsonProperty(value = "TrxSN")
private String trxSN;
// 桩号
@JsonProperty(value = "PileNo")
private String pileNo;
// 枪号
@JsonProperty(value = "PlugNo")
private String plugNo;
// 启动充电时间
@JsonProperty(value = "StartTime")
private String startTime;
// 结束充电时间
@JsonProperty(value = "EndTime")
private String endTime;
// 尖单价
@JsonProperty(value = "PriceSharp")
private String priceSharp;
// 尖电量
@JsonProperty(value = "EnergySharp")
private String energySharp;
// 记损尖电量
@JsonProperty(value = "LossKwhSharp")
private String lossKwhSharp;
// 尖金额
@JsonProperty(value = "MoneySharp")
private String moneySharp;
// 峰单价
@JsonProperty(value = "PricePeak")
private String pricePeak;
// 峰电量
@JsonProperty(value = "EnergyPeak")
private String energyPeak;
// 记损峰电量
@JsonProperty(value = "LossKwhPeak")
private String lossKwhPeak;
// 峰金额
@JsonProperty(value = "MoneyPeak")
private String moneyPeak;
// 平单价
@JsonProperty(value = "PriceFlat")
private String priceFlat;
// 平电量
@JsonProperty(value = "EnergyFlat")
private String energyFlat;
// 记损平电量
@JsonProperty(value = "LossKwhFlat")
private String lossKwhFlat;
// 平金额
@JsonProperty(value = "MoneyFlat")
private String moneyFlat;
// 谷单价
@JsonProperty(value = "PriceValley")
private String priceValley;
// 谷电量
@JsonProperty(value = "EnergyValley")
private String energyValley;
// 记损谷电量
@JsonProperty(value = "LossKwhValley")
private String lossKwhValley;
// 谷金额
@JsonProperty(value = "MoneyValley")
private String moneyValley;
// 电表总起值
@JsonProperty(value = "StartKwh")
private String startKwh;
// 电表总止值
@JsonProperty(value = "StopKwh")
private String stopKwh;
// 总电量
@JsonProperty(value = "TotalEnergy")
private String totalEnergy;
// 记损总电量
@JsonProperty(value = "LossTotalKwh")
private String lossTotalKwh;
// 消费金额
@JsonProperty(value = "TotalMoney")
private String totalMoney;
// 电动汽车唯一标识
@JsonProperty(value = "VIN")
private String vin;
// 电动汽车唯一标识
@JsonProperty(value = "StartMode")
private String startMode;
// 交易日期时间
@JsonProperty(value = "TradeTime")
private String tradeTime;
// 停止原因
@JsonProperty(value = "StopReason")
private String stopReason;
// 物理卡号
@JsonProperty(value = "PCardID")
private String pCardID;
}