mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 卡启动、vin启动逻辑修改
This commit is contained in:
@@ -1637,125 +1637,116 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
wxAppletRemoteService.startChargingSendMsg(sendMsgDTO);
|
||||
|
||||
// return map;
|
||||
return map;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String pileSn = dto.getPileSn();
|
||||
String connectorCode = dto.getConnectorCode();
|
||||
String startMode = dto.getStartMode();
|
||||
String logicCard = "";
|
||||
String memberId = "";
|
||||
String vinCode = "";
|
||||
PileAuthCard pileAuthCardInfo = new PileAuthCard();
|
||||
// CarVinInfoVO carVinInfoVO = new CarVinInfoVO();
|
||||
MemberPlateNumberRelation relation = new MemberPlateNumberRelation();
|
||||
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||
// 刷卡启动充电
|
||||
pileAuthCardInfo = dto.getPileAuthCardInfo();
|
||||
memberId = pileAuthCardInfo.getMemberId();
|
||||
logicCard = pileAuthCardInfo.getLogicCard();
|
||||
}else if (StringUtils.equals(StartModeEnum.VIN_CODE.getValue(), startMode)) {
|
||||
logger.info("车辆vin启动充电 params:{}", JSON.toJSONString(dto));
|
||||
// vin启动充电
|
||||
relation = dto.getMemberPlateNumberRelation();
|
||||
memberId = relation.getMemberId();
|
||||
vinCode = relation.getVinCode();
|
||||
}
|
||||
// 通过memberId获取账户余额
|
||||
// MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(memberId);
|
||||
// if (memberVO == null) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
||||
// String pileSn = dto.getPileSn();
|
||||
// String connectorCode = dto.getConnectorCode();
|
||||
// String startMode = dto.getStartMode();
|
||||
// String logicCard = "";
|
||||
// String memberId = "";
|
||||
// String vinCode = "";
|
||||
// PileAuthCard pileAuthCardInfo = new PileAuthCard();
|
||||
// // CarVinInfoVO carVinInfoVO = new CarVinInfoVO();
|
||||
// MemberPlateNumberRelation relation = new MemberPlateNumberRelation();
|
||||
// if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||
// // 刷卡启动充电
|
||||
// pileAuthCardInfo = dto.getPileAuthCardInfo();
|
||||
// memberId = pileAuthCardInfo.getMemberId();
|
||||
// logicCard = pileAuthCardInfo.getLogicCard();
|
||||
// }else if (StringUtils.equals(StartModeEnum.VIN_CODE.getValue(), startMode)) {
|
||||
// logger.info("车辆vin启动充电 params:{}", JSON.toJSONString(dto));
|
||||
// // vin启动充电
|
||||
// relation = dto.getMemberPlateNumberRelation();
|
||||
// memberId = relation.getMemberId();
|
||||
// vinCode = relation.getVinCode();
|
||||
// }
|
||||
// BigDecimal totalAccountAmount = memberVO.getTotalAccountAmount();
|
||||
// if (totalAccountAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
// throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
||||
// // 通过memberId获取账户余额
|
||||
// // MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(memberId);
|
||||
// // if (memberVO == null) {
|
||||
// // throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
||||
// // }
|
||||
// // BigDecimal totalAccountAmount = memberVO.getTotalAccountAmount();
|
||||
// // if (totalAccountAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
// // throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
||||
// // }
|
||||
//
|
||||
// String transactionCode = IdUtils.generateTransactionCode(pileSn, connectorCode);
|
||||
// // 通过桩号查询所属站点
|
||||
// PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
// Long stationId = pileBasicInfo.getStationId();
|
||||
// PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(stationId);
|
||||
// String merchantId = pileStationInfo != null ? String.valueOf(pileStationInfo.getMerchantId()) : "";
|
||||
// // 自动余额全部支付订单 个人桩站点不计费
|
||||
//
|
||||
// // 将此订单信息存入订单表
|
||||
// String orderCode = IdUtils.getOrderCode();
|
||||
// // 订单基本信息
|
||||
// OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
||||
// .orderCode(orderCode)
|
||||
// .transactionCode(transactionCode)
|
||||
// .orderStatus(OrderStatusEnum.NOT_START.getValue())
|
||||
// .memberId(memberVO.getMemberId())
|
||||
// .stationId(String.valueOf(stationId))
|
||||
// .merchantId(merchantId)
|
||||
// .pileSn(pileSn)
|
||||
// .connectorCode(connectorCode)
|
||||
// .pileConnectorCode(pileSn + connectorCode)
|
||||
// .logicCard(logicCard)
|
||||
// .vinCode(vinCode)
|
||||
// .startMode(startMode)
|
||||
// .payStatus(Constants.ONE)
|
||||
// .payAmount(totalAccountAmount)
|
||||
// .payTime(new Date())
|
||||
// .payMode(OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue())
|
||||
// .orderAmount(BigDecimal.ZERO)
|
||||
// .virtualAmount(BigDecimal.ZERO)
|
||||
// .settleAmount(BigDecimal.ZERO)
|
||||
// .build();
|
||||
// // 根据桩编码查询当前计费模板
|
||||
// BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
// // 订单详情
|
||||
// OrderDetail orderDetail = OrderDetail.builder()
|
||||
// .orderCode(orderCode)
|
||||
// .sharpElectricityPrice(billingTemplateVO.getSharpElectricityPrice())
|
||||
// .sharpServicePrice(billingTemplateVO.getSharpServicePrice())
|
||||
// .peakElectricityPrice(billingTemplateVO.getPeakElectricityPrice())
|
||||
// .peakServicePrice(billingTemplateVO.getPeakServicePrice())
|
||||
// .flatElectricityPrice(billingTemplateVO.getFlatElectricityPrice())
|
||||
// .flatServicePrice(billingTemplateVO.getFlatServicePrice())
|
||||
// .valleyElectricityPrice(billingTemplateVO.getValleyElectricityPrice())
|
||||
// .valleyServicePrice(billingTemplateVO.getValleyServicePrice())
|
||||
// .build();
|
||||
//
|
||||
// OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder()
|
||||
// .orderBasicInfo(orderBasicInfo)
|
||||
// .orderDetail(orderDetail)
|
||||
// .build();
|
||||
// pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
||||
//
|
||||
// if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||
// // 将卡状态改为启动锁定
|
||||
// PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
// .id(pileAuthCardInfo.getId())
|
||||
// .logicCard(pileAuthCardInfo.getLogicCard())
|
||||
// .status("2")
|
||||
// .build();
|
||||
// pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
||||
// } else if (StringUtils.equals(StartModeEnum.VIN_CODE.getValue(), startMode)) {
|
||||
// // 将vin码改成启动锁定
|
||||
// relation.setVinStatus("2");
|
||||
// memberPlateNumberRelationService.updateMemberPlateNumberRelation(relation);
|
||||
// }
|
||||
|
||||
String transactionCode = IdUtils.generateTransactionCode(pileSn, connectorCode);
|
||||
// 通过桩号查询所属站点
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
Long stationId = pileBasicInfo.getStationId();
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(stationId);
|
||||
String merchantId = pileStationInfo != null ? String.valueOf(pileStationInfo.getMerchantId()) : "";
|
||||
// 自动余额全部支付订单 个人桩站点不计费
|
||||
|
||||
// 将此订单信息存入订单表
|
||||
String orderCode = IdUtils.getOrderCode();
|
||||
// 订单基本信息
|
||||
OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
|
||||
.orderCode(orderCode)
|
||||
.transactionCode(transactionCode)
|
||||
.orderStatus(OrderStatusEnum.NOT_START.getValue())
|
||||
.memberId(memberVO.getMemberId())
|
||||
.stationId(String.valueOf(stationId))
|
||||
.merchantId(merchantId)
|
||||
.pileSn(pileSn)
|
||||
.connectorCode(connectorCode)
|
||||
.pileConnectorCode(pileSn + connectorCode)
|
||||
.logicCard(logicCard)
|
||||
.vinCode(vinCode)
|
||||
.startMode(startMode)
|
||||
.payStatus(Constants.ONE)
|
||||
.payAmount(totalAccountAmount)
|
||||
.payTime(new Date())
|
||||
.payMode(OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue())
|
||||
.orderAmount(BigDecimal.ZERO)
|
||||
.virtualAmount(BigDecimal.ZERO)
|
||||
.settleAmount(BigDecimal.ZERO)
|
||||
.build();
|
||||
// 根据桩编码查询当前计费模板
|
||||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
// 订单详情
|
||||
OrderDetail orderDetail = OrderDetail.builder()
|
||||
.orderCode(orderCode)
|
||||
.sharpElectricityPrice(billingTemplateVO.getSharpElectricityPrice())
|
||||
.sharpServicePrice(billingTemplateVO.getSharpServicePrice())
|
||||
.peakElectricityPrice(billingTemplateVO.getPeakElectricityPrice())
|
||||
.peakServicePrice(billingTemplateVO.getPeakServicePrice())
|
||||
.flatElectricityPrice(billingTemplateVO.getFlatElectricityPrice())
|
||||
.flatServicePrice(billingTemplateVO.getFlatServicePrice())
|
||||
.valleyElectricityPrice(billingTemplateVO.getValleyElectricityPrice())
|
||||
.valleyServicePrice(billingTemplateVO.getValleyServicePrice())
|
||||
.build();
|
||||
|
||||
OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder()
|
||||
.orderBasicInfo(orderBasicInfo)
|
||||
.orderDetail(orderDetail)
|
||||
.build();
|
||||
pileTransactionService.doCreateOrder(createOrderTransactionDTO);
|
||||
|
||||
if (StringUtils.equals(StartModeEnum.AUTH_CARD.getValue(), startMode)) {
|
||||
// 将卡状态改为启动锁定
|
||||
PileAuthCard pileAuthCard = PileAuthCard.builder()
|
||||
.id(pileAuthCardInfo.getId())
|
||||
.logicCard(pileAuthCardInfo.getLogicCard())
|
||||
.status("2")
|
||||
.build();
|
||||
pileAuthCardService.updatePileAuthCard(pileAuthCard);
|
||||
} else if (StringUtils.equals(StartModeEnum.VIN_CODE.getValue(), startMode)) {
|
||||
// 将vin码改成启动锁定
|
||||
relation.setVinStatus("2");
|
||||
memberPlateNumberRelationService.updateMemberPlateNumberRelation(relation);
|
||||
}
|
||||
|
||||
// 组装结果集
|
||||
Map<String, Object> resultMap = Maps.newHashMap();
|
||||
resultMap.put("orderCode", orderBasicInfo.getOrderCode());
|
||||
resultMap.put("transactionCode", orderBasicInfo.getTransactionCode());
|
||||
resultMap.put("accountBalance", totalAccountAmount);
|
||||
|
||||
logger.info("生成订单 result:{}", JSON.toJSONString(resultMap));
|
||||
return resultMap;
|
||||
//
|
||||
// // 组装结果集
|
||||
// Map<String, Object> resultMap = Maps.newHashMap();
|
||||
// resultMap.put("orderCode", orderBasicInfo.getOrderCode());
|
||||
// resultMap.put("transactionCode", orderBasicInfo.getTransactionCode());
|
||||
// resultMap.put("accountBalance", totalAccountAmount);
|
||||
//
|
||||
// logger.info("生成订单 result:{}", JSON.toJSONString(resultMap));
|
||||
// return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user