From b26015d6c3e8be34fc82298f6cdb7333d897a190 Mon Sep 17 00:00:00 2001 From: Lemon Date: Fri, 20 Oct 2023 18:10:52 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=E6=B1=9F=E8=8B=8F=E7=9C=81?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsowell/common/util/DateUtils.java | 19 +++++++++++++++++++ .../nanrui/service/impl/NRServiceImpl.java | 14 +++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java index 34c7878fe..dec13e17f 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java @@ -1033,4 +1033,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { long timestamp = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); return timestamp; } + + /** + * 将 YYYY-MM-DD HH:mm:ss 转换为 YYYY-MM-DD + * @param dateTimeString + * @return + */ + public static String convertDateTimeToDate(String dateTimeString) { + SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date date = inputFormat.parse(dateTimeString); + return outputFormat.format(date); + } catch (ParseException e) { + // 处理解析异常 + e.printStackTrace(); + return null; // 或者返回一个默认值 + } + } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java index e878eb443..ea7f9c07b 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/nanrui/service/impl/NRServiceImpl.java @@ -162,7 +162,7 @@ public class NRServiceImpl implements NRService { .parkNums(0) .stationLng(new BigDecimal(stationInfoVO.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP)) .stationLat(new BigDecimal(stationInfoVO.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP)) - .openForBusinessDate(stationInfoVO.getCreateTime()) + .openForBusinessDate(DateUtils.convertDateTimeToDate(stationInfoVO.getCreateTime())) .openAllDay(Integer.parseInt(stationInfoVO.getOpenAllDay())) .busineHours(stationInfoVO.getBusinessHours()) .minElectricityPrice(stationInfoVO.getElectricityPrice().add(stationInfoVO.getServicePrice())) @@ -618,14 +618,14 @@ public class NRServiceImpl implements NRService { */ private NROrderInfo formatNROrderInfo(NROrderInfoVO nrOrderInfoVO) { // 将组织机构代码截取后九位 - String organizationCode = nrOrderInfoVO.getOperatorId(); - if (StringUtils.isBlank(organizationCode)) { - return null; - } - String operatorId = StringUtils.substring(organizationCode, organizationCode.length() - 9); + // String organizationCode = nrOrderInfoVO.getOperatorId(); + // if (StringUtils.isBlank(organizationCode)) { + // return null; + // } + // String operatorId = StringUtils.substring(organizationCode, organizationCode.length() - 9); NROrderInfo nrOrderInfo = NROrderInfo.builder() - .operatorId(operatorId) + .operatorId(Constants.OPERATORID_JIANG_SU) .connectorId(nrOrderInfoVO.getConnectorId()) .startChargeSeq(nrOrderInfoVO.getStartChargeSeq()) .userChargeType(1)