From e93aad02d2dd2a6e624e81ea0adb3611a8fc43e5 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 26 十二月 2024 17:16:19 +0800 Subject: [PATCH] 合并代码 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java | 86 +++++++++++++++++++++++++++++++++++------- 1 files changed, 71 insertions(+), 15 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java index 6aa2f8b..6f6fe87 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java @@ -2,63 +2,89 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.service.TechnicianSubscribeService; import com.ruoyi.other.vo.TechnicianSubscribeVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.*; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * <p> - * 前端控制器 + * 前端控制器 * </p> * * @author luodangjia * @since 2024-11-20 */ -@Api(tags = "技师预约管理") +@Api("技师预约管理") @RestController @RequestMapping("/technician-subscribe") public class TechnicianSubscribeController extends BaseController { @Resource private TechnicianSubscribeService technicianSubscribeService; + @Resource + private TokenService tokenService; + + + @GetMapping("/shop/list") + @ApiOperation(value = "预约列表", tags = {"门店-预约列表"}) + public TableDataInfo<TechnicianSubscribeVO> shoplist(@ApiParam(value = "状态") Integer status, + @ApiParam("电话")String phone, + @ApiParam("姓名")String name, + @ApiParam("服务方式:1=上门服务,2=到店服务")Integer serviceMode + ) { + Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); + startPage(); + List<TechnicianSubscribeVO> list = technicianSubscribeService + .getTechnicianSubscribeByUserAndShop1(Long.valueOf(objectId),status,phone,name,serviceMode); + return getDataTable(list); + } /** * 预约列表 */ @GetMapping("/list") @ApiOperation(value = "预约列表", notes = "预约列表", tags = {"小程序-个人中心-门店管理-预约列表"}) - public TableDataInfo list(@ApiParam(value = "状态") @RequestParam Integer status, - @ApiParam(value = "门店id") @RequestParam Long shopId){ + public TableDataInfo<TechnicianSubscribeVO> list(@ApiParam(value = "状态") Integer status, + @ApiParam(value = "门店id") @RequestParam Long shopId) { startPage(); List<TechnicianSubscribeVO> list = technicianSubscribeService - .getTechnicianSubscribeByUserAndShop(SecurityUtils.getUserId(),shopId); + .getTechnicianSubscribeByUserAndShop(shopId,status); return getDataTable(list); + } + + /** + * 预约技师 + */ + @PostMapping("/subscribe") + @ApiOperation(value = "预约技师", notes = "预约技师", tags = {"小程序-个人中心-门店管理-预约列表"}) + public R<Void> subscribe(@RequestBody TechnicianSubscribe technicianSubscribe) { + technicianSubscribeService.subscribe(technicianSubscribe); + return R.ok(); } /** * 取消服务 */ @GetMapping("/cancel") - @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理-预约列表-取消服务"}) - public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id){ + @ApiOperation(value = "取消服务", notes = "取消服务", tags = {"小程序-个人中心-门店管理,小程序-个人中心-我的预约","门店-预约管理"}) + public R<Void> cancel(@ApiParam(value = "预约id") @RequestParam Long id) { TechnicianSubscribe subscribe = technicianSubscribeService.getOne(new LambdaQueryWrapper<TechnicianSubscribe>() .eq(TechnicianSubscribe::getId, id) .eq(TechnicianSubscribe::getStatus, 0)); - if (null == subscribe){ + if (null == subscribe) { return R.fail("不满足取消条件"); } subscribe.setStatus(2); @@ -66,5 +92,35 @@ return R.ok(); } + /** + * 更新技师预约状态 + * + * @param status + */ + @PutMapping("/updateStatus") + @ApiOperation(value = "更新技师预约状态", notes = "更新技师预约状态", tags = {"后台-技师预约管理-更新技师预约状态"}) + public R<Void> updateStatus(@ApiParam @RequestParam Integer status, @ApiParam @RequestParam Long subscribeId) { + boolean update = technicianSubscribeService.update(new LambdaUpdateWrapper<TechnicianSubscribe>() + .eq(TechnicianSubscribe::getId, subscribeId) + .set(TechnicianSubscribe::getStatus, status)); + if (!update) { + return R.fail("更新失败"); + } + return R.ok(); + } + + + @GetMapping("/home/list") + @ApiOperation(value = "列表", notes = "获取用户预约列表", tags = {"小程序-个人中心-我的预约"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "status", value = "状态 0=待服务,1=已服务,2=已取消, 4=已到期", required = true, dataType = "Integer", paramType = "query"), + @ApiImplicitParam(name = "current", value = "当前页码,从1开始", required = true, dataType = "Integer", paramType = "query"), + @ApiImplicitParam(name = "size", value = "每页显示数量,默认10", dataType = "Integer", paramType = "query") + }) + public R<IPage<TechnicianSubscribeVO>> homelist(@RequestParam(value = "status", required = false) @ApiParam(value = "状态 0=待服务,1=已服务,2=已取消 4 已到期") Integer status, + @ApiParam(hidden = true) Page<TechnicianSubscribe> page) { + return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status)); + } + } -- Gitblit v1.7.1