|
|
@ -24,6 +24,7 @@ import org.jeecgframework.codegenerate.a.a; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Service |
|
|
@ -150,14 +151,15 @@ public class GoodsServiceImpl implements IGoodsService { |
|
|
|
public Result<?> deleteShoppingCart(DeleteShoppingCartReq deleteShoppingCartReq) { |
|
|
|
|
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(deleteShoppingCartReq.getToken()); |
|
|
|
HotelShoppingCat hotelShoppingCat = hotelShoppingCatService.lambdaQuery() |
|
|
|
.eq(HotelShoppingCat::getId, deleteShoppingCartReq.getId()) |
|
|
|
.eq(HotelShoppingCat::getUserId, hanHaiMember.getId()) |
|
|
|
.one(); |
|
|
|
if(hotelShoppingCat == null){ |
|
|
|
throw new JeecgBootException("购物车数据错误,请刷新重试"); |
|
|
|
} |
|
|
|
hotelShoppingCatService.removeById(hotelShoppingCat.getId()); |
|
|
|
// HotelShoppingCat hotelShoppingCat = hotelShoppingCatService.lambdaQuery() |
|
|
|
// .eq(HotelShoppingCat::getId, deleteShoppingCartReq.getId()) |
|
|
|
// .eq(HotelShoppingCat::getUserId, hanHaiMember.getId()) |
|
|
|
// .one(); |
|
|
|
// if(hotelShoppingCat == null){ |
|
|
|
// throw new JeecgBootException("购物车数据错误,请刷新重试"); |
|
|
|
// } |
|
|
|
|
|
|
|
hotelShoppingCatService.removeBatchByIds(Arrays.asList(deleteShoppingCartReq.getId().split(","))); |
|
|
|
|
|
|
|
return Result.OK(); |
|
|
|
} |
|
|
@ -203,4 +205,37 @@ public class GoodsServiceImpl implements IGoodsService { |
|
|
|
redisUtil.set("addOrDeleteNumReq:"+addOrDeleteNumReq.getToken(),1,1); |
|
|
|
return Result.OK(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取商品多规格 |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Result<?> getGoodsSku(String id) { |
|
|
|
List<HotelGoodsSku> hotelGoodsSkuList = hotelGoodsSkuService.lambdaQuery() |
|
|
|
.eq(HotelGoodsSku::getGoodsId, id) |
|
|
|
.eq(HotelGoodsSku::getDelFlag, 0) |
|
|
|
.list(); |
|
|
|
return Result.OK(hotelGoodsSkuList); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<?> editShoppingCatByGoodsId(EditShoppingCatByGoodsIdReq editShoppingCatByGoodsIdReq) { |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(editShoppingCatByGoodsIdReq.getToken()); |
|
|
|
HotelShoppingCat hotelShoppingCat = hotelShoppingCatService.lambdaQuery() |
|
|
|
.eq(HotelShoppingCat::getDelFlag, 0) |
|
|
|
.eq(HotelShoppingCat::getGoodsId, editShoppingCatByGoodsIdReq.getGoodsId()) |
|
|
|
.eq(HotelShoppingCat::getUserId, hanHaiMember.getId()) |
|
|
|
.eq(HotelShoppingCat::getId, editShoppingCatByGoodsIdReq.getId()) |
|
|
|
.one(); |
|
|
|
if(hotelShoppingCat == null){ |
|
|
|
throw new JeecgBootException("数据错误,请稍后重试"); |
|
|
|
} |
|
|
|
HotelShoppingCat hotelShoppingCat1 = new HotelShoppingCat(); |
|
|
|
hotelShoppingCat1.setId(hotelShoppingCat.getId()); |
|
|
|
hotelShoppingCat1.setSkuId(editShoppingCatByGoodsIdReq.getSkuId()); |
|
|
|
hotelShoppingCatService.updateById(hotelShoppingCat1); |
|
|
|
return Result.OK(); |
|
|
|
} |
|
|
|
} |