mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-10 18:30:02 +08:00
update 电单车协议
This commit is contained in:
@@ -74,7 +74,6 @@ import javax.annotation.Resource;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -574,21 +573,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
|
||||||
String str1 = "2024-08-12 09:41:02";
|
|
||||||
// Date time = Date.parse();
|
|
||||||
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
Date parse = null;
|
|
||||||
try {
|
|
||||||
parse = sdf1.parse(str1);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(currentTimeMillis - parse.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询充电中的订单,没有数据权限校验,后管不要用
|
* 查询充电中的订单,没有数据权限校验,后管不要用
|
||||||
*
|
*
|
||||||
@@ -2983,22 +2967,46 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
*
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
|
// @Override
|
||||||
|
// public void analysisPileParameter(BasicPileDTO dto) {
|
||||||
|
// if (StringUtils.isBlank(dto.getPileSn()) || StringUtils.isBlank(dto.getConnectorCode())) {
|
||||||
|
// // 从pileConnectorCode解析
|
||||||
|
// String pileConnectorCode = dto.getPileConnectorCode();
|
||||||
|
// // dto.setPileSn(StringUtils.substring(pileConnectorCode, 0, pileConnectorCode.length() - 2));
|
||||||
|
// // dto.setConnectorCode(StringUtils.substring(pileConnectorCode, pileConnectorCode.length() - 2, pileConnectorCode.length()));
|
||||||
|
// dto.setPileSn(YKCUtils.getPileSn(pileConnectorCode));
|
||||||
|
// dto.setConnectorCode(YKCUtils.getConnectorCode(pileConnectorCode));
|
||||||
|
// } else {
|
||||||
|
// // 说明pileSn 和 connectorCode前端传了,那就校验一下长度
|
||||||
|
// if (dto.getPileSn().length() != Constants.PILE_SN_LENGTH_FOR_EV || dto.getConnectorCode().length() != Constants.CONNECTOR_CODE_LENGTH_FOR_EV
|
||||||
|
// || dto.getPileSn().length() != Constants.PILE_SN_LENGTH_FOR_EBIKE || dto.getConnectorCode().length() != Constants.CONNECTOR_CODE_LENGTH_FOR_EBIKE) {
|
||||||
|
// throw new BusinessException(ReturnCodeEnum.CODE_DATA_LENGTH_ERROR);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void analysisPileParameter(BasicPileDTO dto) {
|
public void analysisPileParameter(BasicPileDTO dto) {
|
||||||
if (StringUtils.isBlank(dto.getPileSn()) || StringUtils.isBlank(dto.getConnectorCode())) {
|
String pileSn = dto.getPileSn();
|
||||||
// 从pileConnectorCode解析
|
String connectorCode = dto.getConnectorCode();
|
||||||
String pileConnectorCode = dto.getPileConnectorCode();
|
String pileConnectorCode = dto.getPileConnectorCode();
|
||||||
// dto.setPileSn(StringUtils.substring(pileConnectorCode, 0, pileConnectorCode.length() - 2));
|
if (StringUtils.isBlank(pileSn) || StringUtils.isBlank(connectorCode)) {
|
||||||
// dto.setConnectorCode(StringUtils.substring(pileConnectorCode, pileConnectorCode.length() - 2, pileConnectorCode.length()));
|
if (StringUtils.isBlank(pileConnectorCode)) {
|
||||||
dto.setPileSn(YKCUtils.getPileSn(pileConnectorCode));
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||||
dto.setConnectorCode(YKCUtils.getConnectorCode(pileConnectorCode));
|
|
||||||
} else {
|
} else {
|
||||||
// 说明pileSn 和 connectorCode前端传了,那就校验一下长度
|
// 从pileConnectorCode解析
|
||||||
if (dto.getPileSn().length() != Constants.PILE_SN_LENGTH_FOR_EV || dto.getConnectorCode().length() != Constants.CONNECTOR_CODE_LENGTH_FOR_EV
|
pileSn = YKCUtils.getPileSn(pileConnectorCode);
|
||||||
|| dto.getPileSn().length() != Constants.PILE_SN_LENGTH_FOR_EBIKE || dto.getConnectorCode().length() != Constants.CONNECTOR_CODE_LENGTH_FOR_EBIKE) {
|
connectorCode = YKCUtils.getConnectorCode(pileConnectorCode);
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_DATA_LENGTH_ERROR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isBlank(pileConnectorCode)) {
|
||||||
|
if (StringUtils.isNotBlank(pileSn) && StringUtils.isNotBlank(connectorCode)) {
|
||||||
|
pileConnectorCode = pileSn + connectorCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dto.setPileConnectorCode(pileConnectorCode);
|
||||||
|
dto.setPileSn(pileSn);
|
||||||
|
dto.setConnectorCode(connectorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
|||||||
// 处理前端传的参数
|
// 处理前端传的参数
|
||||||
orderBasicInfoService.analysisPileParameter(dto);
|
orderBasicInfoService.analysisPileParameter(dto);
|
||||||
|
|
||||||
|
// 判断桩是电动汽车桩还是电单车桩
|
||||||
|
|
||||||
// 校验充电桩相关的信息
|
// 校验充电桩相关的信息
|
||||||
if (StringUtils.isBlank(dto.getTransactionCode())) {
|
if (StringUtils.isBlank(dto.getTransactionCode())) {
|
||||||
// 无transactionCode, 表示由平台端启动充电, 需要验证充电桩状态
|
// 无transactionCode, 表示由平台端启动充电, 需要验证充电桩状态
|
||||||
@@ -81,6 +83,31 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
|||||||
return orderBasicInfoService.saveOrder2Database(dto);
|
return orderBasicInfoService.saveOrder2Database(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成电动汽车订单
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
private OrderBasicInfo generateOrderForEV(GenerateOrderDTO dto) throws ParseException {
|
||||||
|
|
||||||
|
// 校验充电桩相关的信息
|
||||||
|
if (StringUtils.isBlank(dto.getTransactionCode())) {
|
||||||
|
// 无transactionCode, 表示由平台端启动充电, 需要验证充电桩状态
|
||||||
|
orderBasicInfoService.checkPileInfo(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存订单到数据库 saveOrder2Database
|
||||||
|
return orderBasicInfoService.saveOrder2Database(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成电单车订单
|
||||||
|
*/
|
||||||
|
private OrderBasicInfo generateOrderForEBike(GenerateOrderDTO dto) throws ParseException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付订单
|
* 支付订单
|
||||||
* @param dto
|
* @param dto
|
||||||
|
|||||||
Reference in New Issue
Block a user