Authored by qinchao

Merge branch 'test6.8.2' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.2

@@ -216,7 +216,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi @@ -216,7 +216,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
216 //发布支付超时取消消息 216 //发布支付超时取消消息
217 pushAutoCancelEvent(context); 217 pushAutoCancelEvent(context);
218 218
219 -  
220 // 发消息 219 // 发消息
221 GoodsInfo goodsInfo = context.getSoldProduct(); 220 GoodsInfo goodsInfo = context.getSoldProduct();
222 OrderSubmitResp resp = OrderSubmitResp.builder().orderCode(orderCode).productId(goodsInfo.getProductId()).build(); 221 OrderSubmitResp resp = OrderSubmitResp.builder().orderCode(orderCode).productId(goodsInfo.getProductId()).build();
@@ -235,13 +234,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi @@ -235,13 +234,11 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
235 if(isEntryShop){ 234 if(isEntryShop){
236 log.info("in publishPrd use batchPublishPrds, req {}", req); 235 log.info("in publishPrd use batchPublishPrds, req {}", req);
237 resp = batchPublishPrds(context, req); 236 resp = batchPublishPrds(context, req);
238 -  
239 }else{ 237 }else{
240 log.info("in publishPrd use publishSinglePrd, req {}", req); 238 log.info("in publishPrd use publishSinglePrd, req {}", req);
241 resp = publishSinglePrd(req, context); 239 resp = publishSinglePrd(req, context);
242 cacheCleaner.cleanList(req.getUid(), TabType.SELL.getValue()); 240 cacheCleaner.cleanList(req.getUid(), TabType.SELL.getValue());
243 } 241 }
244 -  
245 return resp; 242 return resp;
246 } 243 }
247 244
@@ -263,8 +260,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi @@ -263,8 +260,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
263 int uid = req.getUid(); 260 int uid = req.getUid();
264 SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult(); 261 SellerOrderComputeResult socr = ctx.getSellerOrderComputeResult();
265 BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney(); 262 BigDecimal singleEarestMoney = socr.getEarnestMoney().getEarnestMoney();
266 - BigDecimal mEarestMoney = BigDecimalHelper.halfUp(new BigDecimal(num).multiply(singleEarestMoney));  
267 - 263 + BigDecimal mEarestMoney = sellerOrderPrepareProcessor.checkNGetMergeEarnestMoney(uid, singleEarestMoney, num, ctx.getSalePrice());
268 SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH; 264 SellerWalletDetail.Type swdType = SellerWalletDetail.Type.PUBLISH;
269 MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid) 265 MerchantOrderAttachInfo moai = MerchantOrderAttachInfo.builder().uid(uid)
270 .storageId(ctx.getStorageId()).earnestMoney(mEarestMoney) 266 .storageId(ctx.getStorageId()).earnestMoney(mEarestMoney)
@@ -361,4 +361,18 @@ public class ProductController { @@ -361,4 +361,18 @@ public class ProductController {
361 return new ApiResponse(code, e.getMessage(), Boolean.FALSE); 361 return new ApiResponse(code, e.getMessage(), Boolean.FALSE);
362 } 362 }
363 } 363 }
  364 +
  365 +
  366 + @ApiOperation(name = "ufo.product.storageInfo", desc="再次出售商品,卖家出售的价格区间 供app调用")
  367 + @RequestMapping(params = "method=ufo.product.storageInfo")
  368 + @Cachable(expire = 180)
  369 + public ApiResponse queryStorageBaseInfoEx(@RequestParam(value = "storage_id") Integer storageId) {
  370 + if (storageId == null) {
  371 + LOG.info("in method=ufo.product.storageInfo storageId Is Null");
  372 + return null;
  373 + }
  374 + LOG.info("in method=ufo.product.storageInfo storageId = {}", storageId);
  375 + StorageLeastPriceResp resp = productService.querStorageLeastPriceEx(storageId);
  376 + return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("storage data").build();
  377 + }
364 } 378 }
@@ -21,4 +21,7 @@ public class StorageLeastPriceResp { @@ -21,4 +21,7 @@ public class StorageLeastPriceResp {
21 21
22 @JSONField(name="suggest_high_price") 22 @JSONField(name="suggest_high_price")
23 private BigDecimal suggestHighPrice; 23 private BigDecimal suggestHighPrice;
  24 +
  25 + @JSONField(name="product_max_price")
  26 + private BigDecimal productMaxPrice = new BigDecimal(100000); //默认商品的最高售价
24 } 27 }
@@ -58,4 +58,11 @@ public interface ProductService { @@ -58,4 +58,11 @@ public interface ProductService {
58 * @return 58 * @return
59 */ 59 */
60 int sellerBatchUpdatePrice(List<Integer> skupList, Double price); 60 int sellerBatchUpdatePrice(List<Integer> skupList, Double price);
  61 +
  62 + /**
  63 + * 根据storageId查询建议价格,商品最高售价,skup出售价格
  64 + * @param storageId
  65 + * @return
  66 + */
  67 + StorageLeastPriceResp querStorageLeastPriceEx(Integer storageId);
61 } 68 }
@@ -124,21 +124,36 @@ public class ProductServiceImpl implements ProductService{ @@ -124,21 +124,36 @@ public class ProductServiceImpl implements ProductService{
124 124
125 @Override 125 @Override
126 public StorageLeastPriceResp queryStorageLeastPrice(Integer storageId) { 126 public StorageLeastPriceResp queryStorageLeastPrice(Integer storageId) {
  127 + StoragePrice storagePrice = storagePriceMapper.selectLeastPrice(storageId);
  128 + if (storagePrice == null) {
  129 + return null;
  130 + }
  131 + StorageLeastPriceResp resp = new StorageLeastPriceResp();
  132 + resp.setStorageId(storageId);
  133 + resp.setLeastPrice(storagePrice.getPrice());
  134 + resp.setSkup(storagePrice.getSkup());
  135 + return resp;
  136 + }
  137 +
  138 +
  139 + public StorageLeastPriceResp querStorageLeastPriceEx(Integer storageId) {
127 Storage storage = storageMapper.selectByPrimaryKey(storageId); 140 Storage storage = storageMapper.selectByPrimaryKey(storageId);
128 if (null == storage) { 141 if (null == storage) {
129 LOGGER.warn("storageMapper.selectByPrimaryKey is null, storageId is {}", storageId); 142 LOGGER.warn("storageMapper.selectByPrimaryKey is null, storageId is {}", storageId);
130 - return null; 143 + return new StorageLeastPriceResp();
131 } 144 }
132 StoragePrice storagePrice = storagePriceMapper.selectLeastPrice(storageId); 145 StoragePrice storagePrice = storagePriceMapper.selectLeastPrice(storageId);
133 StorageLeastPriceResp resp = new StorageLeastPriceResp(); 146 StorageLeastPriceResp resp = new StorageLeastPriceResp();
134 - if (storagePrice == null) {  
135 - resp.setSuggestHighPrice(storage.getSuggestHighPrice());  
136 - resp.setSuggestLowPrice(storage.getSuggestLowPrice());  
137 - return resp;  
138 - }  
139 resp.setStorageId(storageId); 147 resp.setStorageId(storageId);
140 - resp.setLeastPrice(storagePrice.getPrice());  
141 - resp.setSkup(storagePrice.getSkup()); 148 + resp.setSuggestLowPrice(storage.getSuggestLowPrice());
  149 + resp.setSuggestHighPrice(storage.getSuggestHighPrice());
  150 +
  151 + // 如果最低价高于建议售价,则相当于没有此库存
  152 + if (null != storagePrice && (null == storage.getSuggestHighPrice() || (null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) <= 0))) {
  153 + resp.setLeastPrice(storagePrice.getPrice());
  154 + resp.setSkup(storagePrice.getSkup());
  155 + }
  156 +
142 return resp; 157 return resp;
143 } 158 }
144 159
@@ -583,13 +598,19 @@ public class ProductServiceImpl implements ProductService{ @@ -583,13 +598,19 @@ public class ProductServiceImpl implements ProductService{
583 Map<Integer, StoragePrice> storagePriceMap = getStoragePriceMap(storageList); 598 Map<Integer, StoragePrice> storagePriceMap = getStoragePriceMap(storageList);
584 599
585 for (Storage storage : storageList) { 600 for (Storage storage : storageList) {
  601 + StoragePrice storagePrice = storagePriceMap.get(storage.getId());
  602 + //高于建议价,不展示skup
  603 + if(null != storagePrice && null != storage.getSuggestHighPrice() && storagePrice.getPrice().compareTo(storage.getSuggestHighPrice()) > 0) {
  604 + continue;
  605 + }
  606 +
586 GoodsSize goodsSize = new GoodsSize(); 607 GoodsSize goodsSize = new GoodsSize();
587 goodsSize.setId(storage.getId()); 608 goodsSize.setId(storage.getId());
588 goodsSize.setSizeId(storage.getSizeId()); 609 goodsSize.setSizeId(storage.getSizeId());
589 Size size = sizeMap.get(storage.getSizeId()); 610 Size size = sizeMap.get(storage.getSizeId());
590 goodsSize.setSizeName(size == null ? "" : size.getSizeName()); 611 goodsSize.setSizeName(size == null ? "" : size.getSizeName());
591 goodsSize.setOrderBy(size == null ? 0 : size.getOrderBy()); 612 goodsSize.setOrderBy(size == null ? 0 : size.getOrderBy());
592 - StoragePrice storagePrice = storagePriceMap.get(storage.getId()); 613 +
593 goodsSize.setLeastPrice(storagePrice == null ? null : storagePrice.getPrice()); 614 goodsSize.setLeastPrice(storagePrice == null ? null : storagePrice.getPrice());
594 goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus()); 615 goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
595 goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum()); 616 goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());