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

Commit 7dc360f9 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/hjc' into hjc

parents 34cfe8dc f4c9eefb
...@@ -682,7 +682,15 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService { ...@@ -682,7 +682,15 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
params.add("paymentId", orderVo.getPaymentId()); params.add("paymentId", orderVo.getPaymentId());
params.add("paymentType", orderVo.getPaymentType()); params.add("paymentType", orderVo.getPaymentType());
params.add("price", String.valueOf(price)); params.add("price", String.valueOf(price));
params.add("priceTotal", String.valueOf(orderVo.getPriceActual()));
BigDecimal totalPrice = BigDecimal.ZERO;
String[] orderIds = redisUtils.getMasterCode( orderVo.getOrderId());
for (String orderId:orderIds){
GoblinStoreOrderVo vo = redisUtils.getGoblinOrder(orderId);
totalPrice = totalPrice.add(vo.getPriceActual());
}
params.add("priceTotal", String.valueOf(totalPrice));
params.add("reason", "按需退款"); params.add("reason", "按需退款");
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8"); headers.add("Accept", "application/json;charset=UTF-8");
......
...@@ -103,19 +103,17 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -103,19 +103,17 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
String orderId = IDGenerator.nextSnowId(); String orderId = IDGenerator.nextSnowId();
String orderCode = IDGenerator.storeCode(orderId); String orderCode = IDGenerator.storeCode(orderId);
for (GoblinOrderSkuParam skuParam : storeParam.getGoblinOrderSkuParamArrayList()) {//商品维度循环 for (GoblinOrderSkuParam skuParam : storeParam.getGoblinOrderSkuParamArrayList()) {//商品维度循环
Long time3 = System.currentTimeMillis();
String skuId = skuParam.getSkuId(); String skuId = skuParam.getSkuId();
int number = skuParam.getNumber(); int number = skuParam.getNumber();
Long time3 = System.currentTimeMillis();
GoblinGoodsSkuInfoVo skuVo = redisUtils.getGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo skuVo = redisUtils.getGoodsSkuInfoVo(skuId);
if (!(skuVo.getStatus().equals("3") && skuVo.getShelvesStatus().equals("3")) || skuVo.getDelFlg().equals("1")) { if (!(skuVo.getStatus().equals("3") && skuVo.getShelvesStatus().equals("3")) || skuVo.getDelFlg().equals("1")) {
throw new Exception("不可购买"); throw new Exception("不可购买");
} }
log.info("获取skuVo "+(time3-System.currentTimeMillis())+"ms");
// 判断库存 // 判断库存
String pre = GoblinStatusConst.MarketPreStatus.getPre(skuId); String pre = GoblinStatusConst.MarketPreStatus.getPre(skuId);
int limitCount = skuVo.getBuyLimit() == 0 ? Integer.MAX_VALUE : skuVo.getBuyLimit(); int limitCount = skuVo.getBuyLimit() == 0 ? Integer.MAX_VALUE : skuVo.getBuyLimit();
//判断限购 //判断限购
time3 = System.currentTimeMillis();
if (noZhengzaiOrder(uid)) { if (noZhengzaiOrder(uid)) {
String res1 = orderUtils.judgeOrderLimit(uid, skuId, number, limitCount); String res1 = orderUtils.judgeOrderLimit(uid, skuId, number, limitCount);
if (!res1.equals("")) { if (!res1.equals("")) {
...@@ -127,11 +125,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -127,11 +125,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
throw new Exception("无权购买"); throw new Exception("无权购买");
} }
} }
log.info("判断限购 "+(time3-System.currentTimeMillis())+"ms");
time3 = System.currentTimeMillis();
int surplusGeneral = redisUtils.decrSkuStock(pre, skuId, number); int surplusGeneral = redisUtils.decrSkuStock(pre, skuId, number);
log.info("获取剩余库存 "+(time3-System.currentTimeMillis())+"ms");
skuAndPreListAndNumber.add(skuId + "," + pre + "," + number); skuAndPreListAndNumber.add(skuId + "," + pre + "," + number);
log.info("判断逻辑 "+(System.currentTimeMillis()-time3)+"ms");
//库存回滚 //库存回滚
if (surplusGeneral < 0) { if (surplusGeneral < 0) {
throw new Exception("库存不足"); throw new Exception("库存不足");
...@@ -155,7 +151,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -155,7 +151,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
} }
return payOrder(preParam, orderSqlParams, uid); return payOrder(preParam, orderSqlParams, uid);
} catch (Exception e) { } catch (Exception e) {
log.error("Kylin Order Pay Error = {}", e); // log.error("Kylin Order Pay Error = {}", e);
Long time3 = System.currentTimeMillis();
//回顾限购 回滚库存 //回顾限购 回滚库存
for (String item : skuAndPreListAndNumber) { for (String item : skuAndPreListAndNumber) {
String[] array = item.split(","); String[] array = item.split(",");
...@@ -183,7 +180,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -183,7 +180,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (params.size() > 0) { if (params.size() > 0) {
orderUtils.backStoreCoupon(params); orderUtils.backStoreCoupon(params);
} }
log.info("回滚逻辑 "+(System.currentTimeMillis()-time3)+"ms");
if (e.getMessage() == null) { if (e.getMessage() == null) {
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常 return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
} else if (e.getMessage().equals("无权购买")) { } else if (e.getMessage().equals("无权购买")) {
......
...@@ -427,7 +427,13 @@ public class GoblinOrderUtils { ...@@ -427,7 +427,13 @@ public class GoblinOrderUtils {
params.add("paymentId", orderVo.getPaymentId()); params.add("paymentId", orderVo.getPaymentId());
params.add("paymentType", orderVo.getPaymentType()); params.add("paymentType", orderVo.getPaymentType());
params.add("price", String.valueOf(price)); params.add("price", String.valueOf(price));
params.add("priceTotal", String.valueOf(orderVo.getPriceActual())); BigDecimal totalPrice = BigDecimal.ZERO;
String[] orderIds = redisUtils.getMasterCode( orderVo.getOrderId());
for (String orderId:orderIds){
GoblinStoreOrderVo vo = redisUtils.getGoblinOrder(orderId);
totalPrice = totalPrice.add(vo.getPriceActual());
}
params.add("priceTotal", String.valueOf(totalPrice));
params.add("reason", "超时支付"); params.add("reason", "超时支付");
MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> headers = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Accept", "application/json;charset=UTF-8"); headers.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