Bläddra i källkod

志愿者余额与订单统计

wangwl 4 veckor sedan
förälder
incheckning
6cbea98a5e

+ 16 - 14
leromro-core/src/main/java/com/leromro/core/controller/VolunteerAccountController.java

@@ -3,6 +3,7 @@ package com.leromro.core.controller;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import com.leromro.common.core.domain.R;
@@ -39,27 +40,28 @@ public class VolunteerAccountController extends BaseController
     @Autowired
     private IVolunteerAccountService volunteerAccountService;
 
-    /**
-     * 查询志愿者账户列表
-     */
-    @ApiOperation("查询志愿者账户列表")
-    @GetMapping("/list")
-    public TableDataInfo<VolunteerAccount> list(VolunteerAccount volunteerAccount)
-    {
-        startPage();
-        List<VolunteerAccount> list = volunteerAccountService.selectVolunteerAccountList(volunteerAccount);
-        return getDataTable(list);
-    }
+//    /**
+//     * 查询志愿者账户列表
+//     */
+//    @ApiOperation("查询志愿者账户列表")
+//    @GetMapping("/list")
+//    public TableDataInfo<VolunteerAccount> list(VolunteerAccount volunteerAccount)
+//    {
+//        startPage();
+//        List<VolunteerAccount> list = volunteerAccountService.selectVolunteerAccountList(volunteerAccount);
+//        return getDataTable(list);
+//    }
 
 
     /**
      * 获取志愿者账户详细信息
      */
     @ApiOperation("获取志愿者账户详细信息")
-    @GetMapping(value = "/{volunteerAccountId}")
-    public R<VolunteerAccount> getInfo(@PathVariable("volunteerAccountId") Long volunteerAccountId)
+    @GetMapping("/getVolunteerAccountInfo")
+    public R<VolunteerAccount> getVolunteerAccountInfo()
     {
-        return R.ok(volunteerAccountService.selectVolunteerAccountByVolunteerAccountId(volunteerAccountId));
+        return R.ok(volunteerAccountService.getOne(new LambdaQueryWrapper<VolunteerAccount>()
+                .eq(VolunteerAccount::getVolunteerId, getUserId())));
     }
 
 

+ 22 - 1
leromro-core/src/main/java/com/leromro/core/controller/volunteerOrderController.java

@@ -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);
+    }
+
 }

+ 4 - 0
leromro-core/src/main/java/com/leromro/core/domain/VolunteerInfo.java

@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.io.Serializable;
 
+import com.leromro.common.annotation.Sensitive;
 import com.leromro.common.core.domain.BaseEntity;
+import com.leromro.common.enums.DesensitizedType;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -45,6 +47,7 @@ public class VolunteerInfo extends BaseEntity {
     @ApiModelProperty(value = "志愿者姓名")
     private String name;
 
+    @Sensitive(desensitizedType = DesensitizedType.ID_CARD)
     @ApiModelProperty(value = "身份证号")
     private String idCard;
 
@@ -66,6 +69,7 @@ public class VolunteerInfo extends BaseEntity {
     @ApiModelProperty(value = "技能描述")
     private String skillDescribe;
 
+    @Sensitive(desensitizedType = DesensitizedType.PHONE)
     @ApiModelProperty(value = "联系电话")
     private String phonenumber;
 

+ 27 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/VolunteerOrderStatisticsVO.java

@@ -0,0 +1,27 @@
+package com.leromro.core.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Builder;
+import lombok.Data;
+
+/**
+ * 志愿者订单统计
+ */
+@Data
+@Builder
+public class VolunteerOrderStatisticsVO {
+    @ApiModelProperty("订单总数")
+    private Integer orderCount; ;
+
+    @ApiModelProperty("预约单总数")
+    private Integer reservationCount ;
+
+    @ApiModelProperty("进行单总数")
+    private Integer doingCount;
+
+    @ApiModelProperty("完成单总数")
+    private Integer finishedCount ;
+
+    @ApiModelProperty("取消单总数")
+    private Integer cancelCount ;
+}