|
@@ -1,10 +1,14 @@
|
|
|
package com.chelvc.cloud.maintain.controller;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import javax.validation.Valid;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+
|
|
|
import com.chelvc.cloud.maintain.copier.UserCouponCopier;
|
|
|
-import com.chelvc.cloud.maintain.vo.CouponVO;
|
|
|
import com.chelvc.cloud.maintain.vo.UserCouponVO;
|
|
|
import com.chelvc.cloud.vehicle.api.dto.UserCouponDTO;
|
|
|
-import com.chelvc.cloud.vehicle.api.param.CouponPagingParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.UserCouponPagingParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.UserCouponQueryParam;
|
|
|
import com.chelvc.cloud.vehicle.api.service.UserCouponService;
|
|
@@ -18,12 +22,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import javax.validation.Valid;
|
|
|
-import javax.validation.constraints.Min;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
/**
|
|
|
* 优惠券领取记录接口
|
|
|
*
|
|
@@ -50,7 +48,6 @@ public class UserCouponController {
|
|
|
|
|
|
/**
|
|
|
* 自动领取优惠券
|
|
|
- *
|
|
|
*/
|
|
|
@PostMapping("/usercoupon/autoclaim")
|
|
|
public void autoClaimCoupon() {
|
|
@@ -101,8 +98,7 @@ public class UserCouponController {
|
|
|
*/
|
|
|
@GetMapping("/usercoupon/{id}")
|
|
|
public UserCouponVO getUserCoupon(@PathVariable("id") @Min(value = 1, message = "优惠券领取记录主键不能小于1") Long id) {
|
|
|
- UserCouponVO couponGain = this.convert(this.userCouponService.getUserCoupon(id));
|
|
|
- return couponGain;
|
|
|
+ return UserCouponCopier.INSTANCE.copying(this.userCouponService.getUserCoupon(id));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -120,17 +116,6 @@ public class UserCouponController {
|
|
|
}
|
|
|
|
|
|
// 构建优惠券领取记录信息
|
|
|
- List<UserCouponVO> couponGains = records.stream().map(this::convert).collect(Collectors.toList());
|
|
|
- return pagination.convert(couponGains);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 转换优惠券领取记录
|
|
|
- *
|
|
|
- * @param userCoupon 优惠券领取记录DTO
|
|
|
- * @return 优惠券领取记录VO
|
|
|
- */
|
|
|
- private UserCouponVO convert(UserCouponDTO userCoupon) {
|
|
|
- return UserCouponCopier.INSTANCE.copying(userCoupon);
|
|
|
+ return pagination.convert(UserCouponCopier.INSTANCE::copying);
|
|
|
}
|
|
|
}
|