Authored by Lixiaodi

修改

@@ -2,6 +2,7 @@ package com.yohoufo.dal.product; @@ -2,6 +2,7 @@ package com.yohoufo.dal.product;
2 2
3 import com.yohoufo.dal.product.model.StoragePrice; 3 import com.yohoufo.dal.product.model.StoragePrice;
4 4
  5 +import java.math.BigDecimal;
5 import java.util.Collection; 6 import java.util.Collection;
6 import java.util.List; 7 import java.util.List;
7 8
@@ -72,5 +73,7 @@ public interface StoragePriceMapper { @@ -72,5 +73,7 @@ public interface StoragePriceMapper {
72 73
73 List<StoragePrice> selectLeastPricesByProductId(@Param("productId") Integer productId); 74 List<StoragePrice> selectLeastPricesByProductId(@Param("productId") Integer productId);
74 75
  76 + BigDecimal selectInStockLeastPriceByProductId(@Param("productId") Integer productId);
  77 +
75 int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status); 78 int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status);
76 } 79 }
@@ -107,6 +107,12 @@ @@ -107,6 +107,12 @@
107 order by storage_id,price asc limit 1000000 107 order by storage_id,price asc limit 1000000
108 ) a group by storage_id, pre_sale_flag 108 ) a group by storage_id, pre_sale_flag
109 </select> 109 </select>
  110 +
  111 + <select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal">
  112 + select min(price) as price
  113 + from storage_price
  114 + where status = 1 and product_id = #{productId} and is_hide = 0 and pre_sale_flag=0
  115 + </select>
110 116
111 <select id="selectBySkupList" resultMap="BaseResultMap"> 117 <select id="selectBySkupList" resultMap="BaseResultMap">
112 select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status, 118 select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status,
@@ -426,11 +426,11 @@ public class ProductServiceImpl implements ProductService { @@ -426,11 +426,11 @@ public class ProductServiceImpl implements ProductService {
426 if (storagePriceMapper.updateStatus(skup, status, 0) == 0) { 426 if (storagePriceMapper.updateStatus(skup, status, 0) == 0) {
427 throw new ServiceException(400, "商品(skup)状态已变更"); 427 throw new ServiceException(400, "商品(skup)状态已变更");
428 } 428 }
429 - if (status == 10) { 429 + /*if (status == 10) {
430 if (secondhandInfoMapper.updateStatus(skup, 10) == 0) { 430 if (secondhandInfoMapper.updateStatus(skup, 10) == 0) {
431 throw new ServiceException(400, "商品(skup)改成待审核失败,状态已变更"); 431 throw new ServiceException(400, "商品(skup)改成待审核失败,状态已变更");
432 } 432 }
433 - } 433 + }*/
434 } else { 434 } else {
435 // 4:支付保证金后取消售卖 435 // 4:支付保证金后取消售卖
436 if (isSecondHand) { 436 if (isSecondHand) {
@@ -1343,6 +1343,7 @@ public class ProductServiceImpl implements ProductService { @@ -1343,6 +1343,7 @@ public class ProductServiceImpl implements ProductService {
1343 return null; 1343 return null;
1344 } 1344 }
1345 SecondHandProductResp resp = new SecondHandProductResp(); 1345 SecondHandProductResp resp = new SecondHandProductResp();
  1346 + resp.setStatus(sp.getStatus());
1346 Integer storageId = sp.getStorageId(); 1347 Integer storageId = sp.getStorageId();
1347 Integer productId = sp.getProductId(); 1348 Integer productId = sp.getProductId();
1348 Storage storage = storageMapper.selectByPrimaryKey(storageId); 1349 Storage storage = storageMapper.selectByPrimaryKey(storageId);
@@ -1357,7 +1358,17 @@ public class ProductServiceImpl implements ProductService { @@ -1357,7 +1358,17 @@ public class ProductServiceImpl implements ProductService {
1357 resp.setImage(getGoodsDeafultImage(goods.getId())); 1358 resp.setImage(getGoodsDeafultImage(goods.getId()));
1358 resp.setImageList(secondhandImagesList.stream().map(image -> com.yohoufo.common.helper.ImagesHelper.getImageAbsoluteUrl(image.getImageUrl(), "goodsimg")).collect(Collectors.toList())); 1359 resp.setImageList(secondhandImagesList.stream().map(image -> com.yohoufo.common.helper.ImagesHelper.getImageAbsoluteUrl(image.getImageUrl(), "goodsimg")).collect(Collectors.toList()));
1359 resp.setGender(getGenderName(product.getGender())); 1360 resp.setGender(getGenderName(product.getGender()));
  1361 +
  1362 + // 价格
1360 resp.setPrice(sp.getPrice().toString()); 1363 resp.setPrice(sp.getPrice().toString());
  1364 + BigDecimal inStockLeastPrice = storagePriceMapper.selectInStockLeastPriceByProductId(productId);
  1365 + if (inStockLeastPrice != null) {
  1366 + resp.setNewProductPrice(inStockLeastPrice.toString());
  1367 + if (inStockLeastPrice.compareTo(sp.getPrice()) > 0) {
  1368 + resp.setSavePrice(inStockLeastPrice.subtract(sp.getPrice()).toString());
  1369 + }
  1370 + }
  1371 +
1361 resp.setSizeName(size.getSizeName() + "码"); 1372 resp.setSizeName(size.getSizeName() + "码");
1362 resp.setProductName(product.getProductName()); 1373 resp.setProductName(product.getProductName());
1363 resp.setProductCode(product.getProductCode()); 1374 resp.setProductCode(product.getProductCode());