fix: 商品列表返回会员价修改
This commit is contained in:
@@ -21,6 +21,7 @@ import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
|||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper;
|
import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper;
|
import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.mapper.MpShopInfoMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpShopTableMapper;
|
import com.chaozhanggui.system.cashierservice.mapper.MpShopTableMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
@@ -108,6 +109,8 @@ public class ProductService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
private final TbFreeDineConfigService freeDineConfigService;
|
private final TbFreeDineConfigService freeDineConfigService;
|
||||||
|
@Autowired
|
||||||
|
private MpShopInfoMapper mpShopInfoMapper;
|
||||||
|
|
||||||
public ProductService(ShopUtils shopUtils, TbFreeDineConfigService freeDineConfigService) {
|
public ProductService(ShopUtils shopUtils, TbFreeDineConfigService freeDineConfigService) {
|
||||||
this.shopUtils = shopUtils;
|
this.shopUtils = shopUtils;
|
||||||
@@ -224,6 +227,7 @@ public class ProductService {
|
|||||||
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
||||||
concurrentMap.put("hots", handleDate(tbProducts,true,1,false));
|
concurrentMap.put("hots", handleDate(tbProducts,true,1,false));
|
||||||
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
||||||
|
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
||||||
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
||||||
//热销
|
//热销
|
||||||
TbProductGroup hot = new TbProductGroup();
|
TbProductGroup hot = new TbProductGroup();
|
||||||
@@ -236,7 +240,7 @@ public class ProductService {
|
|||||||
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
|
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
|
||||||
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
||||||
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
||||||
g.setProducts(handleDate(products,false,g.getIsSale(),false));
|
g.setProducts(handleDate(products,false,g.getIsSale(),false, shopInfo));
|
||||||
} else {
|
} else {
|
||||||
g.setProducts(new ArrayList<>());
|
g.setProducts(new ArrayList<>());
|
||||||
}
|
}
|
||||||
@@ -450,7 +454,8 @@ public class ProductService {
|
|||||||
* @param check 是否校验可售
|
* @param check 是否校验可售
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale,boolean isVip){
|
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale,boolean isVip, TbShopInfo shopInfo){
|
||||||
|
boolean isMemberPrice = shopInfo.getIsMemberPrice() != null && shopInfo.getIsMemberPrice() == 1;
|
||||||
if (!CollectionUtils.isEmpty(products)) {
|
if (!CollectionUtils.isEmpty(products)) {
|
||||||
products.parallelStream().forEach(it -> {
|
products.parallelStream().forEach(it -> {
|
||||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
||||||
@@ -504,7 +509,7 @@ public class ProductService {
|
|||||||
it.setLowPrice(lowerPrice);
|
it.setLowPrice(lowerPrice);
|
||||||
|
|
||||||
// 会员价
|
// 会员价
|
||||||
if (lowMemberPrice == null) {
|
if (lowMemberPrice == null || !isMemberPrice) {
|
||||||
lowMemberPrice = BigDecimal.ZERO;
|
lowMemberPrice = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
it.setLowMemberPrice(lowMemberPrice);
|
it.setLowMemberPrice(lowMemberPrice);
|
||||||
|
|||||||
Reference in New Issue
Block a user