| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.shop.domain.dto.AppNearbyShopDto; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "获取商户不可预约时间段【2.0】") |
| | | public R<List<ShopNonAppointableTime>> getShopAppointmentTime(@RequestBody ShopAppointmentTimeDto dto) { |
| | | List<ShopNonAppointableTime> list = shopNonAppointableTimeService.list(new QueryWrapper<ShopNonAppointableTime>().eq("shop_id", dto.getId()) |
| | | .last(" and '" + dto.getDate() + "' like CONCAT('%', non_appointable_start_time, '%') order by non_appointable_start_time")); |
| | | .last(" and '" + dto.getDate() + "' = DATE(non_appointable_start_time) order by non_appointable_start_time")); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "门店详情预约操作【2.0】") |
| | | public R appointmentTime(@RequestBody AppointmentTimeDto dto) { |
| | | ShopAppointableTime one = shopAppointableTimeService.getOne(new LambdaQueryWrapper<ShopAppointableTime>().eq(ShopAppointableTime::getShopId, dto.getShopId()) |
| | | .eq(ShopAppointableTime::getAppointableTime, dto.getTime())); |
| | | .last(" and DATE_FORMAT(appointable_time, '%Y-%m-%d %H:%i') = '" + dto.getTime() + "'")); |
| | | if (null != one) { |
| | | return R.fail("不能重复预约"); |
| | | } |
| | | Long userId = SecurityUtils.getUserId(); |
| | | one = new ShopAppointableTime(); |
| | | one.setShopId(dto.getShopId()); |
| | | one.setAppointableTime(dto.getTime()); |
| | | one.setAppointableTime(LocalDateTime.parse(dto.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))); |
| | | one.setUserId(userId); |
| | | one.setStatus(1); |
| | | one.setCreateTime(LocalDateTime.now()); |