mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 03:39:55 +08:00
update
This commit is contained in:
@@ -923,7 +923,7 @@ public class TempController extends BaseController {
|
|||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
//stationId ,merchantIdList,stationIdList,merchantId,startTime,endTime
|
//stationId ,merchantIdList,stationIdList,merchantId,startTime,endTime
|
||||||
List<OrderCountByTimeVO> result = tempService.queryOrderCountByTime(dto);
|
OrderCountByTimeVO result = tempService.queryOrderCountByTime(dto);
|
||||||
response = new RestApiResponse<>(result);
|
response = new RestApiResponse<>(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("时间区间查询订单统计 error", e);
|
logger.error("时间区间查询订单统计 error", e);
|
||||||
|
|||||||
@@ -1280,7 +1280,7 @@ public class TempService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<OrderCountByTimeVO> queryOrderCountByTime(QueryOrderDTO dto) {
|
public OrderCountByTimeVO queryOrderCountByTime(QueryOrderDTO dto) {
|
||||||
// 处理时间默认值
|
// 处理时间默认值
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
dto = new QueryOrderDTO();
|
dto = new QueryOrderDTO();
|
||||||
@@ -1301,7 +1301,7 @@ public class TempService {
|
|||||||
List<OrderListVO> orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto);
|
List<OrderListVO> orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto);
|
||||||
|
|
||||||
//统计订单
|
//统计订单
|
||||||
List<OrderCountByTimeVO> result = new ArrayList<>();
|
List<OrderCountByTimeVO.OrderCountByTimeListVO> result = new ArrayList<>();
|
||||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||||
try {
|
try {
|
||||||
// 将开始时间和结束时间转换为LocalDateTime类型
|
// 将开始时间和结束时间转换为LocalDateTime类型
|
||||||
@@ -1332,22 +1332,32 @@ public class TempService {
|
|||||||
LocalDateTime nextHour = currentHour.plusHours(1);
|
LocalDateTime nextHour = currentHour.plusHours(1);
|
||||||
int count = ordersByHour.getOrDefault(currentHour, Collections.emptyList()).size();
|
int count = ordersByHour.getOrDefault(currentHour, Collections.emptyList()).size();
|
||||||
|
|
||||||
OrderCountByTimeVO vo = new OrderCountByTimeVO();
|
OrderCountByTimeVO.OrderCountByTimeListVO vo = new OrderCountByTimeVO.OrderCountByTimeListVO();
|
||||||
vo.setStartTime(currentHour.format(dateTimeFormatter));
|
vo.setStartTime(currentHour.format(dateTimeFormatter));
|
||||||
vo.setEndTime(nextHour.format(dateTimeFormatter));
|
vo.setEndTime(nextHour.format(dateTimeFormatter));
|
||||||
vo.setCount(count);
|
vo.setCount(count);
|
||||||
|
vo.setOrderCount(count);
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
|
|
||||||
currentHour = nextHour;
|
currentHour = nextHour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按开始时间排序
|
// 按开始时间排序
|
||||||
result.sort(Comparator.comparing(OrderCountByTimeVO::getStartTime));
|
result.sort(Comparator.comparing(OrderCountByTimeVO.OrderCountByTimeListVO::getStartTime));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("统计订单数量失败", e);
|
logger.error("统计订单数量失败", e);
|
||||||
}
|
}
|
||||||
logger.info("查询订单数量结果:{}", JSONObject.toJSONString(result));
|
logger.info("查询订单数量结果:{}", JSONObject.toJSONString(result));
|
||||||
return result;
|
OrderCountByTimeVO orderCountByTimeVO = new OrderCountByTimeVO();
|
||||||
|
orderCountByTimeVO.setOrderCountByTimeList(result);
|
||||||
|
|
||||||
|
//订单总数
|
||||||
|
Integer totalCount = 0;
|
||||||
|
for (OrderCountByTimeVO.OrderCountByTimeListVO vo : result) {
|
||||||
|
totalCount += vo.getCount();
|
||||||
|
}
|
||||||
|
orderCountByTimeVO.setTotalCount(totalCount);
|
||||||
|
return orderCountByTimeVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateWalletCode() {
|
public void updateWalletCode() {
|
||||||
|
|||||||
@@ -2,8 +2,22 @@ package com.jsowell.pile.vo.web;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OrderCountByTimeVO {
|
public class OrderCountByTimeVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总订单数量
|
||||||
|
*/
|
||||||
|
private Integer totalCount;
|
||||||
|
|
||||||
|
private List<OrderCountByTimeListVO> orderCountByTimeList;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class OrderCountByTimeListVO {
|
||||||
/**
|
/**
|
||||||
* 时间段
|
* 时间段
|
||||||
*/
|
*/
|
||||||
@@ -18,3 +32,7 @@ public class OrderCountByTimeVO {
|
|||||||
private String endTime;
|
private String endTime;
|
||||||
private Integer count ;
|
private Integer count ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user