mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-11 10:49:52 +08:00
update 电单车
This commit is contained in:
@@ -253,7 +253,7 @@ public class OrderService {
|
||||
if (StringUtils.isBlank(orderStatus)) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
ArrayList<String> orderStatusList = Lists.newArrayList();
|
||||
List<String> orderStatusList = Lists.newArrayList();
|
||||
if (StringUtils.equals("2", orderStatus)) {
|
||||
// 查未完成订单
|
||||
CollectionUtils.addAll(orderStatusList, "0", "1", "2", "3", "4", "5");
|
||||
@@ -281,27 +281,19 @@ public class OrderService {
|
||||
}
|
||||
RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0);
|
||||
String sumChargingTime = realTimeMonitorData.getSumChargingTime(); // xx分钟
|
||||
|
||||
if (StringUtils.isNotBlank(orderVO.getStartTime())) {
|
||||
// 开始时间不为空, 根据开始充电时间计算充电时长
|
||||
sumChargingTime = String.valueOf(DateUtils.minutesSince(orderVO.getStartTime()));
|
||||
}
|
||||
|
||||
String chargingTime = "-";
|
||||
try {
|
||||
// 分钟转成 x时x分
|
||||
chargingTime = DateUtils.convertMinutesToTime(Integer.parseInt(sumChargingTime));
|
||||
} catch (Exception e) {
|
||||
orderVO.setChargingTime(sumChargingTime);
|
||||
continue;
|
||||
log.error("转换充电时间error, sumChargingTime:{}", 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +63,7 @@ import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||||
import com.jsowell.pile.transaction.service.TransactionService;
|
||||
import com.jsowell.pile.vo.base.MemberWalletVO;
|
||||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberPlateNumberVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.MemberVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PileConnectorDetailVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.*;
|
||||
import com.jsowell.pile.vo.web.*;
|
||||
import com.jsowell.service.MemberService;
|
||||
import com.jsowell.service.OrderService;
|
||||
@@ -264,6 +261,14 @@ public class SpringBootTestController {
|
||||
@Autowired
|
||||
private ZDLService zdlService;
|
||||
|
||||
@Test
|
||||
public void getListByMemberIdAndOrderStatusTest() {
|
||||
String memberId = "12345678";
|
||||
List<String> orderStatusList = Lists.newArrayList();
|
||||
List<OrderVO> list = orderBasicInfoService.getListByMemberIdAndOrderStatus(memberId, orderStatusList);
|
||||
System.out.println(list);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectPileDetailByPileSnTest() {
|
||||
String pileSn = "13273881";
|
||||
@@ -272,7 +277,6 @@ public class SpringBootTestController {
|
||||
System.out.println(pileDetailVO);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void thirdPartyTest() {
|
||||
QueryStationInfoDTO dto = new QueryStationInfoDTO();
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.sql.Time;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -244,6 +243,31 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算从给定日期字符串到当前时间一共过去了多少分钟。
|
||||
*
|
||||
* @param dateString 给定的日期字符串,格式为 "yyyy-MM-dd HH:mm:ss"
|
||||
* @return 过去的分钟数
|
||||
*/
|
||||
public static long minutesSince(String dateString) {
|
||||
// 定义日期时间格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 解析给定的日期字符串
|
||||
LocalDateTime givenDateTime = LocalDateTime.parse(dateString, formatter);
|
||||
|
||||
// 获取当前时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 计算两者之间的时间差
|
||||
Duration duration = Duration.between(givenDateTime, now);
|
||||
|
||||
// 将时间差转换为分钟
|
||||
long minutes = duration.toMinutes();
|
||||
|
||||
return minutes;
|
||||
}
|
||||
|
||||
/**
|
||||
* LocalDateTime转Date
|
||||
*
|
||||
@@ -1112,19 +1136,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String startTime = "22:00:00";
|
||||
String endTime1 = "05:30:00";
|
||||
String endTime2 = "22:00:00";
|
||||
|
||||
LocalDateTime[] dateTime1 = convertStartAndEndTime(startTime, endTime1);
|
||||
LocalDateTime[] dateTime2 = convertStartAndEndTime(startTime, endTime2);
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println("Start DateTime: " + dateTime1[0].format(formatter));
|
||||
System.out.println("End DateTime (Next Day): " + dateTime1[1].format(formatter));
|
||||
|
||||
System.out.println("Start DateTime: " + dateTime2[0].format(formatter));
|
||||
System.out.println("End DateTime (Same Day): " + dateTime2[1].format(formatter));
|
||||
String dateString = "2024-09-20 13:35:56";
|
||||
long minutesPassed = minutesSince(dateString);
|
||||
System.out.println(minutesPassed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user