Authored by Lixiaodi

修改

... ... @@ -2,6 +2,7 @@ package com.yohoufo.dal.product;
import com.yohoufo.dal.product.model.StoragePrice;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
... ... @@ -72,5 +73,7 @@ public interface StoragePriceMapper {
List<StoragePrice> selectLeastPricesByProductId(@Param("productId") Integer productId);
BigDecimal selectInStockLeastPriceByProductId(@Param("productId") Integer productId);
int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status);
}
\ No newline at end of file
... ...
... ... @@ -107,6 +107,12 @@
order by storage_id,price asc limit 1000000
) a group by storage_id, pre_sale_flag
</select>
<select id="selectInStockLeastPriceByProductId" resultType="java.math.BigDecimal">
select min(price) as price
from storage_price
where status = 1 and product_id = #{productId} and is_hide = 0 and pre_sale_flag=0
</select>
<select id="selectBySkupList" resultMap="BaseResultMap">
select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status,
... ...
... ... @@ -426,11 +426,11 @@ public class ProductServiceImpl implements ProductService {
if (storagePriceMapper.updateStatus(skup, status, 0) == 0) {
throw new ServiceException(400, "商品(skup)状态已变更");
}
if (status == 10) {
/*if (status == 10) {
if (secondhandInfoMapper.updateStatus(skup, 10) == 0) {
throw new ServiceException(400, "商品(skup)改成待审核失败,状态已变更");
}
}
}*/
} else {
// 4:支付保证金后取消售卖
if (isSecondHand) {
... ... @@ -1343,6 +1343,7 @@ public class ProductServiceImpl implements ProductService {
return null;
}
SecondHandProductResp resp = new SecondHandProductResp();
resp.setStatus(sp.getStatus());
Integer storageId = sp.getStorageId();
Integer productId = sp.getProductId();
Storage storage = storageMapper.selectByPrimaryKey(storageId);
... ... @@ -1357,7 +1358,17 @@ public class ProductServiceImpl implements ProductService {
resp.setImage(getGoodsDeafultImage(goods.getId()));
resp.setImageList(secondhandImagesList.stream().map(image -> com.yohoufo.common.helper.ImagesHelper.getImageAbsoluteUrl(image.getImageUrl(), "goodsimg")).collect(Collectors.toList()));
resp.setGender(getGenderName(product.getGender()));
// 价格
resp.setPrice(sp.getPrice().toString());
BigDecimal inStockLeastPrice = storagePriceMapper.selectInStockLeastPriceByProductId(productId);
if (inStockLeastPrice != null) {
resp.setNewProductPrice(inStockLeastPrice.toString());
if (inStockLeastPrice.compareTo(sp.getPrice()) > 0) {
resp.setSavePrice(inStockLeastPrice.subtract(sp.getPrice()).toString());
}
}
resp.setSizeName(size.getSizeName() + "码");
resp.setProductName(product.getProductName());
resp.setProductCode(product.getProductCode());
... ...