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

Commit 803b6227 authored by 胡佳晨's avatar 胡佳晨

修改 商品券 可用uid

parent 5fd0ee66
...@@ -32,9 +32,9 @@ public interface ICandyCouponService { ...@@ -32,9 +32,9 @@ public interface ICandyCouponService {
Integer preCanUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId); Integer preCanUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId);
CandyMyCouponListVo preUseGoodCoupon(BigDecimal priceTotal, String goodId, Integer type); CandyMyCouponListVo preUseGoodCoupon(BigDecimal priceTotal, String goodId, Integer type,String uid);
Integer preCanUseGoodCoupon(BigDecimal priceTotal, String goodI); Integer preCanUseGoodCoupon(BigDecimal priceTotal, String goodI,String uid);
List<CandyCouponVo> myAdvanceCoupon(String performanceId); List<CandyCouponVo> myAdvanceCoupon(String performanceId);
......
...@@ -151,12 +151,17 @@ public class CandyCouponController { ...@@ -151,12 +151,17 @@ public class CandyCouponController {
@ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true), @ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "goodId", value = "商品id(逗号隔开的字符串)", required = true), @ApiImplicitParam(type = "form", dataType = "String", name = "goodId", value = "商品id(逗号隔开的字符串)", required = true),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "type", value = "类型 1可用 2过期/已使用 ", required = true), @ApiImplicitParam(type = "form", dataType = "Integer", name = "type", value = "类型 1可用 2过期/已使用 ", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "uid", value = "用户id", required = false),
}) })
public ResponseDto<CandyMyCouponListVo> preUseGoodCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal, public ResponseDto<CandyMyCouponListVo> preUseGoodCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("goodId") @NotNull @NotBlank String goodId, @RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam("type") @NotNull Integer type, @RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page) { @RequestParam(required = false, name = "page") Integer page,
CandyMyCouponListVo vo = candyCouponService.preUseGoodCoupon(priceTotal, goodId, type); @RequestParam(required = false, name = "uid") String uid) {
if(uid==null){
uid = CurrentUtil.getCurrentUid();
}
CandyMyCouponListVo vo = candyCouponService.preUseGoodCoupon(priceTotal, goodId, type,uid);
List<CandyCouponVo> list = vo.getMyCoupon(); List<CandyCouponVo> list = vo.getMyCoupon();
List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList(); List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) { if (page == null || page == 0) {
...@@ -180,12 +185,17 @@ public class CandyCouponController { ...@@ -180,12 +185,17 @@ public class CandyCouponController {
@ApiOperation("是否可用券 - 商品") @ApiOperation("是否可用券 - 商品")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true), @ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "goodId", value = "商品id(逗号隔开的字符串)", required = true) @ApiImplicitParam(type = "form", dataType = "String", name = "goodId", value = "商品id(逗号隔开的字符串)", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "uid", value = "用户id", required = false),
}) })
public ResponseDto<HashMap<String, Integer>> preCanUseGoodCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal, public ResponseDto<HashMap<String, Integer>> preCanUseGoodCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("goodId") @NotNull @NotBlank String goodId) { @RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam(required = false, name = "uid") String uid) {
HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger(); HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger();
hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, goodId)); if(uid==null){
uid = CurrentUtil.getCurrentUid();
}
hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, goodId,uid));
return ResponseDto.success(hashMap); return ResponseDto.success(hashMap);
} }
...@@ -341,48 +351,48 @@ public class CandyCouponController { ...@@ -341,48 +351,48 @@ public class CandyCouponController {
// } // }
} }
//
//要使用券列表 - 商品 // //要使用券列表 - 商品
@PostMapping("preUse/goods/store") // @PostMapping("preUse/goods/store")
@ApiOperation("要使用券列表 - 商品[商铺]") // @ApiOperation("要使用券列表 - 商品[商铺]")
@ApiImplicitParams({ // @ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true), // @ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "skuIds", value = "商品id(逗号隔开的字符串)", required = true), // @ApiImplicitParam(type = "form", dataType = "String", name = "skuIds", value = "商品id(逗号隔开的字符串)", required = true),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "type", value = "类型 1可用 2过期/已使用 ", required = true), // @ApiImplicitParam(type = "form", dataType = "Integer", name = "type", value = "类型 1可用 2过期/已使用 ", required = true),
}) // })
public ResponseDto<List<CandyCouponVo>> preUseGoodStore(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal, // public ResponseDto<List<CandyCouponVo>> preUseGoodStore(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("skuIds") @NotNull @NotBlank String skuIds, // @RequestParam("skuIds") @NotNull @NotBlank String skuIds,
@RequestParam("type") @NotNull Integer type, // @RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page) { // @RequestParam(required = false, name = "page") Integer page) {
CandyMyCouponListVo vo = candyCouponService.preUseGoodCoupon(priceTotal, skuIds, type); // CandyMyCouponListVo vo = candyCouponService.preUseGoodCoupon(priceTotal, skuIds, type);
List<CandyCouponVo> list = vo.getMyCoupon(); // List<CandyCouponVo> list = vo.getMyCoupon();
List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList(); // List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) { // if (page == null || page == 0) {
page = 1; // page = 1;
} // }
int size = 10; // int size = 10;
int initSize = (page - 1) * size; // int initSize = (page - 1) * size;
int forSize = page * size; // int forSize = page * size;
if (forSize >= list.size()) { // if (forSize >= list.size()) {
forSize = list.size(); // forSize = list.size();
} // }
for (int i = initSize; i < forSize; i++) { // for (int i = initSize; i < forSize; i++) {
listVo.add(list.get(i)); // listVo.add(list.get(i));
} // }
return ResponseDto.success(listVo); // return ResponseDto.success(listVo);
} // }
//
//是否可用券 - 商品 // //是否可用券 - 商品
@PostMapping("preCanUse/goods/store") // @PostMapping("preCanUse/goods/store")
@ApiOperation("是否可用券 - 商品[商铺]") // @ApiOperation("是否可用券 - 商品[商铺]")
@ApiImplicitParams({ // @ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true), // @ApiImplicitParam(type = "form", dataType = "BigDecimal", name = "priceTotal", value = "待支付总金额", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "goodId", value = "商品id(逗号隔开的字符串)", required = true) // @ApiImplicitParam(type = "form", dataType = "String", name = "goodId", value = "商品id(逗号隔开的字符串)", required = true)
}) // })
public ResponseDto<HashMap<String, Integer>> preCanUseGoodStore(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal, // public ResponseDto<HashMap<String, Integer>> preCanUseGoodStore(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("skuIds") @NotNull @NotBlank String skuIds) { // @RequestParam("skuIds") @NotNull @NotBlank String skuIds) {
HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger(); // HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger();
hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, skuIds)); // hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, skuIds));
return ResponseDto.success(hashMap); // return ResponseDto.success(hashMap);
} // }
} }
...@@ -206,8 +206,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -206,8 +206,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
} }
@Override @Override
public CandyMyCouponListVo preUseGoodCoupon(BigDecimal priceTotal, String goodId, Integer type) { public CandyMyCouponListVo preUseGoodCoupon(BigDecimal priceTotal, String goodId, Integer type,String uid) {
String uid = CurrentUtil.getCurrentUid();
LocalDateTime userCreateTime; LocalDateTime userCreateTime;
try { try {
userCreateTime = DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString()); userCreateTime = DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString());
...@@ -249,8 +248,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -249,8 +248,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
} }
@Override @Override
public Integer preCanUseGoodCoupon(BigDecimal priceTotal, String goodId) { public Integer preCanUseGoodCoupon(BigDecimal priceTotal, String goodId,String uid) {
String uid = CurrentUtil.getCurrentUid();
LocalDateTime userCreateTime; LocalDateTime userCreateTime;
try { try {
userCreateTime = DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString()); userCreateTime = DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString());
......
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