Commit ddc58801 by weijiguang

修复checkSku特惠价格不生效问题

parent 1f802778
package com.soss.system.mapper; package com.soss.system.mapper;
import java.util.List;
import com.soss.system.domain.Goods; import com.soss.system.domain.Goods;
import com.soss.system.domain.ShopRecommend; import com.soss.system.domain.ShopRecommend;
import com.soss.system.domain.vo.orderTaking.GoodsVo; import com.soss.system.domain.vo.orderTaking.GoodsVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 推荐和今日特惠Mapper接口 * 推荐和今日特惠Mapper接口
...@@ -24,6 +23,11 @@ public interface ShopRecommendMapper ...@@ -24,6 +23,11 @@ public interface ShopRecommendMapper
public ShopRecommend selectShopRecommendById(String id); public ShopRecommend selectShopRecommendById(String id);
/** /**
* 根据商品id查询特惠
*/
public ShopRecommend selectShopRecommendByGoodsId(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId);
/**
* 查询推荐和今日特惠列表 * 查询推荐和今日特惠列表
* *
* @param shopRecommend 推荐和今日特惠 * @param shopRecommend 推荐和今日特惠
......
...@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service; ...@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -505,7 +505,13 @@ public class ShopServiceImpl implements IShopService { ...@@ -505,7 +505,13 @@ public class ShopServiceImpl implements IShopService {
goodsVo.setGoodsId(String.valueOf(good.getId())); goodsVo.setGoodsId(String.valueOf(good.getId()));
goodsVo.setName(good.getName()); goodsVo.setName(good.getName());
goodsVo.setDesc(good.getDesc()); goodsVo.setDesc(good.getDesc());
goodsVo.setDiscount(good.getDiscount().stripTrailingZeros().toPlainString());
ShopRecommend shopRecommend = shopRecommendMapper.selectShopRecommendByGoodsId(shopId, good.getId());
if (shopRecommend != null && shopRecommend.getRecommendPrice() != null && shopRecommend.getRecommendPrice().compareTo(BigDecimal.ZERO) > 0) {
goodsVo.setDiscount(shopRecommend.getRecommendPrice().stripTrailingZeros().toPlainString());
} else {
goodsVo.setDiscount(good.getDiscount().stripTrailingZeros().toPlainString());
}
goodsVo.setPrice(good.getPrice().stripTrailingZeros().toPlainString()); goodsVo.setPrice(good.getPrice().stripTrailingZeros().toPlainString());
goodsVo.setPics(JSONObject.parseObject(good.getPics())); goodsVo.setPics(JSONObject.parseObject(good.getPics()));
goodsVo.setRemarks(good.getRemarks()); goodsVo.setRemarks(good.getRemarks());
......
...@@ -45,6 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -45,6 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
order by turn order by turn
</select> </select>
<select id="selectShopRecommendByGoodsId" resultMap="ShopRecommendResult">
<include refid="selectShopRecommendVo"/>
where `type` = 2 and shop_id = #{shopId} and goods_id = #{goodsId}
</select>
<select id="selectShopRecommendById" parameterType="String" resultMap="ShopRecommendResult"> <select id="selectShopRecommendById" parameterType="String" resultMap="ShopRecommendResult">
<include refid="selectShopRecommendVo"/> <include refid="selectShopRecommendVo"/>
......
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