| | |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.mall.conversion.MallOrderInfoConversion; |
| | | import cc.mrbird.febs.mall.conversion.MallOrderRefundConversion; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | |
| | | private final MallOrderRefundMapper mallOrderRefundMapper; |
| | | private final MallOrderRefundOperationMapper mallOrderRefundOperationMapper; |
| | | private final MallShoppingCartMapper mallShoppingCartMapper; |
| | | private final RedisUtils redisUtils; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createOrder(AddOrderDto addOrderDto) { |
| | | MallMember member = LoginUserUtil.getLoginUser(); |
| | | |
| | | MallAddressInfo address = mallAddressInfoMapper.selectById(addOrderDto.getAddressId()); |
| | | MallAddressInfo address = mallAddressInfoMapper.selectAddressInfoByMemberIdAndId(member.getId(), addOrderDto.getAddressId()); |
| | | if (address == null) { |
| | | throw new FebsException("地址不存在"); |
| | | } |
| | |
| | | orderInfo.setAmount(total); |
| | | this.baseMapper.updateById(orderInfo); |
| | | |
| | | String redisKey = StrUtil.format(AppContants.REDIS_ORDER_OVERTIME, member.getId(), orderInfo.getId()); |
| | | redisUtils.set(redisKey, orderInfo.getId(), 900); |
| | | |
| | | return orderInfo.getId(); |
| | | } |
| | | |