|
@@ -1,11 +1,14 @@
|
|
|
package com.leromro.core.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.leromro.common.core.controller.BaseController;
|
|
|
import com.leromro.common.core.domain.AjaxResult;
|
|
|
import com.leromro.common.core.domain.R;
|
|
|
import com.leromro.common.utils.SecurityUtils;
|
|
|
import com.leromro.core.domain.SecondOrder;
|
|
|
+import com.leromro.core.domain.vo.VolunteerOrderStatisticsVO;
|
|
|
import com.leromro.core.domain.vo.VolunteerOrdersVO;
|
|
|
import com.leromro.core.service.ISecondOrderService;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -28,7 +31,7 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@Api(tags = "志愿者订单")
|
|
|
@RequestMapping("/core/volunteer/orders")
|
|
|
-public class volunteerOrderController {
|
|
|
+public class volunteerOrderController extends BaseController {
|
|
|
@Autowired
|
|
|
private ISecondOrderService secondOrderService;
|
|
|
@ApiOperation("志愿者查询小订单列表")
|
|
@@ -67,4 +70,22 @@ public class volunteerOrderController {
|
|
|
return secondOrderService.volunteerFinishWork(secondOrder);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 志愿者订单统计
|
|
|
+ */
|
|
|
+ @ApiOperation("志愿者订单统计")
|
|
|
+ @GetMapping("/volunteerOrderStatistics")
|
|
|
+ public R<VolunteerOrderStatisticsVO> volunteerOrderStatistics() {
|
|
|
+ List<SecondOrder> orderList = secondOrderService.list(new LambdaQueryWrapper<SecondOrder>()
|
|
|
+ .eq(SecondOrder::getVolunteerId, getUserId()));
|
|
|
+ VolunteerOrderStatisticsVO vo = VolunteerOrderStatisticsVO.builder()
|
|
|
+ .orderCount(orderList.size())
|
|
|
+ .reservationCount((int) orderList.stream().filter(secondOrder -> secondOrder.getOrderStatus() == 0).count())
|
|
|
+ .doingCount((int) orderList.stream().filter(secondOrder -> secondOrder.getOrderStatus() == 1).count())
|
|
|
+ .finishedCount((int) orderList.stream().filter(secondOrder -> secondOrder.getOrderStatus() == 2).count())
|
|
|
+ .cancelCount((int) orderList.stream().filter(secondOrder -> secondOrder.getOrderStatus() == 3).count())
|
|
|
+ .build();
|
|
|
+ return R.ok(vo);
|
|
|
+ }
|
|
|
+
|
|
|
}
|