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

Commit cae93ec2 authored by 胡佳晨's avatar 胡佳晨

用券逻辑修改

parent 33c0f916
...@@ -40,7 +40,7 @@ public interface ICandyCouponService { ...@@ -40,7 +40,7 @@ public interface ICandyCouponService {
Integer stateCoupon(String uCouponId); Integer stateCoupon(String uCouponId);
CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodIds); CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodIds,String uid);
Boolean useBackCoupon(List<BackCouponParam> backCouponParam); Boolean useBackCoupon(List<BackCouponParam> backCouponParam);
......
...@@ -158,10 +158,10 @@ public class CandyCouponController { ...@@ -158,10 +158,10 @@ public class CandyCouponController {
@RequestParam("type") @NotNull Integer type, @RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page, @RequestParam(required = false, name = "page") Integer page,
@RequestParam(required = false, name = "uid") String uid) { @RequestParam(required = false, name = "uid") String uid) {
if(uid==null){ if (uid == null) {
uid = CurrentUtil.getCurrentUid(); uid = CurrentUtil.getCurrentUid();
} }
CandyMyCouponListVo vo = candyCouponService.preUseGoodCoupon(priceTotal, goodId, type,uid); 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) {
...@@ -192,10 +192,10 @@ public class CandyCouponController { ...@@ -192,10 +192,10 @@ public class CandyCouponController {
@RequestParam("goodId") @NotNull @NotBlank String goodId, @RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam(required = false, name = "uid") String uid) { @RequestParam(required = false, name = "uid") String uid) {
HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger(); HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger();
if(uid==null){ if (uid == null) {
uid = CurrentUtil.getCurrentUid(); uid = CurrentUtil.getCurrentUid();
} }
hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, goodId,uid)); hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, goodId, uid));
return ResponseDto.success(hashMap); return ResponseDto.success(hashMap);
} }
...@@ -254,17 +254,21 @@ public class CandyCouponController { ...@@ -254,17 +254,21 @@ public class CandyCouponController {
@ApiImplicitParam(type = "form", dataType = "String", name = "performanceId", value = "演出id", required = true), @ApiImplicitParam(type = "form", dataType = "String", name = "performanceId", value = "演出id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "timeId", value = "场次id", required = true), @ApiImplicitParam(type = "form", dataType = "String", name = "timeId", value = "场次id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "ticketId", value = "票id", required = true), @ApiImplicitParam(type = "form", dataType = "String", name = "ticketId", value = "票id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "uid", value = "uid", required = false),
}) })
public ResponseDto<CandyUseResultVo> useCoupon(@RequestParam("uCouponId") @NotNull @NotBlank String uCouponId, public ResponseDto<CandyUseResultVo> useCoupon(@RequestParam("uCouponId") @NotNull @NotBlank String uCouponId,
@RequestParam("content") @NotNull @NotBlank String content, @RequestParam("content") @NotNull @NotBlank String content,
@RequestParam("totalPrice") @NotNull String totalPrice, @RequestParam("totalPrice") @NotNull String totalPrice,
@RequestParam("goodId") @NotNull @NotBlank String goodId, @RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam("performanceId") @NotNull @NotBlank String performanceId, @RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@RequestParam("timeId") @NotNull @NotBlank String timeId, @RequestParam("timeId") @NotNull @NotBlank String timeId,
@RequestParam("ticketId") @NotNull @NotBlank String ticketId @RequestParam("ticketId") @NotNull @NotBlank String ticketId,
@RequestParam(value = "uid", required = false) @NotNull @NotBlank String uid
) { ) {
CandyUseResultVo result = candyCouponService.useCoupon(uCouponId, content, totalPrice, performanceId, timeId, ticketId, goodId); if (uid == null) {
uid = CurrentUtil.getCurrentUid();
}
CandyUseResultVo result = candyCouponService.useCoupon(uCouponId, content, totalPrice, performanceId, timeId, ticketId, goodId, uid);
if (result == null) { if (result == null) {
return ResponseDto.failure(); return ResponseDto.failure();
} }
......
...@@ -315,8 +315,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService { ...@@ -315,8 +315,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
} }
@Override @Override
public CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodId) { public CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, 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());
......
...@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) { for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId()); String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) { if (pre != null) {
spuIds = spuIds.concat("," + item.getSpuId().split(pre)[0]); spuIds = spuIds.concat(item.getSpuId().split(pre)[0]+",");
} else { } else {
spuIds = spuIds.concat("," + item.getSpuId()); spuIds = spuIds.concat(item.getSpuId()+",");
} }
} }
if (tempCouponVo != null) { if (tempCouponVo != null) {
...@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
} }
} }
} else { } else {
HashMap<String, Object> hashMap = orderUtils.useCoupon(platVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds); HashMap<String, Object> hashMap = orderUtils.useCoupon(platVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds,uid);
voucherPrice = (BigDecimal) hashMap.get("voucher"); voucherPrice = (BigDecimal) hashMap.get("voucher");
Integer typeVoucher = (Integer) hashMap.get("type"); Integer typeVoucher = (Integer) hashMap.get("type");
if (typeVoucher.equals(-1)) { if (typeVoucher.equals(-1)) {
...@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) { for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId()); String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) { if (pre != null) {
spuIds = spuIds.concat("," + item.getSpuId().split(pre)[0]); spuIds = spuIds.concat( item.getSpuId().split(pre)[0]+",");
} else { } else {
spuIds = spuIds.concat("," + item.getSpuId()); spuIds = spuIds.concat( item.getSpuId()+",");
} }
} }
GoblinUseResultVo storeCouponVo = goblinCouponService.useCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid); GoblinUseResultVo storeCouponVo = goblinCouponService.useCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid);
......
...@@ -93,7 +93,7 @@ public class GoblinOrderUtils { ...@@ -93,7 +93,7 @@ public class GoblinOrderUtils {
* @param totalPrice 订单总价 * @param totalPrice 订单总价
* @return * @return
*/ */
public HashMap<String, Object> useCoupon(String uCouponId, String content, BigDecimal totalPrice, String spuId) { public HashMap<String, Object> useCoupon(String uCouponId, String content, BigDecimal totalPrice, String spuId,String uid) {
HashMap<String, Object> hashMap = CollectionUtil.mapStringObject(); HashMap<String, Object> hashMap = CollectionUtil.mapStringObject();
try { try {
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
...@@ -104,6 +104,7 @@ public class GoblinOrderUtils { ...@@ -104,6 +104,7 @@ public class GoblinOrderUtils {
params.add("performanceId", "null"); params.add("performanceId", "null");
params.add("timeId", "null"); params.add("timeId", "null");
params.add("ticketId", "null"); params.add("ticketId", "null");
params.add("uid", uid);
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Authorization", "Bearer " + CurrentUtil.getToken()); header.add("Authorization", "Bearer " + CurrentUtil.getToken());
header.add("Accept", "application/json;charset=UTF-8"); header.add("Accept", "application/json;charset=UTF-8");
......
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