| | |
| | | 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.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.shop.domain.dto.AppNearbyShopDto; |
| | | import com.ruoyi.shop.domain.dto.MyAppointmentListDto; |
| | | import com.ruoyi.shop.domain.vo.AppNearbyShopVo; |
| | | import com.ruoyi.shop.domain.vo.AppShopInfoVo; |
| | | import com.ruoyi.shop.domain.vo.MyAppointmentListVo; |
| | | import com.ruoyi.shop.service.shop.ShopAppointableTimeService; |
| | | import com.ruoyi.shop.service.shop.ShopNonAppointableTimeService; |
| | | import com.ruoyi.shop.service.shop.ShopService; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | |
| | | shopAppointableTimeService.save(one); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getMyAppointmentList", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取我的预约列表【2.0】") |
| | | public R<Page<MyAppointmentListVo>> getMyAppointmentList(@RequestBody MyAppointmentListDto dto) { |
| | | Page<MyAppointmentListVo> page = new Page<>(); |
| | | page.setSize(dto.getPageSize()); |
| | | page.setCurrent(dto.getPageNum()); |
| | | List<MyAppointmentListVo> myAppointmentListVos = shopAppointableTimeService.pageMyAppointmentList(page, dto); |
| | | return R.ok(page.setRecords(myAppointmentListVos)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/cancelAppointmentTime/{id}", method = RequestMethod.POST) |
| | | @ApiOperation(value = "取消预约【2.0】") |
| | | public R cancelAppointmentTime(@PathVariable("id") String id) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | ShopAppointableTime one = shopAppointableTimeService.getById(id); |
| | | if (null == one) { |
| | | return R.fail("预约不存在"); |
| | | } |
| | | if (!one.getUserId().equals(userId)) { |
| | | return R.fail("不能取消别人的预约"); |
| | | } |
| | | one.setStatus(0); |
| | | shopAppointableTimeService.updateById(one); |
| | | return R.ok(); |
| | | } |
| | | } |