|
|
@@ -766,18 +766,22 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
|
|
|
// 构建查询条件:查询进行中(2)和已完成(3)状态的订单
|
|
|
QueryWrapper<LawyerConsultationOrderVO> queryWrapper = new QueryWrapper<>();
|
|
|
+ QueryWrapper<LawyerConsultationOrderVO> queryStatisticsWrapper = new QueryWrapper<>();
|
|
|
+
|
|
|
if(StringUtils.hasText(orderStatus)){
|
|
|
queryWrapper.in("lco.order_status", Collections.singletonList(orderStatus));
|
|
|
} else {
|
|
|
queryWrapper.in("lco.order_status", Arrays.asList("2", "3"));
|
|
|
}
|
|
|
queryWrapper.eq("lco.lawyer_user_id", lawyerId);
|
|
|
+ queryStatisticsWrapper.eq("lco.lawyer_user_id", lawyerId);
|
|
|
if(StringUtils.hasText(clientUserName)){
|
|
|
queryWrapper.like("lur.user_name", clientUserName);
|
|
|
+ queryStatisticsWrapper.like("lur.user_name", clientUserName);
|
|
|
}
|
|
|
queryWrapper.eq("lco.delete_flag", 0);
|
|
|
+ queryStatisticsWrapper.eq("lco.delete_flag", 0);
|
|
|
queryWrapper.orderByDesc("lco.created_time");
|
|
|
-
|
|
|
// 时间范围查询:如果开始时间和结束时间都存在,则进行范围查询
|
|
|
if (StringUtils.hasText(startDate) && StringUtils.hasText(endDate)) {
|
|
|
queryWrapper.between("lco.payment_time", startDate + " 00:00:00", endDate + " 23:59:59");
|
|
|
@@ -794,23 +798,23 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
|
|
|
}
|
|
|
|
|
|
//获取统计信息
|
|
|
- queryWrapper.groupBy("lco.order_status");
|
|
|
- List<Map<String, Object>> statisticsInfo = consultationOrderMapper.getLawyerStatisticsInfo(queryWrapper);
|
|
|
+ queryStatisticsWrapper.groupBy("lco.order_status");
|
|
|
+ List<Map<String, Object>> statisticsInfo = consultationOrderMapper.getLawyerStatisticsInfo(queryStatisticsWrapper);
|
|
|
|
|
|
Map<Integer, Integer> statusCountMap = new HashMap<>();
|
|
|
for (Map<String, Object> map : statisticsInfo) {
|
|
|
- Integer status = (Integer) map.get("status");
|
|
|
- Long countLong = (Long) map.get("count"); // COUNT(*) 返回类型可能是Long
|
|
|
+ Integer status = (Integer) map.get("order_status");
|
|
|
+ Long countLong = (Long) map.get("order_count"); // COUNT(*) 返回类型可能是Long
|
|
|
statusCountMap.put(status, countLong.intValue());
|
|
|
}
|
|
|
|
|
|
|
|
|
// 统计进行中订单数量
|
|
|
- int inProgressCount = statusCountMap.containsKey(2)?Integer.parseInt(statisticsInfo.get(2).toString()): 0;
|
|
|
+ int inProgressCount = statusCountMap.getOrDefault(2, 0);
|
|
|
resultMap.put("lawyerInProgressOrderCount", inProgressCount);
|
|
|
|
|
|
// 统计已完成订单数量
|
|
|
- int completeCount = statusCountMap.containsKey(3)?Integer.parseInt(statisticsInfo.get(3).toString()): 0;
|
|
|
+ int completeCount = statusCountMap.getOrDefault(3, 0);
|
|
|
resultMap.put("lawyerCompleteOrderCount", completeCount);
|
|
|
|
|
|
// 统计订单总数
|