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

Commit 316c1abe authored by 胡佳晨's avatar 胡佳晨

提交 xls 队列 修改 平台券

parent 6e326c43
......@@ -60,6 +60,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
@Override
public ResponseDto<GoblinPayInnerResultVo> checkOrder(GoblinOrderParam param, String uid) {
List<String> skuAndPreListAndNumber = CollectionUtil.arrayListString();
List<String> platformCodeList = CollectionUtil.arrayListString();
List<String> storeCodeList = CollectionUtil.arrayListString();
List<GoblinOrderSqlParam> orderSqlParams = ObjectUtil.getGoblinOrderSqlParamArrayListList();
......@@ -134,7 +136,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}//GoblinOrderSkuParam
//下单
GoblinOrderPreParam pre = order(param, storeParam, uid, isMember, addressesVo, orderMasterCode, orderId, orderCode);
GoblinOrderPreParam pre = order(param, storeParam, uid, isMember, addressesVo, orderMasterCode, orderId, orderCode, platformCodeList);
preParam.setPriceActual(preParam.getPriceActual().add(pre.getPriceActual()));
preParam.setStoreName(preParam.getStoreName() + "," + pre.getStoreName());
preParam.setSkuName(preParam.getSkuName() + "," + pre.getSkuName());
......@@ -162,8 +164,13 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (noZhengzaiOrder(uid)) {
redisUtils.decrSkuCountByUid(uid, skuId, number);
}
log.error("回滚库存 skuId:{}",skuId);
log.error("回滚库存 skuId:{}", skuId);
}
//回退平台券
for (String platformCode : platformCodeList) {
orderUtils.backCoupon(platformCode, uid);
}
//回退店铺券
if (e.getMessage() == null) {
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
} else if (e.getMessage().equals("券不可用")) {
......@@ -182,7 +189,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}
private GoblinOrderPreParam order(GoblinOrderParam param, GoblinOrderStoreParam storeParam, String uid, boolean isMember, AdamAddressesVo addressesVo, String orderMasterCode, String orderId, String orderCode) throws Exception {
private GoblinOrderPreParam order(GoblinOrderParam param, GoblinOrderStoreParam storeParam, String uid, boolean isMember, AdamAddressesVo addressesVo, String orderMasterCode, String orderId, String orderCode, List<String> platformCodeList) throws Exception {
String platVoucherCode = storeParam.getPlatVoucherCode();
String storeId = storeParam.getStoreId();
Map token = CurrentUtil.getTokenClaims();
......@@ -256,14 +263,16 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
BigDecimal voucherPrice = BigDecimal.ZERO;
if (platVoucherCode != null && !platVoucherCode.equals("")) {
String spuIds = "";
for (GoblinOrderSkuParam item:storeParam.getGoblinOrderSkuParamArrayList()){
spuIds=spuIds.concat(item.getSpuId());
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
spuIds = spuIds.concat(item.getSpuId());
}
HashMap<String, Object> hashMap = orderUtils.useCoupon(platVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds);
voucherPrice = (BigDecimal) hashMap.get("voucher");
Integer typeVoucher = (Integer) hashMap.get("type");
if (typeVoucher.equals(-1)) {
throw new Exception("券不可用");
} else {
platformCodeList.add(platVoucherCode);
}
}
GoblinStoreInfoVo storeInfoVo = redisUtils.getStoreInfoVo(storeId);
......@@ -440,9 +449,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
redisUtils.addUnPayOrder(orderVo.getOrderId());
//redis 订单列表
if (noZhengzaiOrder(uid)) {
if (orderVo.getMarketType()==null) {
if (orderVo.getMarketType() == null) {
redisUtils.addOrderList(uid, orderVo.getOrderId());
} else if(orderVo.getMarketType().equals(GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue())){
} else if (orderVo.getMarketType().equals(GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue())) {
redisUtils.addZhengzaiOrderList(uid, orderVo.getOrderId());
}
}
......
package com.liquidnet.service.goblin.util;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.CurrentUtil;
......@@ -7,6 +8,7 @@ import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.adam.dto.vo.AdamRscPolymer01Vo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.candy.param.BackCouponParam;
import com.liquidnet.service.candy.vo.CandyUseResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -15,6 +17,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
@Component
......@@ -85,7 +88,7 @@ public class GoblinOrderUtils {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Authorization", "Bearer " + CurrentUtil.getToken());
header.add("Accept", "application/json;charset=UTF-8");
String returnData = HttpUtil.post("http://172.16.3.71:9009/candy" + "/candy-coupon/use", params, header);
String returnData = HttpUtil.post(candyUrl + "/candy-coupon/use", params, header);
ResponseDto<CandyUseResultVo> innerReturnVo = JsonUtils.fromJson(returnData, new TypeReference<ResponseDto<CandyUseResultVo>>() {
});
CandyUseResultVo candyUseResultVo = innerReturnVo.getData();
......@@ -123,6 +126,24 @@ public class GoblinOrderUtils {
}
}
public void backCoupon(String uCouponId, String uid) {
try {
BackCouponParam param = BackCouponParam.getNew();
param.setuCouponIds(uCouponId);
param.setUid(uid);
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Authorization", "Bearer " + CurrentUtil.getToken());
header.add("Accept", "application/json;charset=UTF-8");
ArrayList<BackCouponParam> params = new ArrayList();
params.add(param);
String jsonString = JSON.toJSONString(params);
String returnData = HttpUtil.postRaw(candyUrl + "/candy-coupon/useBack", jsonString, header);
} catch (Exception e) {
log.error("回退券ERROR:{}", e);
}
}
public void doTask(String uid, BigDecimal price) {
try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
......
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