记得上下班打卡 | git大法好,push需谨慎

Commit 826b9cf9 authored by 胡佳晨's avatar 胡佳晨

券列表分页

提前
演出
商品
我的(不分页)
parent e8e4ab2f
......@@ -16,7 +16,7 @@ liquidnet:
pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level: debug
mysql:
database-name: dev_ln_scene
database-name: test_ln_scene
mongodb:
sslEnabled: false
database: dev_ln_scene
database: test_ln_scene
......@@ -8,6 +8,7 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.candy.param.BackCouponParam;
import com.liquidnet.service.candy.service.ICandyCouponService;
import com.liquidnet.service.candy.util.ObjectUtil;
import com.liquidnet.service.candy.vo.CandyCouponPreVo;
import com.liquidnet.service.candy.vo.CandyCouponVo;
import com.liquidnet.service.candy.vo.CandyMyCouponListVo;
......@@ -52,8 +53,24 @@ public class CandyCouponController {
@ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "Integer", name = "type", value = "类型 1可用 2过期/已使用 ", required = true),
})
public ResponseDto<CandyMyCouponListVo> myCoupon(@RequestParam("type") @NotNull Integer type) {
return ResponseDto.success(candyCouponService.myCoupon(type));
public ResponseDto<CandyMyCouponListVo> myCoupon(@RequestParam("type") @NotNull Integer type, @RequestParam(required = false, name = "page") Integer page) {
CandyMyCouponListVo vo = candyCouponService.myCoupon(type);
// List<CandyCouponVo> list = vo.getMyCoupon();
// List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
// if (page == null || page == 0) {
// page = 1;
// }
// int size = 40;
// int initSize = (page - 1) * size;
// int forSize = page * size;
// if (forSize >= list.size()) {
// forSize = list.size();
// }
// for (int i = initSize; i < forSize; i++) {
// listVo.add(list.get(i));
// }
// vo.setMyCoupon(listVo);
return ResponseDto.success(vo);
}
//我的会员权益券统计
......@@ -87,8 +104,25 @@ public class CandyCouponController {
@RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@RequestParam("timeId") @NotNull @NotBlank String timeId,
@RequestParam("ticketId") @NotNull @NotBlank String ticketId,
@RequestParam("type") @NotNull Integer type) {
return ResponseDto.success(candyCouponService.preUsePerformanceCoupon(priceTotal, performanceId, timeId, ticketId, type));
@RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page) {
CandyMyCouponListVo vo = candyCouponService.preUsePerformanceCoupon(priceTotal, performanceId, timeId, ticketId, type);
List<CandyCouponVo> list = vo.getMyCoupon();
List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) {
page = 1;
}
int size = 10;
int initSize = (page - 1) * size;
int forSize = page * size;
if (forSize >= list.size()) {
forSize = list.size();
}
for (int i = initSize; i < forSize; i++) {
listVo.add(list.get(i));
}
vo.setMyCoupon(listVo);
return ResponseDto.success(vo);
}
// 是否可用券演出
......@@ -120,8 +154,25 @@ public class CandyCouponController {
})
public ResponseDto<CandyMyCouponListVo> preUseGoodCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam("type") @NotNull Integer type) {
return ResponseDto.success(candyCouponService.preUseGoodCoupon(priceTotal, goodId, type));
@RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page) {
CandyMyCouponListVo vo = candyCouponService.preUseGoodCoupon(priceTotal, goodId, type);
List<CandyCouponVo> list = vo.getMyCoupon();
List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) {
page = 1;
}
int size = 10;
int initSize = (page - 1) * size;
int forSize = page * size;
if (forSize >= list.size()) {
forSize = list.size();
}
for (int i = initSize; i < forSize; i++) {
listVo.add(list.get(i));
}
vo.setMyCoupon(listVo);
return ResponseDto.success(vo);
}
//是否可用券 - 商品
......@@ -145,8 +196,24 @@ public class CandyCouponController {
@ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "String", name = "performanceId", value = "演出id", required = true)
})
public ResponseDto<List<CandyCouponVo>> myAdvanceCoupon(@RequestParam("performanceId") @NotNull @NotBlank String performanceId) {
return ResponseDto.success(candyCouponService.myAdvanceCoupon(performanceId));
public ResponseDto<List<CandyCouponVo>> myAdvanceCoupon(@RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@RequestParam(required = false, name = "page") Integer page) {
List<CandyCouponVo> list = candyCouponService.myAdvanceCoupon(performanceId);
List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) {
page = 1;
}
int size = 10;
int initSize = (page - 1) * size;
int forSize = page * size;
if (forSize >= list.size()) {
forSize = list.size();
}
for (int i = initSize; i < forSize; i++) {
listVo.add(list.get(i));
}
return ResponseDto.success();
}
// //判断券是否可用
......@@ -187,11 +254,11 @@ public class CandyCouponController {
@RequestParam("timeId") @NotNull @NotBlank String timeId,
@RequestParam("ticketId") @NotNull @NotBlank String ticketId
) {
CandyUseResultVo result = candyCouponService.useCoupon(uCouponId, content, totalPrice, performanceId, timeId,ticketId, goodId);
CandyUseResultVo result = candyCouponService.useCoupon(uCouponId, content, totalPrice, performanceId, timeId, ticketId, goodId);
if (result == null) {
return ResponseDto.failure();
}
result.setValue(result.getValue().setScale(2,BigDecimal.ROUND_HALF_UP));
result.setValue(result.getValue().setScale(2, BigDecimal.ROUND_HALF_UP));
return ResponseDto.success(result);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment