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

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

用券逻辑修改

parent 33c0f916
......@@ -40,7 +40,7 @@ public interface ICandyCouponService {
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);
......
......@@ -158,10 +158,10 @@ public class CandyCouponController {
@RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page,
@RequestParam(required = false, name = "uid") String uid) {
if(uid==null){
if (uid == null) {
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> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) {
......@@ -192,10 +192,10 @@ public class CandyCouponController {
@RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam(required = false, name = "uid") String uid) {
HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger();
if(uid==null){
if (uid == null) {
uid = CurrentUtil.getCurrentUid();
}
hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, goodId,uid));
hashMap.put("canUse", candyCouponService.preCanUseGoodCoupon(priceTotal, goodId, uid));
return ResponseDto.success(hashMap);
}
......@@ -254,17 +254,21 @@ public class CandyCouponController {
@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 = "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,
@RequestParam("content") @NotNull @NotBlank String content,
@RequestParam("totalPrice") @NotNull String totalPrice,
@RequestParam("goodId") @NotNull @NotBlank String goodId,
@RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@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) {
return ResponseDto.failure();
}
......
......@@ -315,8 +315,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
@Override
public CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodId) {
String uid = CurrentUtil.getCurrentUid();
public CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodId,String uid) {
LocalDateTime userCreateTime;
try {
userCreateTime = DateUtil.Formatter.yyyyMMddHHmmssTrim.parse(CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_UCREATED).toString());
......
......@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) {
spuIds = spuIds.concat("," + item.getSpuId().split(pre)[0]);
spuIds = spuIds.concat(item.getSpuId().split(pre)[0]+",");
} else {
spuIds = spuIds.concat("," + item.getSpuId());
spuIds = spuIds.concat(item.getSpuId()+",");
}
}
if (tempCouponVo != null) {
......@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}
} 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");
Integer typeVoucher = (Integer) hashMap.get("type");
if (typeVoucher.equals(-1)) {
......@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) {
spuIds = spuIds.concat("," + item.getSpuId().split(pre)[0]);
spuIds = spuIds.concat( item.getSpuId().split(pre)[0]+",");
} else {
spuIds = spuIds.concat("," + item.getSpuId());
spuIds = spuIds.concat( item.getSpuId()+",");
}
}
GoblinUseResultVo storeCouponVo = goblinCouponService.useCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid);
......
......@@ -93,7 +93,7 @@ public class GoblinOrderUtils {
* @param totalPrice 订单总价
* @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();
try {
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
......@@ -104,6 +104,7 @@ public class GoblinOrderUtils {
params.add("performanceId", "null");
params.add("timeId", "null");
params.add("ticketId", "null");
params.add("uid", uid);
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Authorization", "Bearer " + CurrentUtil.getToken());
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