购物车修改
This commit is contained in:
parent
4a6b44d2cb
commit
97167a7bd9
|
|
@ -74,10 +74,10 @@ public class AllocCanteenApi {
|
||||||
// return (AllocArea)this.allocAreaService.getOne((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(AllocArea.class).eq(AllocArea::getAreaNum, "99")).last(" limit 1 "));
|
// return (AllocArea)this.allocAreaService.getOne((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(AllocArea.class).eq(AllocArea::getAreaNum, "99")).last(" limit 1 "));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// public AllocCanteen getAllocCanteen(Long canteenId) {
|
public AllocCanteen getAllocCanteen(Long canteenId) {
|
||||||
// return this.allocCanteenService.getAllocCanteenCache(canteenId);
|
return this.allocCanteenService.getAllocCanteenCache(canteenId);
|
||||||
// }
|
}
|
||||||
//
|
//
|
||||||
// public void checkCanteenBusinessState(Long canteenId, LocalTime checkTime) {
|
// public void checkCanteenBusinessState(Long canteenId, LocalTime checkTime) {
|
||||||
// if (!LeNumUtil.isValidId(canteenId)) {
|
// if (!LeNumUtil.isValidId(canteenId)) {
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,6 @@ public interface AllocCanteenService extends IService<AllocCanteen> {
|
||||||
List<AllocCanteenStallVO> listAllCanteenStall();
|
List<AllocCanteenStallVO> listAllCanteenStall();
|
||||||
|
|
||||||
void checkAndDelReserveCanteen(List<AppletReserveCanteenVO> reserveCanteenList);
|
void checkAndDelReserveCanteen(List<AppletReserveCanteenVO> reserveCanteenList);
|
||||||
|
|
||||||
|
AllocCanteen getAllocCanteenCache(Long canteenId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.bonus.core.allocation.canteen.service.impl;
|
package com.bonus.core.allocation.canteen.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
|
@ -15,6 +18,8 @@ import com.bonus.core.allocation.canteen.service.AllocAreaService;
|
||||||
import com.bonus.core.allocation.canteen.service.AllocCanteenService;
|
import com.bonus.core.allocation.canteen.service.AllocCanteenService;
|
||||||
import com.bonus.core.allocation.canteen.vo.AllocCanteenStallVO;
|
import com.bonus.core.allocation.canteen.vo.AllocCanteenStallVO;
|
||||||
import com.bonus.core.common.enums.AllocCanteenTypeEnum;
|
import com.bonus.core.common.enums.AllocCanteenTypeEnum;
|
||||||
|
import com.bonus.core.common.redis.RedisUtil;
|
||||||
|
import com.bonus.core.common.utils.TenantContextHolder;
|
||||||
import com.bonus.core.menu.vo.AppletReserveCanteenVO;
|
import com.bonus.core.menu.vo.AppletReserveCanteenVO;
|
||||||
import com.bonus.core.menu.vo.AppletReserveStallVO;
|
import com.bonus.core.menu.vo.AppletReserveStallVO;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -133,4 +138,26 @@ public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, All
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AllocCanteen getAllocCanteenCache(Long canteenId) {
|
||||||
|
if (ObjectUtil.isNull(canteenId)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
String cacheKey = this.getCacheKey(canteenId);
|
||||||
|
String allocCanteenStr = RedisUtil.getString(cacheKey);
|
||||||
|
if (CharSequenceUtil.isNotBlank(allocCanteenStr)) {
|
||||||
|
return (AllocCanteen) JSONUtil.toBean(allocCanteenStr, AllocCanteen.class);
|
||||||
|
} else {
|
||||||
|
AllocCanteen allocCanteen = (AllocCanteen)this.getOne((Wrapper)Wrappers.lambdaQuery(AllocCanteen.class).eq(AllocCanteen::getCanteenId, canteenId));
|
||||||
|
allocCanteenStr = JSONUtil.toJsonStr(allocCanteen);
|
||||||
|
RedisUtil.setString(cacheKey, allocCanteenStr, 3600L);
|
||||||
|
return allocCanteen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCacheKey(Long canteenId) {
|
||||||
|
Long var10000 = TenantContextHolder.getTenantId();
|
||||||
|
return "yst:" + var10000 + ":alloc-canteen:" + canteenId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,23 @@ package com.bonus.core.order.mobile.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
import com.bonus.core.allocation.api.AllocCanteenApi;
|
||||||
|
import com.bonus.core.allocation.api.AllocStallApi;
|
||||||
import com.bonus.core.allocation.canteen.model.AllocCanteen;
|
import com.bonus.core.allocation.canteen.model.AllocCanteen;
|
||||||
import com.bonus.core.allocation.canteen.model.AllocStall;
|
import com.bonus.core.allocation.canteen.model.AllocStall;
|
||||||
import com.bonus.core.common.enums.AllocMealtimeTypeEnum;
|
import com.bonus.core.common.enums.AllocMealtimeTypeEnum;
|
||||||
|
import com.bonus.core.common.redis.RedisUtil;
|
||||||
import com.bonus.core.common.utils.JavaxValidateUtils;
|
import com.bonus.core.common.utils.JavaxValidateUtils;
|
||||||
import com.bonus.core.common.utils.LogUtil;
|
import com.bonus.core.common.utils.LogUtil;
|
||||||
import com.bonus.core.menu.api.MenuRecipeApi;
|
import com.bonus.core.menu.api.MenuRecipeApi;
|
||||||
import com.bonus.core.menu.dto.CheckDishesDto;
|
import com.bonus.core.menu.dto.CheckDishesDto;
|
||||||
import com.bonus.core.menu.model.AllocMealtimeModel;
|
import com.bonus.core.menu.model.AllocMealtimeModel;
|
||||||
import com.bonus.core.menu.vo.CheckDishesVo;
|
import com.bonus.core.menu.vo.CheckDishesVo;
|
||||||
|
import com.bonus.core.order.client.OrderModuleClient;
|
||||||
|
import com.bonus.core.order.client.po.MealtimeQueryParam;
|
||||||
import com.bonus.core.order.common.constants.DetailTypeEnum;
|
import com.bonus.core.order.common.constants.DetailTypeEnum;
|
||||||
|
import com.bonus.core.order.common.constants.OrderCacheConstants;
|
||||||
import com.bonus.core.order.common.constants.OrderTips;
|
import com.bonus.core.order.common.constants.OrderTips;
|
||||||
import com.bonus.core.order.common.constants.OrderTypeEnum;
|
import com.bonus.core.order.common.constants.OrderTypeEnum;
|
||||||
import com.bonus.core.order.common.dto.OrderDetailPayDTO;
|
import com.bonus.core.order.common.dto.OrderDetailPayDTO;
|
||||||
|
|
@ -32,6 +39,7 @@ import com.bonus.core.supermarket.model.SupermarketInfo;
|
||||||
import com.bonus.core.supermarket.vo.SupermarketNotRemovedProductListVO;
|
import com.bonus.core.supermarket.vo.SupermarketNotRemovedProductListVO;
|
||||||
import com.bonus.i18n.I18n;
|
import com.bonus.i18n.I18n;
|
||||||
import com.bonus.utils.id.Id;
|
import com.bonus.utils.id.Id;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -39,8 +47,10 @@ import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
|
|
@ -58,6 +68,14 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
protected MenuRecipeApi menuRecipeApi;
|
protected MenuRecipeApi menuRecipeApi;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
protected AllocCanteenApi allocCanteenApi;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
protected AllocStallApi allocStallApi;
|
||||||
|
@Autowired
|
||||||
|
protected OrderModuleClient orderModuleClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrderShoppingCartAddResultVO add(OrderShoppingCartAddDTO addDTO) {
|
public OrderShoppingCartAddResultVO add(OrderShoppingCartAddDTO addDTO) {
|
||||||
|
|
@ -65,12 +83,9 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
if (customVO != null) {
|
if (customVO != null) {
|
||||||
return customVO;
|
return customVO;
|
||||||
} else {
|
} else {
|
||||||
try{
|
this.checkSubmitParam(addDTO);
|
||||||
this.checkSubmitParam(addDTO);
|
RLock lock = RedisUtil.getLock(OrderCacheConstants.shoppingCartLockKey(addDTO.getCustId()));
|
||||||
}catch (Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
// RLock lock = RedisUtil.getLock(OrderCacheConstants.shoppingCartLockKey(addDTO.getCustId()));
|
|
||||||
OrderShoppingCart entity;
|
OrderShoppingCart entity;
|
||||||
try {
|
try {
|
||||||
OrderShoppingCart sameShoppingCart = (OrderShoppingCart)this.orderShoppingCartService.listByCust((new OrderShoppingSearchDTO()).setCustId(addDTO.getCustId()).setOrderType(addDTO.getOrderType())).stream().filter((s) -> {
|
OrderShoppingCart sameShoppingCart = (OrderShoppingCart)this.orderShoppingCartService.listByCust((new OrderShoppingSearchDTO()).setCustId(addDTO.getCustId()).setOrderType(addDTO.getOrderType())).stream().filter((s) -> {
|
||||||
|
|
@ -89,13 +104,14 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
addDTO.setOrderDate((LocalDate)null);
|
addDTO.setOrderDate((LocalDate)null);
|
||||||
addDTO.setMealtimeType((Integer)null);
|
addDTO.setMealtimeType((Integer)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.orderShoppingCartService.insert(entity);
|
this.orderShoppingCartService.insert(entity);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
// if (lock.isHeldByCurrentThread() && lock.isLocked()) {
|
if (lock.isHeldByCurrentThread() && lock.isLocked()) {
|
||||||
// lock.unlock();
|
lock.unlock();
|
||||||
// }
|
}
|
||||||
} catch (Exception var11) {
|
} catch (Exception var11) {
|
||||||
log.error("解锁异常", var11);
|
log.error("解锁异常", var11);
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +150,7 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
JavaxValidateUtils.validate(searchDTO);
|
JavaxValidateUtils.validate(searchDTO);
|
||||||
List<OrderShoppingCart> orderShoppingCarts = this.orderShoppingCartService.listByCust(searchDTO);
|
List<OrderShoppingCart> orderShoppingCarts = this.orderShoppingCartService.listByCust(searchDTO);
|
||||||
LogUtil.infoFieldsX("查询购物车_结果", orderShoppingCarts, OrderShoppingCart.logFields());
|
LogUtil.infoFieldsX("查询购物车_结果", orderShoppingCarts, OrderShoppingCart.logFields());
|
||||||
List<OrderShoppingCartListMobileVO> voList = (List)orderShoppingCarts.stream().map(OrderShoppingCartListMobileVO::of).collect(Collectors.toList());
|
List<OrderShoppingCartListMobileVO> voList = orderShoppingCarts.stream().map(OrderShoppingCartListMobileVO::of).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(voList)) {
|
if (CollUtil.isEmpty(voList)) {
|
||||||
return voList;
|
return voList;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -146,24 +162,22 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
protected void fillVo(List<OrderShoppingCartListMobileVO> voList, Integer orderType, Long custId) {
|
protected void fillVo(List<OrderShoppingCartListMobileVO> voList, Integer orderType, Long custId) {
|
||||||
if (!CollUtil.isEmpty(voList)) {
|
if (!CollUtil.isEmpty(voList)) {
|
||||||
if (OrderTypeEnum.isShopCategory(orderType)) {
|
if (OrderTypeEnum.isShopCategory(orderType)) {
|
||||||
Map<Long, List<OrderShoppingCartListMobileVO>> voGroupBySupermarket = (Map)voList.stream().collect(Collectors.groupingBy(OrderShoppingCartListMobileVO::getCanteenId));
|
Map<Long, List<OrderShoppingCartListMobileVO>> voGroupBySupermarket = voList.stream().collect(Collectors.groupingBy(OrderShoppingCartListMobileVO::getCanteenId));
|
||||||
voGroupBySupermarket.forEach((supermarketId, vos) -> {
|
voGroupBySupermarket.forEach((supermarketId, vos) -> {
|
||||||
List<Long> goodsIds = (List)vos.stream().map(OrderShoppingCartListMobileVO::getGoodsDishesId).collect(Collectors.toList());
|
List<Long> goodsIds = vos.stream().map(OrderShoppingCartListMobileVO::getGoodsDishesId).collect(Collectors.toList());
|
||||||
SupermarketNotRemovedProductListDTO dto = new SupermarketNotRemovedProductListDTO();
|
SupermarketNotRemovedProductListDTO dto = new SupermarketNotRemovedProductListDTO();
|
||||||
dto.setSupermarketId(supermarketId);
|
dto.setSupermarketId(supermarketId);
|
||||||
dto.setMaterialIdList(goodsIds);
|
dto.setMaterialIdList(goodsIds);
|
||||||
dto.setCustId(custId);
|
dto.setCustId(custId);
|
||||||
Map<Long, SupermarketNotRemovedProductListVO> productMap =null;
|
Map<Long, SupermarketNotRemovedProductListVO> productMap = this.supermarketApi.listNotRemovedProduct(dto).stream().collect(Collectors.toMap(SupermarketNotRemovedProductListVO::getMaterialId, Function.identity()));
|
||||||
// (Map)this.supermarketApi.listNotRemovedProduct(dto).stream().collect(Collectors.toMap(SupermarketNotRemovedProductListVO::getMaterialId, Function.identity()));
|
|
||||||
vos.forEach((s) -> {
|
vos.forEach((s) -> {
|
||||||
s.fillSupermarketProductInfo((SupermarketNotRemovedProductListVO)productMap.get(s.getGoodsDishesId()));
|
s.fillSupermarketProductInfo(productMap.get(s.getGoodsDishesId()));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (OrderTypeEnum.isCanteenCategory(orderType)) {
|
} else if (OrderTypeEnum.isCanteenCategory(orderType)) {
|
||||||
if (OrderTypeEnum.isCurrMealType(orderType)) {
|
if (OrderTypeEnum.isCurrMealType(orderType)) {
|
||||||
voList.forEach((s) -> {
|
voList.forEach((s) -> {
|
||||||
AllocMealtimeModel nowMealtime = null;
|
AllocMealtimeModel nowMealtime = this.orderModuleClient.mealtimeQuery(MealtimeQueryParam.ofAssignTime(LocalTime.now(), s.getCanteenId(), s.getStallId()));
|
||||||
// this.orderModuleClient.mealtimeQuery(MealtimeQueryParam.ofAssignTime(LocalTime.now(), s.getCanteenId(), s.getStallId()));
|
|
||||||
if (nowMealtime != null) {
|
if (nowMealtime != null) {
|
||||||
s.setOrderDate(LocalDate.now());
|
s.setOrderDate(LocalDate.now());
|
||||||
s.setMealtimeType(nowMealtime.getMealtimeType());
|
s.setMealtimeType(nowMealtime.getMealtimeType());
|
||||||
|
|
@ -221,14 +235,12 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
if (LeNumUtil.isValidId(vo.getCanteenId())) {
|
if (LeNumUtil.isValidId(vo.getCanteenId())) {
|
||||||
if (!canteenNameMapById.containsKey(vo.getCanteenId())) {
|
if (!canteenNameMapById.containsKey(vo.getCanteenId())) {
|
||||||
if (OrderTypeEnum.isShopCategory(vo.getOrderType())) {
|
if (OrderTypeEnum.isShopCategory(vo.getOrderType())) {
|
||||||
SupermarketInfo supermarketInfo = null;
|
SupermarketInfo supermarketInfo = this.supermarketApi.getSupermarketInfoById(vo.getCanteenId());
|
||||||
// this.supermarketApi.getSupermarketInfoById(vo.getCanteenId());
|
|
||||||
if (supermarketInfo != null) {
|
if (supermarketInfo != null) {
|
||||||
canteenNameMapById.put(vo.getCanteenId(), supermarketInfo.getSupermarketName());
|
canteenNameMapById.put(vo.getCanteenId(), supermarketInfo.getSupermarketName());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AllocCanteen allocCanteen = null;
|
AllocCanteen allocCanteen = this.allocCanteenApi.getAllocCanteen(vo.getCanteenId());
|
||||||
// this.allocCanteenApi.getAllocCanteen(vo.getCanteenId());
|
|
||||||
if (allocCanteen != null) {
|
if (allocCanteen != null) {
|
||||||
canteenNameMapById.put(vo.getCanteenId(), allocCanteen.getCanteenName());
|
canteenNameMapById.put(vo.getCanteenId(), allocCanteen.getCanteenName());
|
||||||
}
|
}
|
||||||
|
|
@ -241,53 +253,52 @@ public class ShoppingCartBusinessImpl implements ShoppingCartBusiness {
|
||||||
if (LeNumUtil.isValidId(vo.getStallId())) {
|
if (LeNumUtil.isValidId(vo.getStallId())) {
|
||||||
AllocStall allocStall;
|
AllocStall allocStall;
|
||||||
if (stallMapById.containsKey(vo.getStallId())) {
|
if (stallMapById.containsKey(vo.getStallId())) {
|
||||||
allocStall =null;
|
allocStall = this.allocStallApi.getAllocStall(vo.getStallId());
|
||||||
// this.allocStallApi.getAllocStall(vo.getStallId());
|
|
||||||
if (allocStall != null) {
|
if (allocStall != null) {
|
||||||
stallMapById.put(vo.getStallId(), allocStall);
|
stallMapById.put(vo.getStallId(), allocStall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allocStall =null;
|
allocStall = this.allocStallApi.getAllocStall(vo.getStallId());
|
||||||
// this.allocStallApi.getAllocStall(vo.getStallId());
|
|
||||||
if (allocStall != null) {
|
if (allocStall != null) {
|
||||||
vo.setStallName(allocStall.getStallName());
|
vo.setStallName(allocStall.getStallName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
protected void checkSubmitParam(OrderShoppingCartAddDTO addDTO) throws Exception {
|
protected void checkSubmitParam(OrderShoppingCartAddDTO addDTO) {
|
||||||
JavaxValidateUtils.validate(addDTO);
|
JavaxValidateUtils.validate(addDTO);
|
||||||
if (!this.supportOrderTypes().contains(addDTO.getOrderType())) {
|
if (!this.supportOrderTypes().contains(addDTO.getOrderType())) {
|
||||||
throw new Exception(I18n.getMessage("order.un-support-order-type", new Object[0]));
|
throw new ServiceException(I18n.getMessage("order.un-support-order-type", new Object[0]));
|
||||||
} else {
|
} else {
|
||||||
if (OrderTypeEnum.isCanteenCategory(addDTO.getOrderType())) {
|
if (OrderTypeEnum.isCanteenCategory(addDTO.getOrderType())) {
|
||||||
if (addDTO.getOrderDate() == null || !LeNumUtil.isValidId(addDTO.getMealtimeType())) {
|
if (addDTO.getOrderDate() == null || !LeNumUtil.isValidId(addDTO.getMealtimeType())) {
|
||||||
throw new Exception(I18n.getMessage("order.mobile.cart-need-date-mealtime", new Object[0]));
|
throw new ServiceException(I18n.getMessage("order.mobile.cart-need-date-mealtime", new Object[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DetailTypeEnum.isDishesCategory(addDTO.getDetailType())) {
|
if (!DetailTypeEnum.isDishesCategory(addDTO.getDetailType())) {
|
||||||
throw new Exception(I18n.getMessage("order.un-support-detail-type", new Object[0]));
|
throw new ServiceException(I18n.getMessage("order.un-support-detail-type", new Object[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LeNumUtil.isValidId(addDTO.getMenuId())) {
|
if (!LeNumUtil.isValidId(addDTO.getMenuId())) {
|
||||||
throw new Exception(OrderTips.paramIllegal(":menuId(菜谱id)"));
|
throw new ServiceException(OrderTips.paramIllegal(":menuId(菜谱id)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LeNumUtil.isValidId(addDTO.getCanteenId())) {
|
if (!LeNumUtil.isValidId(addDTO.getCanteenId())) {
|
||||||
throw new Exception(OrderTips.paramIllegal(":canteenId(食堂id)"));
|
throw new ServiceException(OrderTips.paramIllegal(":canteenId(食堂id)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LeNumUtil.isValidId(addDTO.getStallId())) {
|
if (!LeNumUtil.isValidId(addDTO.getStallId())) {
|
||||||
throw new Exception(OrderTips.paramIllegal(":stallId(档口id)"));
|
throw new ServiceException(OrderTips.paramIllegal(":stallId(档口id)"));
|
||||||
}
|
}
|
||||||
} else if (OrderTypeEnum.isShopCategory(addDTO.getOrderType())) {
|
} else if (OrderTypeEnum.isShopCategory(addDTO.getOrderType())) {
|
||||||
if (!DetailTypeEnum.isProductType(addDTO.getDetailType())) {
|
if (!DetailTypeEnum.isProductType(addDTO.getDetailType())) {
|
||||||
throw new Exception(I18n.getMessage("order.un-support-detail-type", new Object[0]));
|
throw new ServiceException(I18n.getMessage("order.un-support-detail-type", new Object[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LeNumUtil.isValidId(addDTO.getCanteenId())) {
|
if (!LeNumUtil.isValidId(addDTO.getCanteenId())) {
|
||||||
throw new Exception(OrderTips.paramIllegal(":canteenId(超市id)"));
|
throw new ServiceException(OrderTips.paramIllegal(":canteenId(超市id)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.bonus.core.supermarket.mapper.SupermarketProductMapper;
|
||||||
import com.bonus.core.supermarket.model.SupermarketInfo;
|
import com.bonus.core.supermarket.model.SupermarketInfo;
|
||||||
import com.bonus.core.supermarket.po.GoodsBuyLimitModel;
|
import com.bonus.core.supermarket.po.GoodsBuyLimitModel;
|
||||||
import com.bonus.core.supermarket.po.WarehouseModel;
|
import com.bonus.core.supermarket.po.WarehouseModel;
|
||||||
|
import com.bonus.core.supermarket.vo.SupermarketNotRemovedProductListVO;
|
||||||
import com.bonus.core.supermarket.vo.SupermarketProductInfoImageVO;
|
import com.bonus.core.supermarket.vo.SupermarketProductInfoImageVO;
|
||||||
import com.bonus.core.supermarket.vo.SupermarketQueryProductInfoVO;
|
import com.bonus.core.supermarket.vo.SupermarketQueryProductInfoVO;
|
||||||
import com.bonus.i18n.I18n;
|
import com.bonus.i18n.I18n;
|
||||||
|
|
@ -32,6 +33,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
@ -321,29 +323,29 @@ public class SupermarketApi {
|
||||||
return this.supermarketProductMapper.getProductImg(goodsIdList);
|
return this.supermarketProductMapper.getProductImg(goodsIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public List<SupermarketNotRemovedProductListVO> listNotRemovedProduct(SupermarketNotRemovedProductListDTO content) {
|
public List<SupermarketNotRemovedProductListVO> listNotRemovedProduct(SupermarketNotRemovedProductListDTO content) {
|
||||||
// log.info("[商超]_购物车_获取上架商品_入参:{}", content);
|
log.info("[商超]_购物车_获取上架商品_入参:{}", content);
|
||||||
// if (!ObjectUtil.isEmpty(content.getSupermarketId()) && !CollUtil.isEmpty(content.getMaterialIdList())) {
|
if (!ObjectUtil.isEmpty(content.getSupermarketId()) && !CollUtil.isEmpty(content.getMaterialIdList())) {
|
||||||
// boolean ifRelateDrp = this.ifRelateDrp(content.getSupermarketId());
|
boolean ifRelateDrp = this.ifRelateDrp(content.getSupermarketId());
|
||||||
// List resultList;
|
List<SupermarketNotRemovedProductListVO> resultList;
|
||||||
// if (ifRelateDrp) {
|
if (ifRelateDrp) {
|
||||||
// resultList = this.supermarketProductMapper.listNotRemovedProduct(content, 1);
|
resultList = this.supermarketProductMapper.listNotRemovedProduct(content, 1);
|
||||||
// } else {
|
} else {
|
||||||
// resultList = this.supermarketProductMapper.listNotRemovedProduct(content, (Integer)null);
|
resultList = this.supermarketProductMapper.listNotRemovedProduct(content, (Integer)null);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// boolean ifSupermarketMember = this.ifSupermarketMember(content.getCustId(), content.getSupermarketId());
|
boolean ifSupermarketMember = this.ifSupermarketMember(content.getCustId(), content.getSupermarketId());
|
||||||
// if (!ifSupermarketMember) {
|
if (!ifSupermarketMember) {
|
||||||
// resultList.forEach((s) -> {
|
resultList.forEach((s) -> {
|
||||||
// s.setPrefPrice((BigDecimal)null);
|
s.setPrefPrice((BigDecimal)null);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return resultList;
|
return resultList;
|
||||||
// } else {
|
} else {
|
||||||
// throw new LeException(I18n.getMessage("supermarket.shop-cert-material-not-null", new Object[0]));
|
throw new ServiceException(I18n.getMessage("supermarket.shop-cert-material-not-null", new Object[0]));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
public void checkProductLimitBuy(SmtCheckProductLimitBuyDTO content) {
|
public void checkProductLimitBuy(SmtCheckProductLimitBuyDTO content) {
|
||||||
log.info("[商超]_限购校验_入参:{}", content);
|
log.info("[商超]_限购校验_入参:{}", content);
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,12 @@ package com.bonus.core.supermarket.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.bonus.core.supermarket.dto.SupermarketNotRemovedProductListDTO;
|
||||||
import com.bonus.core.supermarket.dto.SupermarketQueryProductInfoDTO;
|
import com.bonus.core.supermarket.dto.SupermarketQueryProductInfoDTO;
|
||||||
import com.bonus.core.supermarket.model.SupermarketProduct;
|
import com.bonus.core.supermarket.model.SupermarketProduct;
|
||||||
import com.bonus.core.supermarket.po.GoodsBuyLimitModel;
|
import com.bonus.core.supermarket.po.GoodsBuyLimitModel;
|
||||||
import com.bonus.core.supermarket.po.InventoryNumModel;
|
import com.bonus.core.supermarket.po.InventoryNumModel;
|
||||||
|
import com.bonus.core.supermarket.vo.SupermarketNotRemovedProductListVO;
|
||||||
import com.bonus.core.supermarket.vo.SupermarketProductInfoImageVO;
|
import com.bonus.core.supermarket.vo.SupermarketProductInfoImageVO;
|
||||||
import com.bonus.core.supermarket.vo.SupermarketQueryProductInfoVO;
|
import com.bonus.core.supermarket.vo.SupermarketQueryProductInfoVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
@ -59,8 +61,8 @@ public interface SupermarketProductMapper extends BaseMapper<SupermarketProduct>
|
||||||
InventoryNumModel getProductInventory(@Param("supermarketId") Long supermarketId, @Param("supermarketDetailId") Long supermarketDetailId);
|
InventoryNumModel getProductInventory(@Param("supermarketId") Long supermarketId, @Param("supermarketDetailId") Long supermarketDetailId);
|
||||||
//
|
//
|
||||||
// List<PriceByMaterialIdVO> getPriceByMaterialIds(@Param("materialIds") List<Long> materialIds, @Param("warehouseId") Long warehouseId);
|
// List<PriceByMaterialIdVO> getPriceByMaterialIds(@Param("materialIds") List<Long> materialIds, @Param("warehouseId") Long warehouseId);
|
||||||
//
|
|
||||||
// List<SupermarketNotRemovedProductListVO> listNotRemovedProduct(@Param("content") SupermarketNotRemovedProductListDTO content, @Param("ifRelateDrp") Integer ifRelateDrp);
|
List<SupermarketNotRemovedProductListVO> listNotRemovedProduct(@Param("content") SupermarketNotRemovedProductListDTO content, @Param("ifRelateDrp") Integer ifRelateDrp);
|
||||||
|
|
||||||
List<SupermarketProductInfoImageVO> getProductImg(@Param("goodsIdList") List<Long> goodsIdList);
|
List<SupermarketProductInfoImageVO> getProductImg(@Param("goodsIdList") List<Long> goodsIdList);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -526,43 +526,43 @@
|
||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!-- </where>-->
|
<!-- </where>-->
|
||||||
<!-- </select>-->
|
<!-- </select>-->
|
||||||
<!-- <select id="listNotRemovedProduct"-->
|
<select id="listNotRemovedProduct"
|
||||||
<!-- resultType="net.xnzn.core.supermarket.vo.SupermarketNotRemovedProductListVO">-->
|
resultType="com.bonus.core.supermarket.vo.SupermarketNotRemovedProductListVO">
|
||||||
<!-- SELECT-->
|
SELECT
|
||||||
<!-- a.supermarket_detail_id,-->
|
a.supermarket_detail_id,
|
||||||
<!-- a.material_id,-->
|
a.material_id,
|
||||||
<!-- b.material_name,-->
|
b.material_name,
|
||||||
<!-- b.unit_id,-->
|
b.unit_id,
|
||||||
<!-- c.unit_name,-->
|
c.unit_name,
|
||||||
<!-- a.sale_price,-->
|
a.sale_price,
|
||||||
<!-- a.pref_price,-->
|
a.pref_price,
|
||||||
<!-- b.sales_mode,-->
|
b.sales_mode,
|
||||||
<!-- a.putaway_state,-->
|
a.putaway_state,
|
||||||
<!-- a.if_online,-->
|
a.if_online,
|
||||||
<!-- <if test="ifRelateDrp != null">-->
|
<if test="ifRelateDrp != null">
|
||||||
<!-- e.inventory_id,-->
|
e.inventory_id,
|
||||||
<!-- IFNULL(e.material_num,0) inventoryNum,-->
|
IFNULL(e.material_num,0) inventoryNum,
|
||||||
<!-- </if>-->
|
</if>
|
||||||
<!-- <if test="ifRelateDrp == null">-->
|
<if test="ifRelateDrp == null">
|
||||||
<!-- a.inventory_num,-->
|
a.inventory_num,
|
||||||
<!-- </if>-->
|
</if>
|
||||||
<!-- a.person_limit,-->
|
a.person_limit,
|
||||||
<!-- b.image_url-->
|
b.image_url
|
||||||
<!-- FROM-->
|
FROM
|
||||||
<!-- supermarket_product a-->
|
supermarket_product a
|
||||||
<!-- LEFT JOIN menu_material b ON b.material_id = a.material_id-->
|
LEFT JOIN menu_material b ON b.material_id = a.material_id
|
||||||
<!-- LEFT JOIN drp_unit c ON c.unit_id = b.unit_id-->
|
LEFT JOIN drp_unit c ON c.unit_id = b.unit_id
|
||||||
<!-- <if test="ifRelateDrp != null">-->
|
<if test="ifRelateDrp != null">
|
||||||
<!-- LEFT JOIN supermarket_info d on d.supermarket_id = a.supermarket_id-->
|
LEFT JOIN supermarket_info d on d.supermarket_id = a.supermarket_id
|
||||||
<!-- LEFT JOIN drp_inventory e on e.warehouse_id = d.warehouse_id and e.material_id = b.material_id-->
|
LEFT JOIN drp_inventory e on e.warehouse_id = d.warehouse_id and e.material_id = b.material_id
|
||||||
<!-- </if>-->
|
</if>
|
||||||
<!-- WHERE-->
|
WHERE
|
||||||
<!-- a.supermarket_id = #{content.supermarketId}-->
|
a.supermarket_id = #{content.supermarketId}
|
||||||
<!-- AND a.material_id IN-->
|
AND a.material_id IN
|
||||||
<!-- <foreach collection="content.materialIdList" item="materialId" separator="," open="(" close=")">-->
|
<foreach collection="content.materialIdList" item="materialId" separator="," open="(" close=")">
|
||||||
<!-- #{materialId}-->
|
#{materialId}
|
||||||
<!-- </foreach>-->
|
</foreach>
|
||||||
<!-- </select>-->
|
</select>
|
||||||
<select id="getProductImg" resultType="com.bonus.core.supermarket.vo.SupermarketProductInfoImageVO">
|
<select id="getProductImg" resultType="com.bonus.core.supermarket.vo.SupermarketProductInfoImageVO">
|
||||||
SELECT
|
SELECT
|
||||||
a.material_id,
|
a.material_id,
|
||||||
|
|
|
||||||
Reference in New Issue