|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
|
...
|
...
|
@@ -151,7 +152,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
int num = pcn.getNum();
|
|
|
BigDecimal salePrice = pcn.getPrdPrice();
|
|
|
String tips = null;
|
|
|
ProductProxyService.PrdPrice prdPrice = sellerOrderPrepareProcessor.checkPrice(storageId, salePrice);
|
|
|
ProductProxyService.PrdPrice prdPrice = sellerOrderPrepareProcessor.checkPrice(storageId, salePrice, true);
|
|
|
try {
|
|
|
sellerOrderPrepareProcessor.checkSuggestPrice(prdPrice, salePrice);
|
|
|
}catch (UfoServiceException ex){
|
...
|
...
|
@@ -166,11 +167,14 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
public SoldPrdComputeBo computeChangePrice(BatchChangePriceReq req) throws GatewayException {
|
|
|
log.info("in computeChangePrice, req {}", req);
|
|
|
ChangePricePrepareDTO pcn = changePricePrepareProcessor.checkAndAcquire(req);
|
|
|
/*
|
|
|
if (pcn.getTips() != null){
|
|
|
throw new UfoServiceException(SellerOrderPrepareProcessor.TIPS_ERROR_CODE, pcn.getTips() );
|
|
|
}
|
|
|
*/
|
|
|
SellerOrderComputeResult computeResult = pcn.getComputeResult();
|
|
|
SoldPrdComputeBo spc = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
|
|
|
spc.setTips(pcn.getTips());
|
|
|
return spc;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -578,7 +582,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
int failCnt = 0;
|
|
|
if(Objects.nonNull(sellerWallet)) {
|
|
|
//1.1 划账成功后
|
|
|
//TODO 2 商品变价(同步价格到商品)
|
|
|
//2 商品变价(同步价格到商品)
|
|
|
|
|
|
Set<Integer> skupSet = skupMap.keySet();
|
|
|
productProxyService.batchUpdatePrice(skupSet, salePrice);
|
...
|
...
|
@@ -601,12 +605,10 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
so-> OrderInfo.builder().orderCode(so.getOrderCode()).amount(diffEarnestMoney).build())
|
|
|
.collect(Collectors.toList());
|
|
|
merchantOrderPaymentService.changePriceAddWalletDetail(sellerWallet, orderList );
|
|
|
|
|
|
successCnt = skupMap.size();
|
|
|
SkupDto skupDto = skupMap.values().iterator().next();
|
|
|
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(req.getUid(), TabType.SELL.getValue()),
|
|
|
CacheKeyBuilder.sellerOrderDetailKey(skupDto.getSellerOrderGoods())
|
|
|
));
|
|
|
List<RedisKeyBuilder> skupDetailRKBs = getSkupDetailRKBs(skupMap);
|
|
|
skupDetailRKBs.add(CacheKeyBuilder.orderListKey(req.getUid(), TabType.SELL.getValue()));
|
|
|
cacheCleaner.delete(skupDetailRKBs);
|
|
|
}else {
|
|
|
//1.2 划账失败后
|
|
|
failCnt = skupMap.size();
|
...
|
...
|
@@ -620,6 +622,20 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi |
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
private List<RedisKeyBuilder> getSkupDetailRKBs(Map<Integer, SkupDto> skupMap){
|
|
|
Set<String> keys = new HashSet<>(skupMap.size());
|
|
|
List<RedisKeyBuilder> skupDetailRKBs = new ArrayList<>(skupMap.size());
|
|
|
for(Map.Entry<Integer, SkupDto> entry : skupMap.entrySet()){
|
|
|
SellerOrderGoods sog = entry.getValue().getSellerOrderGoods();
|
|
|
String key = new StringBuilder().append(sog.getBatchNo()).append(sog.getGoodsPrice())
|
|
|
.append(sog.getStatus()).toString();
|
|
|
if (keys.contains(key)){
|
|
|
continue;
|
|
|
}
|
|
|
skupDetailRKBs.add(CacheKeyBuilder.sellerOrderDetailKey(sog));
|
|
|
}
|
|
|
return skupDetailRKBs;
|
|
|
}
|
|
|
|
|
|
|
|
|
private static final int MAX_DEAL = 10;
|
...
|
...
|
|