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

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

修改 下单

parent 9054ce5d
...@@ -22,7 +22,11 @@ public class CollectionUtil { ...@@ -22,7 +22,11 @@ public class CollectionUtil {
private static final ArrayList<Object> OBJECT_ARRAY_LIST = new ArrayList<>(); private static final ArrayList<Object> OBJECT_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<BigDecimal> BIG_DECIMALS_ARRAY_LIST = new ArrayList<>(); private static final ArrayList<BigDecimal> BIG_DECIMALS_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<BigDecimal> BIGDECIMAL_ARRAY_LIST = new ArrayList<>(); private static final ArrayList<BigDecimal> BIGDECIMAL_ARRAY_LIST = new ArrayList<>();
private static final String[] STRING_ARRAY = new String[]{};
public static String[] stringArray() {
return STRING_ARRAY.clone();
}
public static HashMap<String, String> mapStringString() { public static HashMap<String, String> mapStringString() {
return (HashMap<String, String>) STRING_STRING_HASH_MAP.clone(); return (HashMap<String, String>) STRING_STRING_HASH_MAP.clone();
} }
......
...@@ -200,7 +200,7 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin ...@@ -200,7 +200,7 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId(); String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}", listId); log.debug("listId : {}", listId);
String mixId = nftOrder.getMixId(); String mixId = nftOrder.getMixId();
if(mixId!=null && !mixId.equals("")){ if (mixId != null && !mixId.equals("")) {
listId = mixId; listId = mixId;
log.debug("mixId : {}", listId); log.debug("mixId : {}", listId);
} }
...@@ -241,6 +241,9 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin ...@@ -241,6 +241,9 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
String[] goblin = map.get("goblin"); String[] goblin = map.get("goblin");
for (String orderId : goblin) { for (String orderId : goblin) {
if("".equals(orderId)){
break;
}
GoblinStoreOrderVo orderVo = getGoblinOrder(orderId); GoblinStoreOrderVo orderVo = getGoblinOrder(orderId);
if (orderVo.getStatus().equals(GoblinStatusConst.Status.ORDER_STATUS_0.getValue())) {//订单回滚 if (orderVo.getStatus().equals(GoblinStatusConst.Status.ORDER_STATUS_0.getValue())) {//订单回滚
LinkedList<String> sqls = CollectionUtil.linkedListString(); LinkedList<String> sqls = CollectionUtil.linkedListString();
...@@ -288,6 +291,9 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin ...@@ -288,6 +291,9 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
} }
for (String orderId : nft) { for (String orderId : nft) {
if("".equals(orderId)){
break;
}
checkNftOrderTime(orderId); checkNftOrderTime(orderId);
} }
...@@ -403,8 +409,14 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin ...@@ -403,8 +409,14 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
return null; return null;
} else { } else {
String[] a = ((String) obj).split("&&"); String[] a = ((String) obj).split("&&");
String[] nftA = a[0].split(","); String[] nftA = CollectionUtil.stringArray();
String[] goblinA = a[1].split(","); String[] goblinA = CollectionUtil.stringArray();
if (a.length > 0) {
nftA = a[0].split(",");
}
if (a.length > 1) {
goblinA = a[1].split(",");
}
HashMap<String, String[]> map = mixIdMap(); HashMap<String, String[]> map = mixIdMap();
map.put("nft", nftA); map.put("nft", nftA);
map.put("goblin", goblinA); map.put("goblin", goblinA);
......
...@@ -139,6 +139,9 @@ public class GoblinMixAppServiceImpl implements IGoblinMixAppService { ...@@ -139,6 +139,9 @@ public class GoblinMixAppServiceImpl implements IGoblinMixAppService {
List<GoblinNftOrderDetailsVo> nftOrderListVos = ObjectUtil.goblinNftOrderDetailsVoArrayList(); List<GoblinNftOrderDetailsVo> nftOrderListVos = ObjectUtil.goblinNftOrderDetailsVoArrayList();
for (String orderId : nft) { for (String orderId : nft) {
if("".equals(orderId)){
break;
}
// 订单信息 // 订单信息
GoblinNftOrderVo orderVo = redisUtils.getGoblinNftOrder(orderId); GoblinNftOrderVo orderVo = redisUtils.getGoblinNftOrder(orderId);
GoblinNftOrderDetailsVo orderDetails = GoblinNftOrderDetailsVo.getNew().copy(orderVo); GoblinNftOrderDetailsVo orderDetails = GoblinNftOrderDetailsVo.getNew().copy(orderVo);
...@@ -149,6 +152,9 @@ public class GoblinMixAppServiceImpl implements IGoblinMixAppService { ...@@ -149,6 +152,9 @@ public class GoblinMixAppServiceImpl implements IGoblinMixAppService {
nftOrderListVos.add(orderDetails); nftOrderListVos.add(orderDetails);
} }
for (String orderId : goblin) { for (String orderId : goblin) {
if("".equals(orderId)){
break;
}
GoblinStoreOrderVo orderVo = redisUtils.getGoblinOrder(orderId); GoblinStoreOrderVo orderVo = redisUtils.getGoblinOrder(orderId);
GoblinAppOrderListVo vos = GoblinAppOrderListVo.getNew(); GoblinAppOrderListVo vos = GoblinAppOrderListVo.getNew();
BeanUtils.copyProperties(orderVo, vos); BeanUtils.copyProperties(orderVo, vos);
......
...@@ -1614,8 +1614,14 @@ public class GoblinRedisUtils { ...@@ -1614,8 +1614,14 @@ public class GoblinRedisUtils {
return null; return null;
} else { } else {
String[] a = ((String) obj).split("&&"); String[] a = ((String) obj).split("&&");
String[] nftA = a[0].split(","); String[] nftA = CollectionUtil.stringArray();
String[] goblinA = a[1].split(","); String[] goblinA = CollectionUtil.stringArray();
if (a.length > 0) {
nftA = a[0].split(",");
}
if (a.length > 1) {
goblinA = a[1].split(",");
}
HashMap<String, String[]> map = ObjectUtil.mixIdMap(); HashMap<String, String[]> map = ObjectUtil.mixIdMap();
map.put("nft", nftA); map.put("nft", nftA);
map.put("goblin", goblinA); map.put("goblin", goblinA);
......
...@@ -77,6 +77,7 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -77,6 +77,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
boolean isUseLimit = false;//是否减限购 boolean isUseLimit = false;//是否减限购
try { try {
GoblinMixDetailsVo mixVo = redisUtils.getMixDetails(param.getMixId()); GoblinMixDetailsVo mixVo = redisUtils.getMixDetails(param.getMixId());
String storeName = redisUtils.getStoreInfoVo(mixVo.getStoreId()).getStoreName();
String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), ""); String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), "");
String nickName = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_NICKNAME)), ""); String nickName = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_NICKNAME)), "");
String headerCliSource = CurrentUtil.getHeaderCliSource(), headerCliVersion = CurrentUtil.getHeaderCliVersion(); String headerCliSource = CurrentUtil.getHeaderCliSource(), headerCliVersion = CurrentUtil.getHeaderCliVersion();
...@@ -129,7 +130,7 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -129,7 +130,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
log.debug("stockId = " + boxSkuInfo.getSkuId() + " stock = " + itemVo.getCount()); log.debug("stockId = " + boxSkuInfo.getSkuId() + " stock = " + itemVo.getCount());
canBuyIds.add(boxSkuInfo.getSkuId() + "," + itemVo.getCount()); canBuyIds.add(boxSkuInfo.getSkuId() + "," + itemVo.getCount());
} }
boxSkuId.put(skuId, skuInfoVo.getSkuId()); boxSkuId.put(skuId, boxSkuInfo.getSkuId());
stockSkuId.put(skuId, skuInfoVo.getSkuId()); stockSkuId.put(skuId, skuInfoVo.getSkuId());
} }
} else {//正常 } else {//正常
...@@ -175,10 +176,16 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -175,10 +176,16 @@ public class MixOrderServiceImpl implements IMixOrderService {
// } // }
//下单 //下单
//生成nft订单 //生成nft订单
List<GoblinNftOrder> nftOrderList = nftOrder(nftInfoList, nftMix, boxSkuId, mobile, source, version, nickName, nt, uid, param.getPayType(), param.getDeviceFrom()); List<GoblinNftOrder> nftOrderList = ObjectUtil.goblinNftOrderList();
if (nftInfoList.size() > 0) {
nftOrderList = nftOrder(nftInfoList, nftMix, boxSkuId, mobile, source, version, nickName, nt, uid, param.getPayType(), param.getDeviceFrom());
}
//生成goblin订单 //生成goblin订单
GoblinOrderPreParam preParam = goblinOrder(skuInfoList, skuMix, param.getAddressesVo(), mobile, source, version, nickName, nt, uid, param.getPayType(), param.getDeviceFrom()); GoblinOrderPreParam preParam = null;
return ResponseDto.success(payOrder(nftOrderList, preParam, orderMasterCode, param.getShowUrl(), param.getReturnUrl(), param.getDeviceFrom(), param.getPayType(), mixId, mixVo.getName())); if (skuInfoList.size() > 0) {
preParam = goblinOrder(skuInfoList, skuMix, param.getAddressesVo(), mobile, source, version, nickName, nt, uid, param.getPayType(), param.getDeviceFrom());
}
return ResponseDto.success(payOrder(nftOrderList, preParam, orderMasterCode, param.getShowUrl(), param.getReturnUrl(), param.getDeviceFrom(), param.getPayType(), mixId, mixVo.getName(), param.getOpenId(), nt,storeName));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
initStock(canBuyIds, mixId, isUseLimit, uid); initStock(canBuyIds, mixId, isUseLimit, uid);
...@@ -348,7 +355,7 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -348,7 +355,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
} }
private GoblinPayInnerResultVo payOrder(List<GoblinNftOrder> nftOrder, GoblinOrderPreParam preParam, String masterCode, String showUrl, String returnUrl, String deviceForm, String payType, String mixId, String mixName) { private GoblinPayInnerResultVo payOrder(List<GoblinNftOrder> nftOrder, GoblinOrderPreParam preParam, String masterCode, String showUrl, String returnUrl, String deviceForm, String payType, String mixId, String mixName, String openId, LocalDateTime now, String storeName) {
GoblinPayInnerResultVo NftPayResultVo = GoblinPayInnerResultVo.getNew(); GoblinPayInnerResultVo NftPayResultVo = GoblinPayInnerResultVo.getNew();
//是否免费 //是否免费
boolean isFree = false; boolean isFree = false;
...@@ -365,16 +372,19 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -365,16 +372,19 @@ public class MixOrderServiceImpl implements IMixOrderService {
nftOrderStr = nftOrderStr.concat(item.getOrderId()).concat(","); nftOrderStr = nftOrderStr.concat(item.getOrderId()).concat(",");
} }
details = details.concat(preParam.getSkuName()).substring(1); if (preParam != null) {
orderStr = orderStr.concat(preParam.getOrderIdList()); details = details.concat(preParam.getSkuName()).substring(1);
payPrice = payPrice.add(preParam.getPriceActual()); orderStr = orderStr.concat(preParam.getOrderIdList());
payPrice = payPrice.add(preParam.getPriceActual());
storeName = preParam.getStoreName();
}
if (payPrice.compareTo(BigDecimal.valueOf(0)) > 0) { if (payPrice.compareTo(BigDecimal.valueOf(0)) > 0) {
// 调用支付 // 调用支付
LinkedMultiValueMap<String, String> httpData = CollectionUtil.linkedMultiValueMapStringString(); LinkedMultiValueMap<String, String> httpData = CollectionUtil.linkedMultiValueMapStringString();
httpData.add("type", "MIX"); httpData.add("type", "MIX");
httpData.add("price", payPrice.toString()); httpData.add("price", payPrice.toString());
httpData.add("name", preParam.getStoreName()); httpData.add("name", storeName);
httpData.add("detail", details); httpData.add("detail", details);
httpData.add("orderCode", masterCode); httpData.add("orderCode", masterCode);
httpData.add("orderId", nftOrderStr.concat(orderStr)); httpData.add("orderId", nftOrderStr.concat(orderStr));
...@@ -386,7 +396,7 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -386,7 +396,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
httpData.add("deviceFrom", deviceForm); httpData.add("deviceFrom", deviceForm);
if (deviceForm.equals("js") || deviceForm.equals("applet")) { if (deviceForm.equals("js") || deviceForm.equals("applet")) {
httpData.add("openId", preParam.getOpenId()); httpData.add("openId", openId);
} }
httpData.add("showUrl", showUrl + masterCode); httpData.add("showUrl", showUrl + masterCode);
httpData.add("returnUrl", returnUrl + masterCode); httpData.add("returnUrl", returnUrl + masterCode);
...@@ -421,7 +431,7 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -421,7 +431,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
NftPayResultVo.setOrderMasterCode(masterCode); NftPayResultVo.setOrderMasterCode(masterCode);
// 待支付发送队列 // 待支付发送队列
queueUtils.sendMsgByRedisGoblinStock(masterCode, preParam.getStoreOrder().getCreatedAt(), "MIX", 5); queueUtils.sendMsgByRedisGoblinStock(masterCode, now, "MIX", 5);
LinkedList<String> sqls = CollectionUtil.linkedListString(); LinkedList<String> sqls = CollectionUtil.linkedListString();
sqls.add(SqlMapping.get("goblin_nft_order.insert")); sqls.add(SqlMapping.get("goblin_nft_order.insert"));
...@@ -454,38 +464,40 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -454,38 +464,40 @@ public class MixOrderServiceImpl implements IMixOrderService {
LinkedList<Object[]> sqlDataGoblin = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> sqlDataGoblin = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> sqlDataAttr = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> sqlDataAttr = CollectionUtil.linkedListObjectArr();
List<String> goblinOrderSkuIdList = CollectionUtil.linkedListString(); List<String> goblinOrderSkuIdList = CollectionUtil.linkedListString();
for (GoblinOrderSku orderSku : preParam.getOrderSkuList()) { if (preParam != null) {
sqlDataSku.add(new Object[]{ for (GoblinOrderSku orderSku : preParam.getOrderSkuList()) {
orderSku.getOrderSkuId(), orderSku.getOrderId(), orderSku.getSpuId(), orderSku.getSpuName(), orderSku.getSpuPic(), orderSku.getSkuId(), orderSku.getNum(), orderSku.getSkuPrice(), orderSku.getSkuPriceActual(), orderSku.getSkuName(), sqlDataSku.add(new Object[]{
orderSku.getSkuNo(), orderSku.getSkuImage(), orderSku.getSkuSpecs(), orderSku.getPriceVoucher(), orderSku.getCreatedAt() orderSku.getOrderSkuId(), orderSku.getOrderId(), orderSku.getSpuId(), orderSku.getSpuName(), orderSku.getSpuPic(), orderSku.getSkuId(), orderSku.getNum(), orderSku.getSkuPrice(), orderSku.getSkuPriceActual(), orderSku.getSkuName(),
orderSku.getSkuNo(), orderSku.getSkuImage(), orderSku.getSkuSpecs(), orderSku.getPriceVoucher(), orderSku.getCreatedAt()
});
//订单 orderSku Vo
GoblinOrderSkuVo orderSkuVo = GoblinOrderSkuVo.getNew().copy(orderSku);
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
goblinOrderSkuIdList.add(orderSkuVo.getOrderSkuId());
}
GoblinStoreOrder storeOrder = preParam.getStoreOrder();
storeOrder.setPayCode(payCode);
sqlDataGoblin.add(new Object[]{
storeOrder.getMasterOrderCode(), storeOrder.getOrderId(), storeOrder.getStoreId(), storeOrder.getStoreName(), storeOrder.getOrderCode(), storeOrder.getUserId(), storeOrder.getUserName(), storeOrder.getUserMobile(), storeOrder.getPriceTotal(), storeOrder.getPayCode(),
storeOrder.getPriceActual(), storeOrder.getPriceRefund(), storeOrder.getPriceExpress(), storeOrder.getPriceCoupon(), storeOrder.getStorePriceCoupon(), storeOrder.getPriceVoucher(), storeOrder.getStatus(), storeOrder.getUcouponId(), storeOrder.getStoreCouponId(), storeOrder.getPayType(), storeOrder.getDeviceFrom(),
storeOrder.getSource(), storeOrder.getVersion(), storeOrder.getIsMember(), storeOrder.getOrderType(), storeOrder.getWriteOffCode(), storeOrder.getPayCountdownMinute(), storeOrder.getIpAddress(), storeOrder.getMarketId(), storeOrder.getMarketType(), storeOrder.getCreatedAt(), ""
}); });
//订单 orderSku Vo GoblinOrderAttr orderAttr = preParam.getOrderAttr();
GoblinOrderSkuVo orderSkuVo = GoblinOrderSkuVo.getNew().copy(orderSku); sqlDataAttr.add(new Object[]{
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo); orderAttr.getOrderAttrId(), orderAttr.getOrderId(), orderAttr.getExpressContacts(), orderAttr.getExpressAddress(), orderAttr.getExpressAddressDetail(), orderAttr.getExpressPhone(), orderAttr.getExpressType(), orderAttr.getCreatedAt()
goblinOrderSkuIdList.add(orderSkuVo.getOrderSkuId()); });
//订单vo
GoblinStoreOrderVo orderVo = GoblinStoreOrderVo.getNew().copyMix(storeOrder, mixId, mixName);
//订单attr vo
GoblinOrderAttrVo orderAttrVo = GoblinOrderAttrVo.getNew().copy(orderAttr);
//redis 赋值
orderVo.setOrderAttrVo(orderAttrVo);
orderVo.setOrderSkuVoIds(goblinOrderSkuIdList);
orderVo.setCreatedAt(getNowTime());
redisUtils.setGoblinOrder(orderVo.getOrderId(), orderVo);
redisUtils.setMasterCode(orderVo.getMasterOrderCode(), orderStr);
queueUtils.setMongoList(GoblinStoreOrderVo.class.getSimpleName(), "orderId", orderVo.getOrderId(), GoblinRedisConst.REDIS_GOBLIN_ORDER, 1);
} }
GoblinStoreOrder storeOrder = preParam.getStoreOrder();
storeOrder.setPayCode(payCode);
sqlDataGoblin.add(new Object[]{
storeOrder.getMasterOrderCode(), storeOrder.getOrderId(), storeOrder.getStoreId(), storeOrder.getStoreName(), storeOrder.getOrderCode(), storeOrder.getUserId(), storeOrder.getUserName(), storeOrder.getUserMobile(), storeOrder.getPriceTotal(), storeOrder.getPayCode(),
storeOrder.getPriceActual(), storeOrder.getPriceRefund(), storeOrder.getPriceExpress(), storeOrder.getPriceCoupon(), storeOrder.getStorePriceCoupon(), storeOrder.getPriceVoucher(), storeOrder.getStatus(), storeOrder.getUcouponId(), storeOrder.getStoreCouponId(), storeOrder.getPayType(), storeOrder.getDeviceFrom(),
storeOrder.getSource(), storeOrder.getVersion(), storeOrder.getIsMember(), storeOrder.getOrderType(), storeOrder.getWriteOffCode(), storeOrder.getPayCountdownMinute(), storeOrder.getIpAddress(), storeOrder.getMarketId(), storeOrder.getMarketType(), storeOrder.getCreatedAt(), ""
});
GoblinOrderAttr orderAttr = preParam.getOrderAttr();
sqlDataAttr.add(new Object[]{
orderAttr.getOrderAttrId(), orderAttr.getOrderId(), orderAttr.getExpressContacts(), orderAttr.getExpressAddress(), orderAttr.getExpressAddressDetail(), orderAttr.getExpressPhone(), orderAttr.getExpressType(), orderAttr.getCreatedAt()
});
//订单vo
GoblinStoreOrderVo orderVo = GoblinStoreOrderVo.getNew().copyMix(storeOrder, mixId, mixName);
//订单attr vo
GoblinOrderAttrVo orderAttrVo = GoblinOrderAttrVo.getNew().copy(orderAttr);
//redis 赋值
orderVo.setOrderAttrVo(orderAttrVo);
orderVo.setOrderSkuVoIds(goblinOrderSkuIdList);
orderVo.setCreatedAt(getNowTime());
redisUtils.setGoblinOrder(orderVo.getOrderId(), orderVo);
redisUtils.setMasterCode(orderVo.getMasterOrderCode(), orderStr);
queueUtils.setMongoList(GoblinStoreOrderVo.class.getSimpleName(), "orderId", orderVo.getOrderId(), GoblinRedisConst.REDIS_GOBLIN_ORDER, 1);
orderMixStr = orderMixStr.concat("&&").concat(orderStr); orderMixStr = orderMixStr.concat("&&").concat(orderStr);
redisUtils.setMasterCode(masterCode, orderMixStr); redisUtils.setMasterCode(masterCode, orderMixStr);
...@@ -537,12 +549,18 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -537,12 +549,18 @@ public class MixOrderServiceImpl implements IMixOrderService {
boolean isSuccess = true; boolean isSuccess = true;
for (String orderId : nft) { for (String orderId : nft) {
if("".equals(orderId)){
break;
}
String nftR = syncNft(orderId, code, status, paymentType, paymentId, paymentAt); String nftR = syncNft(orderId, code, status, paymentType, paymentId, paymentAt);
if ("fail".equals(nftR)) { if ("fail".equals(nftR)) {
isSuccess = false; isSuccess = false;
} }
} }
for (String orderId : goblin) { for (String orderId : goblin) {
if("".equals(orderId)){
break;
}
String goblinR = syncGoblin(orderId, code, status, paymentType, paymentId, paymentAt); String goblinR = syncGoblin(orderId, code, status, paymentType, paymentId, paymentAt);
if ("fail".equals(goblinR)) { if ("fail".equals(goblinR)) {
isSuccess = false; isSuccess = false;
...@@ -747,6 +765,9 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -747,6 +765,9 @@ public class MixOrderServiceImpl implements IMixOrderService {
String[] goblin = map.get("goblin"); String[] goblin = map.get("goblin");
for (String orderId : nft) { for (String orderId : nft) {
if("".equals(orderId)){
break;
}
String nftR = nftCheck(uid, orderId); String nftR = nftCheck(uid, orderId);
if ("订单不存在".equals(nftR)) { if ("订单不存在".equals(nftR)) {
return ResponseDto.failure("订单不存在"); return ResponseDto.failure("订单不存在");
...@@ -755,6 +776,9 @@ public class MixOrderServiceImpl implements IMixOrderService { ...@@ -755,6 +776,9 @@ public class MixOrderServiceImpl implements IMixOrderService {
} }
} }
for (String orderId : goblin) { for (String orderId : goblin) {
if("".equals(orderId)){
break;
}
String goblinR = goblinCheck(uid, orderId); String goblinR = goblinCheck(uid, orderId);
if ("订单不存在".equals(goblinR)) { if ("订单不存在".equals(goblinR)) {
return ResponseDto.failure("订单不存在"); return ResponseDto.failure("订单不存在");
......
...@@ -554,6 +554,7 @@ public class GoblinNftOrderUtils { ...@@ -554,6 +554,7 @@ public class GoblinNftOrderUtils {
// String endListId = newListIds.get(index); // String endListId = newListIds.get(index);
// 判断库存 // 判断库存
int surplusGeneral = goblinRedisUtils.decrSkuStock(listId, goodsSkuInfoVo.getSkuId(), number); int surplusGeneral = goblinRedisUtils.decrSkuStock(listId, goodsSkuInfoVo.getSkuId(), number);
log.error("剩余 skuId = "+surplusGeneral);
if (surplusGeneral < 0) { if (surplusGeneral < 0) {
goblinRedisUtils.incrSkuStock(listId, goodsSkuInfoVo.getSkuId(), number); goblinRedisUtils.incrSkuStock(listId, goodsSkuInfoVo.getSkuId(), number);
return lotteryDraw(skuIdList, number, nowTime, listId); return lotteryDraw(skuIdList, number, nowTime, listId);
......
...@@ -468,8 +468,14 @@ public class GoblinRedisUtils { ...@@ -468,8 +468,14 @@ public class GoblinRedisUtils {
return null; return null;
} else { } else {
String[] a = ((String) obj).split("&&"); String[] a = ((String) obj).split("&&");
String[] nftA = a[0].split(","); String[] nftA = CollectionUtil.stringArray();
String[] goblinA = a[1].split(","); String[] goblinA = CollectionUtil.stringArray();
if (a.length > 0) {
nftA = a[0].split(",");
}
if (a.length > 1) {
goblinA = a[1].split(",");
}
HashMap<String, String[]> map = ObjectUtil.mixIdMap(); HashMap<String, String[]> map = ObjectUtil.mixIdMap();
map.put("nft", nftA); map.put("nft", nftA);
map.put("goblin", goblinA); map.put("goblin", goblinA);
......
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