update 电单车协议

This commit is contained in:
Guoqs
2024-09-04 10:59:27 +08:00
parent eec33cc283
commit c2a01a917f
2 changed files with 63 additions and 28 deletions

View File

@@ -74,7 +74,6 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
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
*/
// @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
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);
String pileSn = dto.getPileSn();
String connectorCode = dto.getConnectorCode();
String pileConnectorCode = dto.getPileConnectorCode();
if (StringUtils.isBlank(pileSn) || StringUtils.isBlank(connectorCode)) {
if (StringUtils.isBlank(pileConnectorCode)) {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
} else {
// 从pileConnectorCode解析
pileSn = YKCUtils.getPileSn(pileConnectorCode);
connectorCode = YKCUtils.getConnectorCode(pileConnectorCode);
}
}
if (StringUtils.isBlank(pileConnectorCode)) {
if (StringUtils.isNotBlank(pileSn) && StringUtils.isNotBlank(connectorCode)) {
pileConnectorCode = pileSn + connectorCode;
}
}
dto.setPileConnectorCode(pileConnectorCode);
dto.setPileSn(pileSn);
dto.setConnectorCode(connectorCode);
}
/**