mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -236,18 +236,31 @@ public class OrderService {
|
||||
|
||||
for (OrderVO orderVO : pageInfo.getList()) {
|
||||
orderVO.setPileConnectorCode(orderVO.getPileSn() + orderVO.getConnectorCode());
|
||||
String chargingTime = "0分钟";
|
||||
if (orderVO.getStartTime() != null) {
|
||||
Date startTimeDate = DateUtils.parseDate(orderVO.getStartTime());
|
||||
Date endTimeDate;
|
||||
if (orderVO.getEndTime() != null) {
|
||||
endTimeDate = DateUtils.parseDate(orderVO.getEndTime());
|
||||
} else {
|
||||
endTimeDate = new Date();
|
||||
}
|
||||
// 计算出两个时间差
|
||||
chargingTime = DateUtils.getDatePoor(endTimeDate, startTimeDate);
|
||||
// 从缓存中获取充电时长
|
||||
List<RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderVO.getTransactionCode());
|
||||
// 默认时间倒序排列,因此只取第一条就可以
|
||||
if (CollectionUtils.isEmpty(chargingRealTimeData)) {
|
||||
orderVO.setChargingTime("-");
|
||||
continue;
|
||||
}
|
||||
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
|
||||
String sumChargingTime = realTimeMonitorData.getSumChargingTime(); // xx分钟
|
||||
// 分钟转成 x时x分
|
||||
String chargingTime = DateUtils.convertMinutesToTime(Integer.parseInt(sumChargingTime));
|
||||
|
||||
// String chargingTime = "0分钟";
|
||||
// if (orderVO.getStartTime() != null) {
|
||||
// Date startTimeDate = DateUtils.parseDate(orderVO.getStartTime());
|
||||
// Date endTimeDate;
|
||||
// if (orderVO.getEndTime() != null) {
|
||||
// endTimeDate = DateUtils.parseDate(orderVO.getEndTime());
|
||||
// // 计算出两个时间差
|
||||
// chargingTime = DateUtils.getDatePoor(endTimeDate, startTimeDate);
|
||||
// } else {
|
||||
// endTimeDate = new Date();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
orderVO.setChargingTime(chargingTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ParseException {
|
||||
|
||||
String s = convertMinutesToTime(75);
|
||||
System.out.println(s);
|
||||
|
||||
|
||||
String startDate = "2023-07-01";
|
||||
String endDate = "2023-07-20";
|
||||
LocalDate of = LocalDate.of(2023, 07, 20);
|
||||
@@ -855,6 +860,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return DateTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分钟转 x时x分
|
||||
* @param minutes
|
||||
* @return
|
||||
*/
|
||||
public static String convertMinutesToTime(int minutes) {
|
||||
if (minutes < 0) {
|
||||
return null;
|
||||
}
|
||||
int hours = minutes / 60;
|
||||
int remainingMinutes = minutes % 60;
|
||||
if (hours < 1) {
|
||||
return String.format("%d分钟", remainingMinutes);
|
||||
}else {
|
||||
return String.format("%d小时%d分钟", hours, remainingMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前时间是否在时间指定范围内<br>
|
||||
*
|
||||
|
||||
@@ -19,6 +19,11 @@ public class OrderVO {
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 交易流水号
|
||||
*/
|
||||
private String transactionCode;
|
||||
|
||||
/**
|
||||
* 桩编号
|
||||
*/
|
||||
|
||||
@@ -803,6 +803,7 @@
|
||||
<select id="getListByMemberIdAndOrderStatus" resultType="com.jsowell.pile.vo.uniapp.OrderVO">
|
||||
SELECT t1.id,
|
||||
t1.order_code as orderCode,
|
||||
t1.transaction_code as transactionCode,
|
||||
t1.order_status as orderStatus,
|
||||
t1.reason,
|
||||
t1.station_id as stationId,
|
||||
|
||||
@@ -72,6 +72,7 @@ public interface NRService {
|
||||
String notification_orderInfo(String orderCode);
|
||||
|
||||
/**
|
||||
* 查询充电电量信息
|
||||
* 此接口用于批量查询时间区段内交易记录
|
||||
* @param dto
|
||||
* @return
|
||||
|
||||
Reference in New Issue
Block a user