自定义订单
This commit is contained in:
@ -12,6 +12,6 @@ public class StatisticsVo {
|
||||
private BigDecimal reduceMoney;
|
||||
private Long carteenId;
|
||||
private LocalDateTime time;
|
||||
private int order_sum;
|
||||
private int orderSum;
|
||||
|
||||
}
|
||||
|
@ -133,4 +133,11 @@ public class OrderController {
|
||||
orderService.reduction(orderId,money);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/customize")
|
||||
@Operation(summary = "自定义")
|
||||
public CommonResult<Boolean> customize(String mobile, BigDecimal money,Long carteenId,String type){
|
||||
orderService.customize(mobile,money,carteenId,type);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class StoreOrderDetailDO extends BaseDO {
|
||||
*/
|
||||
private Integer goodsId;
|
||||
|
||||
private Integer goodsName;
|
||||
private String goodsName;
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
|
@ -12,7 +12,7 @@ public interface DeductionService {
|
||||
void deduction(DishOrderDO dishOrderDO);
|
||||
|
||||
/**
|
||||
* 现金扣款
|
||||
* 现金提现
|
||||
*/
|
||||
void cashDraw(Long userId, BigDecimal money,String type);
|
||||
|
||||
@ -35,4 +35,13 @@ public interface DeductionService {
|
||||
* 超市扣款
|
||||
*/
|
||||
BigDecimal storeDeduction(BigDecimal total, Long userId);
|
||||
|
||||
/**
|
||||
* 扣款
|
||||
*/
|
||||
void deduct(Long userId, BigDecimal money,String type);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ import javax.annotation.Resource;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CASH_AMOUNT_NOT_ENOUGH;
|
||||
@ -48,6 +50,8 @@ public class DeductionServiceImpl implements DeductionService {
|
||||
@Resource
|
||||
private BusinessService businessService;
|
||||
|
||||
private static final List<String> CHECK_LIST = Arrays.asList(CostTypeEnum.SHOPPING.getCode());
|
||||
|
||||
@Override
|
||||
public void deduction(DishOrderDO dishOrderDO) {
|
||||
Long userId = dishOrderDO.getUserId();
|
||||
@ -170,7 +174,7 @@ public class DeductionServiceImpl implements DeductionService {
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setCarteenId(dishOrderDO.getStoreId());
|
||||
statisticsVo.setTotalMoney(dishOrderDO.getTotalMoney());
|
||||
statisticsVo.setOrder_sum(1);
|
||||
statisticsVo.setOrderSum(1);
|
||||
statisticsVo.setReduceMoney(dishOrderDO.getReductionAmount());
|
||||
statisticsVo.setTime(dishOrderDO.getCreateTime());
|
||||
statisticsVo.setOrderId(dishOrderDO.getId());
|
||||
@ -446,5 +450,67 @@ public class DeductionServiceImpl implements DeductionService {
|
||||
appUserInfoCardVO.setMoney(newMoney);
|
||||
deductionRedisTemplate.opsForValue().set(redisKey, JSONUtil.toJsonStr(appUserInfoCardVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deduct(Long userId, BigDecimal money, String type) {
|
||||
BigDecimal newMoney;
|
||||
BigDecimal wxNewMoney;
|
||||
BigDecimal giftNewMoney;
|
||||
BigDecimal cashNewMoney;
|
||||
String name;
|
||||
|
||||
synchronized (getUserLock(userId)) {
|
||||
MemberUserDO user = userService.getUser(userId);
|
||||
|
||||
if (user.getMoney().compareTo(money) < 0) {
|
||||
if (CHECK_LIST.contains(type)) {
|
||||
throw exception(CASH_AMOUNT_NOT_ENOUGH);
|
||||
}
|
||||
user.setWxAmount(BigDecimal.ZERO);
|
||||
user.setCashAmount(BigDecimal.ZERO);
|
||||
user.setGiftAmount(BigDecimal.ZERO);
|
||||
}else {
|
||||
BigDecimal wxAmount = user.getWxAmount();
|
||||
BigDecimal giftAmount = user.getGiftAmount();
|
||||
BigDecimal cashAmount = user.getCashAmount();
|
||||
//计算金额
|
||||
if (money.compareTo(cashAmount) <= 0) {
|
||||
user.setCashAmount(cashAmount.subtract(money));
|
||||
} else {
|
||||
user.setCashAmount(BigDecimal.ZERO);
|
||||
BigDecimal total1 = money.subtract(cashAmount);
|
||||
if (total1.compareTo(giftAmount) <= 0) {
|
||||
user.setGiftAmount(giftAmount.subtract(total1));
|
||||
} else {
|
||||
user.setGiftAmount(BigDecimal.ZERO);
|
||||
BigDecimal total2 = total1.subtract(giftAmount);
|
||||
user.setWxAmount(wxAmount.subtract(total2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
user.setMoney(user.getMoney().subtract(money));
|
||||
userService.updateById(user);
|
||||
newMoney = user.getMoney();
|
||||
wxNewMoney = user.getWxAmount();
|
||||
giftNewMoney = user.getGiftAmount();
|
||||
cashNewMoney = user.getCashAmount();
|
||||
name = user.getNickname();
|
||||
}
|
||||
|
||||
CardDO cardDO = new CardDO();
|
||||
cardDO.setUserId(userId);
|
||||
cardDO.setFlag(CardDO.MINUS);
|
||||
cardDO.setChangeMoney(money);
|
||||
cardDO.setType(type);
|
||||
cardDO.setWxAmount(wxNewMoney);
|
||||
cardDO.setGiftAmount(giftNewMoney);
|
||||
cardDO.setMoney(newMoney);
|
||||
cardDO.setCashAmount(cashNewMoney);
|
||||
cardService.insertOne(cardDO);
|
||||
|
||||
//更新redis
|
||||
updateRedis(userId,name,newMoney);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ public class LockManager {
|
||||
|
||||
private static final ConcurrentHashMap<Long, Object> storeLocks = new ConcurrentHashMap<>();
|
||||
|
||||
private static final ConcurrentHashMap<Long, Object> supermarketLocks = new ConcurrentHashMap<>();
|
||||
|
||||
public static Object getUserLock(Long userId) {
|
||||
// 从 Map 中获取 WeakReference 对象
|
||||
@ -19,5 +20,10 @@ public class LockManager {
|
||||
// 对每个 userId 生成独立的锁对象,并发地存储在 ConcurrentHashMap 中
|
||||
return storeLocks.computeIfAbsent(storeId, k -> new Object());
|
||||
}
|
||||
|
||||
public static Object getSupermarketLock(Long storeId) {
|
||||
// 对每个 userId 生成独立的锁对象,并发地存储在 ConcurrentHashMap 中
|
||||
return storeLocks.computeIfAbsent(storeId, k -> new Object());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class BusinessServiceImpl implements BusinessService {
|
||||
}
|
||||
}
|
||||
//订单数
|
||||
businessDO.setOrderSum(businessDO.getOrderSum() + vo.getOrder_sum());
|
||||
businessDO.setOrderSum(businessDO.getOrderSum() + vo.getOrderSum());
|
||||
|
||||
//营业额
|
||||
if(ObjectUtil.isNotEmpty(vo.getTotalMoney())){
|
||||
@ -154,13 +154,13 @@ public class BusinessServiceImpl implements BusinessService {
|
||||
|
||||
if(timePeriod.equals(CostTypeEnum.MORNING.getCode())){
|
||||
businessDO.setBreakfast(businessDO.getBreakfast().add(vo.getTotalMoney()));
|
||||
businessDO.setBreakfastNum(businessDO.getBreakfastNum() + vo.getOrder_sum());
|
||||
businessDO.setBreakfastNum(businessDO.getBreakfastNum() + vo.getOrderSum());
|
||||
}else if (timePeriod.equals(CostTypeEnum.NOON.getCode())){
|
||||
businessDO.setLunch(businessDO.getLunch().add(vo.getTotalMoney()));
|
||||
businessDO.setLunchNum(businessDO.getLunchNum() + vo.getOrder_sum());
|
||||
businessDO.setLunchNum(businessDO.getLunchNum() + vo.getOrderSum());
|
||||
}else if (timePeriod.equals(CostTypeEnum.NIGHT.getCode())){
|
||||
businessDO.setDinner(businessDO.getDinner().add(vo.getTotalMoney()));
|
||||
businessDO.setDinnerNum(businessDO.getDinnerNum() + vo.getOrder_sum());
|
||||
businessDO.setDinnerNum(businessDO.getDinnerNum() + vo.getOrderSum());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,4 +125,6 @@ public interface OrderService {
|
||||
Map<String,Object> getMoneyAndPeople(Long storeId);
|
||||
|
||||
void reduction(Long orderId,BigDecimal money);
|
||||
|
||||
void customize(String mobile, BigDecimal money,Long carteenId,String type);
|
||||
}
|
@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.member.controller.app.order.vo.AppPageVo;
|
||||
import cn.iocoder.yudao.module.member.controller.app.orderdetail.vo.AppOrderDetailRespVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.card.CardDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.order.DishOrderDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.orderdetail.OrderDetailDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.card.CardMapper;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.group.MemberGroupMapper;
|
||||
@ -38,7 +39,6 @@ import cn.iocoder.yudao.module.system.api.carteen.dto.CarteenRespDto;
|
||||
import cn.iocoder.yudao.module.system.api.deviceInfo.DeviceInfoApi;
|
||||
import cn.iocoder.yudao.module.system.api.deviceInfo.dto.DeviceInfoDto;
|
||||
import cn.iocoder.yudao.module.system.api.dish.DishesApi;
|
||||
import cn.iocoder.yudao.module.system.api.dish.dto.DishesRespDto;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -53,8 +53,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.ORDER_NOT_COMPLETE;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 会员订单 Service 实现类
|
||||
@ -162,42 +161,45 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public PageResult<AppOrderRespVO> getOrderList(AppPageVo vo) {
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
if(StrUtil.isNotEmpty(vo.getMobile())){
|
||||
if (StrUtil.isNotEmpty(vo.getMobile())) {
|
||||
List<MemberUserDO> memberUserDOS = memberUserMapper.selectList(Wrappers.<MemberUserDO>lambdaQuery().like(MemberUserDO::getMobile, vo.getMobile()));
|
||||
if(CollectionUtil.isNotEmpty(memberUserDOS)){
|
||||
if (CollectionUtil.isNotEmpty(memberUserDOS)) {
|
||||
List<Long> collect = memberUserDOS.stream().map(MemberUserDO::getId).collect(Collectors.toList());
|
||||
ids.addAll(collect);
|
||||
}
|
||||
}
|
||||
if(vo.getUserId()!=null){
|
||||
if (vo.getUserId() != null) {
|
||||
ids.add(vo.getUserId());
|
||||
}
|
||||
|
||||
PageResult<DishOrderDO> dishOrderDOPageResult = dishOrderMapper.selectPage(vo, Wrappers.<DishOrderDO>lambdaQuery()
|
||||
.in(CollectionUtil.isNotEmpty(ids),DishOrderDO::getUserId, ids)
|
||||
.in(CollectionUtil.isNotEmpty(ids), DishOrderDO::getUserId, ids)
|
||||
.orderByDesc(DishOrderDO::getCreateTime));
|
||||
PageResult<AppOrderRespVO> appOrderRespVOPageResult = BeanUtils.toBean(dishOrderDOPageResult, AppOrderRespVO.class);
|
||||
List<AppOrderRespVO> list = appOrderRespVOPageResult.getList();
|
||||
for (AppOrderRespVO dishOrderDO : list) {
|
||||
List<AppOrderDetailRespVO> appOrderDetailRespVOS = orderDetailService.selectListByOrderId(dishOrderDO.getId());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(appOrderDetailRespVOS)) {
|
||||
List<Long> dishIds = appOrderDetailRespVOS.stream().map(AppOrderDetailRespVO::getDishesId).collect(Collectors.toList());
|
||||
|
||||
List<DishesRespDto> dishInfo = dishesApi.getDishInfo(dishIds);
|
||||
Map<Long, DishesRespDto> dishMap = dishInfo.stream().collect(Collectors.toMap(DishesRespDto::getId, DishesRespDto -> DishesRespDto));
|
||||
|
||||
appOrderDetailRespVOS.forEach(respVo -> {
|
||||
DishesRespDto dishesRespDto = dishMap.get(respVo.getDishesId());
|
||||
if (ObjectUtil.isNotEmpty(dishesRespDto)) {
|
||||
respVo.setDishesBasePrice(dishesRespDto.getDishesBasePrice())
|
||||
.setDishesSumPrice(ObjectUtil.isNotEmpty(respVo.getUnitPrice())?respVo.getUnitPrice():dishesRespDto.getDishesSumPrice())
|
||||
.setDishesNumber(dishesRespDto.getDishesNumber());
|
||||
// if (CollectionUtil.isNotEmpty(appOrderDetailRespVOS)) {
|
||||
// List<Long> dishIds = appOrderDetailRespVOS.stream().map(AppOrderDetailRespVO::getDishesId).collect(Collectors.toList());
|
||||
//
|
||||
// List<DishesRespDto> dishInfo = dishesApi.getDishInfo(dishIds);
|
||||
// Map<Long, DishesRespDto> dishMap = dishInfo.stream().collect(Collectors.toMap(DishesRespDto::getId, DishesRespDto -> DishesRespDto));
|
||||
//
|
||||
// appOrderDetailRespVOS.forEach(respVo -> {
|
||||
// DishesRespDto dishesRespDto = dishMap.get(respVo.getDishesId());
|
||||
// if (ObjectUtil.isNotEmpty(dishesRespDto)) {
|
||||
// respVo.setDishesBasePrice(dishesRespDto.getDishesBasePrice())
|
||||
// .setDishesSumPrice(ObjectUtil.isNotEmpty(respVo.getUnitPrice())?respVo.getUnitPrice():dishesRespDto.getDishesSumPrice())
|
||||
// .setDishesNumber(dishesRespDto.getDishesNumber());
|
||||
// }
|
||||
//
|
||||
// });
|
||||
//
|
||||
// }
|
||||
for (AppOrderDetailRespVO respVo : appOrderDetailRespVOS) {
|
||||
respVo.setDishesSumPrice(respVo.getUnitPrice());
|
||||
}
|
||||
|
||||
});
|
||||
dishOrderDO.setRefundStatus(refundService.getRefundStatus(dishOrderDO.getId()));
|
||||
}
|
||||
dishOrderDO.setDetailList(appOrderDetailRespVOS);
|
||||
dishOrderDO.setMoney(cardMapper.getMoneyByUsr(dishOrderDO.getUserId()));
|
||||
|
||||
@ -248,7 +250,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<OrderDetailsRespVO> list = new ArrayList<>();
|
||||
for (DishOrderDO dishOrderDO : pageResult.getList()) {
|
||||
OrderDetailsRespVO bean = BeanUtils.toBean(dishOrderDO, OrderDetailsRespVO.class);
|
||||
userDetails(bean, userMap,groupName);
|
||||
userDetails(bean, userMap, groupName);
|
||||
list.add(bean);
|
||||
}
|
||||
return new PageResult<>(list, pageResult.getTotal());
|
||||
@ -276,7 +278,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
}
|
||||
|
||||
private void userDetails(OrderDetailsRespVO bean, HashMap<Long, MemberUserDO> userMap,Map<Long, String> groupName) {
|
||||
private void userDetails(OrderDetailsRespVO bean, HashMap<Long, MemberUserDO> userMap, Map<Long, String> groupName) {
|
||||
MemberUserDO userDO = userMap.get(bean.getUserId());
|
||||
if (ObjectUtil.isNotEmpty(userDO)) {
|
||||
bean.setGroupName(groupName.get(bean.getUserId()));
|
||||
@ -427,10 +429,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void reduction(Long orderId,BigDecimal money) {
|
||||
public void reduction(Long orderId, BigDecimal money) {
|
||||
DishOrderDO dishOrderDO = dishOrderMapper.selectById(orderId);
|
||||
dishOrderDO.setReductionState("1");
|
||||
if(dishOrderDO.getOrderStatus().equals("1")){
|
||||
if (dishOrderDO.getOrderStatus().equals("1")) {
|
||||
dishOrderDO.setReductionAmount(dishOrderDO.getReductionAmount().add(money));
|
||||
//更改订单
|
||||
BigDecimal wxAmount = BigDecimal.ZERO;
|
||||
@ -439,17 +441,17 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
dishOrderDO.setTotalMoney(dishOrderDO.getTotalMoney().subtract(money));
|
||||
dishOrderDO.setRefundAmount(dishOrderDO.getRefundAmount().subtract(money));
|
||||
if(dishOrderDO.getWxAmount().compareTo(money)>=0){
|
||||
if (dishOrderDO.getWxAmount().compareTo(money) >= 0) {
|
||||
dishOrderDO.setWxAmount(dishOrderDO.getWxAmount().subtract(money));
|
||||
wxAmount = wxAmount.add(money);
|
||||
}else {
|
||||
} else {
|
||||
BigDecimal leftMoney = money.subtract(dishOrderDO.getWxAmount());
|
||||
wxAmount = wxAmount.add(dishOrderDO.getWxAmount());
|
||||
dishOrderDO.setWxAmount(BigDecimal.ZERO);
|
||||
if(dishOrderDO.getCashAmount().compareTo(leftMoney)>0){
|
||||
if (dishOrderDO.getCashAmount().compareTo(leftMoney) > 0) {
|
||||
dishOrderDO.setCashAmount(dishOrderDO.getCashAmount().subtract(leftMoney));
|
||||
cashAmount = cashAmount.add(leftMoney);
|
||||
}else {
|
||||
} else {
|
||||
BigDecimal leftMoney1 = leftMoney.subtract(dishOrderDO.getCashAmount());
|
||||
cashAmount = cashAmount.add(dishOrderDO.getCashAmount());
|
||||
dishOrderDO.setCashAmount(BigDecimal.ZERO);
|
||||
@ -460,23 +462,62 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
//退款
|
||||
deductionService.reduction(dishOrderDO.getUserId(),money,giftAmount,cashAmount,wxAmount);
|
||||
deductionService.reduction(dishOrderDO.getUserId(), money, giftAmount, cashAmount, wxAmount);
|
||||
|
||||
//更新营业数据
|
||||
if(dishOrderDO.getOrderStatus().equals(DishOrderDO.COMPLETE)){
|
||||
if (dishOrderDO.getOrderStatus().equals(DishOrderDO.COMPLETE)) {
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setCarteenId(dishOrderDO.getStoreId());
|
||||
statisticsVo.setTotalMoney(money.negate());
|
||||
statisticsVo.setOrder_sum(0);
|
||||
statisticsVo.setOrderSum(0);
|
||||
statisticsVo.setReduceMoney(money);
|
||||
statisticsVo.setTime(dishOrderDO.getCreateTime());
|
||||
businessService.updateStatistics(statisticsVo);
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
dishOrderDO.setReductionAmount(dishOrderDO.getReductionAmount().add(money));
|
||||
}
|
||||
dishOrderMapper.updateById(dishOrderDO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(String mobile, BigDecimal money, Long carteenId, String type) {
|
||||
//订单处理
|
||||
MemberUserDO memberUserDO = memberUserMapper.selectOne(Wrappers.<MemberUserDO>lambdaQuery().eq(MemberUserDO::getMobile, mobile));
|
||||
if (memberUserDO == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
DishOrderDO dishOrderDO = new DishOrderDO();
|
||||
dishOrderDO.setStoreId(carteenId);
|
||||
dishOrderDO.setOrderStatus(DishOrderDO.COMPLETE);
|
||||
dishOrderDO.setTotalMoney(money);
|
||||
dishOrderDO.setUserId(memberUserDO.getId());
|
||||
dishOrderDO.setPayMethods(type);
|
||||
dishOrderDO.setDiningPlatesNum("000001");
|
||||
dishOrderDO.setCashAmount(money);
|
||||
dishOrderDO.setRefundAmount(money);
|
||||
|
||||
dishOrderMapper.insert(dishOrderDO);
|
||||
//订单详情处理
|
||||
OrderDetailDO orderDetailDO = new OrderDetailDO();
|
||||
orderDetailDO.setOrderId(dishOrderDO.getId());
|
||||
orderDetailDO.setDishesName("自定义");
|
||||
orderDetailDO.setPrice(money);
|
||||
orderDetailDO.setDishesId(-1L);
|
||||
orderDetailService.insertOne(orderDetailDO);
|
||||
//扣费处理
|
||||
deductionService.deduct(memberUserDO.getId(), money, type);
|
||||
//更新营业数据
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setCarteenId(dishOrderDO.getStoreId());
|
||||
statisticsVo.setTotalMoney(dishOrderDO.getTotalMoney());
|
||||
statisticsVo.setOrderSum(1);
|
||||
statisticsVo.setReduceMoney(dishOrderDO.getReductionAmount());
|
||||
statisticsVo.setTime(dishOrderDO.getCreateTime());
|
||||
statisticsVo.setOrderId(dishOrderDO.getId());
|
||||
businessService.updateStatistics(statisticsVo);
|
||||
|
||||
}
|
||||
}
|
@ -60,4 +60,6 @@ public interface OrderDetailService {
|
||||
List<OrderDetailDO> selectListByOrderIds(List<Long> orderIds);
|
||||
|
||||
List<DishVO> selectDishSale(Long storeId);
|
||||
|
||||
void insertOne(OrderDetailDO orderDetailDO);
|
||||
}
|
@ -161,4 +161,8 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void insertOne(OrderDetailDO orderDetailDO) {
|
||||
orderDetailMapper.insert(orderDetailDO);
|
||||
}
|
||||
}
|
@ -595,7 +595,14 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
//获取今天购买的菜品id
|
||||
List<OrderDetailDO> orderDetailDOS = orderDetailMapper.selectList(new LambdaQueryWrapperX<OrderDetailDO>()
|
||||
.inIfPresent(OrderDetailDO::getOrderId, collect));
|
||||
Map<Long, List<OrderDetailDO>> collect2 = orderDetailDOS.stream().collect(Collectors.groupingBy(OrderDetailDO::getDishesId));
|
||||
if(ObjectUtil.isEmpty(orderDetailDOS)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<OrderDetailDO> collect3 = orderDetailDOS.stream().filter(a -> a.getDishesId() != null).collect(Collectors.toList());
|
||||
if(ObjectUtil.isEmpty(collect3)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Map<Long, List<OrderDetailDO>> collect2 = collect3.stream().collect(Collectors.groupingBy(OrderDetailDO::getDishesId));
|
||||
//热量求和统计方便 科学膳食小建议
|
||||
double sum = orderDetailDOS
|
||||
.stream().filter(vo->vo!=null && vo.getHeat()!=null)
|
||||
|
Reference in New Issue
Block a user