Browse Source

盲票详情返回中奖奖级

cup 2 years ago
parent
commit
b09f06b9c4

+ 17 - 1
mp-admin/src/main/java/com/qs/mp/web/controller/api/user/UserTicketController.java

@@ -453,7 +453,10 @@ public class UserTicketController extends BaseApiController {
      * 根据盲票购买订单号查看盲票详情
      */
     @PostMapping("/ticket/query")
-    @ApiOperation(value = "查看盲票详情", notes = "根据盲票购买订单号,查看盲票详情")
+    @ApiOperation(value = "根据单号查看盲票详情", notes = "根据盲票购买订单号,查看盲票详情")
+    @ApiResponses(
+        @ApiResponse(code = 200, message = "success", response = TicketListVO.class)
+    )
     public AjaxResult queryTicket(@RequestBody TicketParam param) {
         Long userId = SecurityUtils.getLoginUser().getUserId();
         if (StringUtils.isBlank(param.getOrderId())) {
@@ -462,6 +465,19 @@ public class UserTicketController extends BaseApiController {
 
         TicketListVO ticketListVO = userTicketOrderItemService.queryTicketVO(userId,
             param.getOrderId());
+
+        if (ticketListVO != null) {
+            // 设置奖项名
+            if (Objects.nonNull(ticketListVO.getPlainLuckyNum())) {
+                List<TicketDrawNumDTO> drawNumDTOList = JSONObject.parseArray(ticketListVO.getDrawNum(), TicketDrawNumDTO.class);
+                for (TicketDrawNumDTO ticketDrawNumDTO : drawNumDTOList) {
+                    if (ticketDrawNumDTO.getNum() == ticketListVO.getPlainLuckyNum()) {
+                        ticketListVO.setAwardsName(ticketDrawNumDTO.getName());
+                    }
+                }
+            }
+        }
+
         return AjaxResult.success(ticketListVO);
     }
 

+ 7 - 0
mp-service/src/main/java/com/qs/mp/admin/domain/vo/TicketListVO.java

@@ -86,4 +86,11 @@ public class TicketListVO {
   @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
   private TicketTypeEnum type;
 
+
+  @ApiModelProperty("抽奖数字描述json")
+  private String drawNum;
+
+  @ApiModelProperty("奖级名称")
+  private String awardsName;
+
 }

+ 2 - 1
mp-service/src/main/resources/mapper/user/UserTicketOrderItemMapper.xml

@@ -38,7 +38,8 @@
                 t4.type,
                 t6.title prizeInfo,
                 t6.`value`,
-                t6.prize_type
+                t6.prize_type,
+                t3.draw_num
         from mp_user_ticket_order_item t1
          left join mp_user_ticket_order t2 on t1.order_id = t2.order_id
          left join mp_ticket t3 on t1.ticket_id = t3.ticket_id