mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update
This commit is contained in:
@@ -923,7 +923,7 @@ public class TempController extends BaseController {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
//stationId ,merchantIdList,stationIdList,merchantId,startTime,endTime
|
||||
List<OrderCountByTimeVO> result = tempService.queryOrderCountByTime(dto);
|
||||
OrderCountByTimeVO result = tempService.queryOrderCountByTime(dto);
|
||||
response = new RestApiResponse<>(result);
|
||||
} catch (Exception e) {
|
||||
logger.error("时间区间查询订单统计 error", e);
|
||||
|
||||
@@ -1280,7 +1280,7 @@ public class TempService {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public List<OrderCountByTimeVO> queryOrderCountByTime(QueryOrderDTO dto) {
|
||||
public OrderCountByTimeVO queryOrderCountByTime(QueryOrderDTO dto) {
|
||||
// 处理时间默认值
|
||||
if (dto == null) {
|
||||
dto = new QueryOrderDTO();
|
||||
@@ -1301,7 +1301,7 @@ public class TempService {
|
||||
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);
|
||||
try {
|
||||
// 将开始时间和结束时间转换为LocalDateTime类型
|
||||
@@ -1332,22 +1332,32 @@ public class TempService {
|
||||
LocalDateTime nextHour = currentHour.plusHours(1);
|
||||
int count = ordersByHour.getOrDefault(currentHour, Collections.emptyList()).size();
|
||||
|
||||
OrderCountByTimeVO vo = new OrderCountByTimeVO();
|
||||
OrderCountByTimeVO.OrderCountByTimeListVO vo = new OrderCountByTimeVO.OrderCountByTimeListVO();
|
||||
vo.setStartTime(currentHour.format(dateTimeFormatter));
|
||||
vo.setEndTime(nextHour.format(dateTimeFormatter));
|
||||
vo.setCount(count);
|
||||
vo.setOrderCount(count);
|
||||
result.add(vo);
|
||||
|
||||
currentHour = nextHour;
|
||||
}
|
||||
|
||||
// 按开始时间排序
|
||||
result.sort(Comparator.comparing(OrderCountByTimeVO::getStartTime));
|
||||
result.sort(Comparator.comparing(OrderCountByTimeVO.OrderCountByTimeListVO::getStartTime));
|
||||
} catch (Exception e) {
|
||||
logger.error("统计订单数量失败", e);
|
||||
}
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user