|
@@ -31,6 +31,7 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -65,6 +66,8 @@ public class CouponFrontController {
|
|
|
|
|
|
|
|
private final UserMapper userMapper;
|
|
private final UserMapper userMapper;
|
|
|
|
|
|
|
|
|
|
+ private final HttpServletRequest request;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 优惠券领取中心列表
|
|
* 优惠券领取中心列表
|
|
|
*/
|
|
*/
|
|
@@ -380,4 +383,21 @@ public class CouponFrontController {
|
|
|
CouponUserView couponUserView = couponFontService.receiveCoupon(userId, couponId);
|
|
CouponUserView couponUserView = couponFontService.receiveCoupon(userId, couponId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(couponUserView);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(couponUserView);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 优惠券详情
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/get/coupon/detail/{couponId}")
|
|
|
|
|
+ public Result<CouponDetailView> getCouponDetail(@PathVariable Long couponId) {
|
|
|
|
|
+ CouponDetailView couponDetailView = beanSearcher.searchFirst(CouponDetailView.class, MapUtils.flatBuilder(request.getParameterMap()).field(CouponDetailView::getCouponId, couponId).build());
|
|
|
|
|
+ String str = couponSkuMapper.selectGoodsSkuStr(couponDetailView.getCouponId());
|
|
|
|
|
+ couponDetailView.setGoodsSkuStr(str.replaceAll(",", "/").replaceAll(";", ""));
|
|
|
|
|
+ List<CouponSkuView> couponSkus = couponSkuMapper.getGoodsSkuByCouponId(couponDetailView.getCouponId());
|
|
|
|
|
+ try {
|
|
|
|
|
+ couponDetailView.setGoodsSkuIds(Jsons.toJson(couponSkus));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(couponDetailView);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|