package cn.stylefeng.guns.modular.business.controller;
|
|
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.util.StrUtil;
|
import cn.stylefeng.guns.modular.business.dto.CounsellingOrderReservationRequestDTO;
|
import cn.stylefeng.guns.modular.business.entity.CounsellingOrderReservation;
|
import cn.stylefeng.guns.modular.business.service.ICounsellingOrderReservationService;
|
import cn.stylefeng.guns.modular.business.service.ICounsellingOrderService;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.rule.annotation.BusinessLog;
|
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ErrorResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* 咨询订单预约记录管理类
|
* @author guo
|
*/
|
@RestController
|
@Api(tags = "咨询订单预约记录管理类")
|
@ApiResource(name = "咨询订单预约记录管理类", resBizType = ResBizTypeEnum.BUSINESS)
|
@RequestMapping("/business")
|
public class CounsellingOrderReservationController {
|
|
@Resource
|
private ICounsellingOrderReservationService counsellingOrderReservationService;
|
|
/**
|
* 添加咨询订单预约记录
|
*/
|
@ApiOperation("添加咨询订单预约记录")
|
@PostResource(name = "添加咨询订单预约记录", path = "/counsellingOrderReservation/add")
|
@BusinessLog
|
public ResponseData<?> add(@RequestBody CounsellingOrderReservation counsellingOrderReservation) {
|
this.counsellingOrderReservationService.save(counsellingOrderReservation);
|
return new SuccessResponseData<>();
|
}
|
|
/**
|
* 删除咨询订单预约记录
|
*/
|
@ApiOperation("删除咨询订单预约记录")
|
@PostResource(name = "删除咨询订单预约记录", path = "/counsellingOrderReservation/delete")
|
@BusinessLog
|
public ResponseData<?> delete(@RequestParam String ids) {
|
if (StrUtil.isBlank(ids)){
|
return new ErrorResponseData<>("500","id不能为空");
|
}
|
LambdaUpdateWrapper<CounsellingOrderReservation> lambdaUpdateWrapper = new LambdaUpdateWrapper<CounsellingOrderReservation>();
|
lambdaUpdateWrapper.in(CounsellingOrderReservation::getId, ListUtil.toList(ids.split(",")));
|
this.counsellingOrderReservationService.update(lambdaUpdateWrapper);
|
return new SuccessResponseData<>();
|
}
|
|
/**
|
* 修改咨询订单预约记录
|
*/
|
@ApiOperation("修改咨询订单预约记录")
|
@PostResource(name = "修改咨询订单预约记录", path = "/counsellingOrderReservation/edit")
|
@BusinessLog
|
public ResponseData<?> edit(@RequestBody CounsellingOrderReservation counsellingOrderReservation) {
|
this.counsellingOrderReservationService.updateById(counsellingOrderReservation);
|
return new SuccessResponseData<>();
|
}
|
|
|
|
@Autowired
|
private ICounsellingOrderService counsellingOrderService;
|
|
/**
|
* 修改咨询订单预约记录状态
|
*/
|
@ApiOperation("修改咨询订单预约记录状态 预约状态 1-待审批,2-待服务,3-服务中,4-已完成,5-已取消,6-已拒绝")
|
@PostResource(name = "修改咨询订单预约记录状态 预约状态 1-待审批,2-待服务,3-服务中,4-已完成,5-已取消,6-已拒绝", path = "/counsellingOrderReservation/updateStatus")
|
@BusinessLog
|
public ResponseData<?> updateStatus(String ids, Integer status,String remark) {
|
if (StrUtil.isBlank(ids)){
|
return new ErrorResponseData<>("500","id不能为空");
|
}
|
LambdaUpdateWrapper<CounsellingOrderReservation> lambdaUpdateWrapper = new LambdaUpdateWrapper<CounsellingOrderReservation>();
|
lambdaUpdateWrapper.in(CounsellingOrderReservation::getId, ListUtil.toList(ids.split(",")))
|
.set(CounsellingOrderReservation::getUpdateUser, LoginContext.me().getLoginUser().getUserId())
|
.set(CounsellingOrderReservation::getStauts,status)
|
.set(CounsellingOrderReservation::getRemark,remark);
|
this.counsellingOrderReservationService.update(lambdaUpdateWrapper);
|
|
|
|
|
|
return new SuccessResponseData<>();
|
}
|
|
/**
|
* 获取咨询订单预约记录详情
|
*/
|
@ApiOperation("获取咨询订单预约记录详情")
|
@GetResource(name = "获取咨询订单预约记录详情", path = "/counsellingOrderReservation/detail/{id}", requiredPermission = false)
|
public ResponseData<CounsellingOrderReservation> detail(@PathVariable("id") Long id) {
|
CounsellingOrderReservation counsellingOrderReservation = this.counsellingOrderReservationService.getById(id);
|
return new SuccessResponseData<>(counsellingOrderReservation);
|
}
|
|
/**
|
* 获取咨询订单预约记录列表
|
*
|
*/
|
@ApiOperation("获取咨询订单预约记录列表")
|
@GetResource(name = "获取咨询订单预约记录列表", path = "/counsellingOrderReservation/list", requiredPermission = false)
|
public ResponseData<List<CounsellingOrderReservation>> list(CounsellingOrderReservation counsellingOrderReservation) {
|
LambdaQueryWrapper<CounsellingOrderReservation> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingOrderReservation>()
|
.orderByDesc(CounsellingOrderReservation::getId);
|
return new SuccessResponseData<>(counsellingOrderReservationService.list(lambdaQueryWrapper));
|
}
|
|
/**
|
* 获取咨询订单预约记录列表(分页)
|
*/
|
@ApiOperation("查看日程(分页)")
|
@GetResource(name = "查看日程(分页)", path = "/counsellingOrderReservation/page", requiredPermission = false)
|
public ResponseData<PageResult<CounsellingOrderReservation>> page(CounsellingOrderReservationRequestDTO counsellingOrderReservationRequestDTO) {
|
Page<CounsellingOrderReservation> page = this.counsellingOrderReservationService.findPage(PageFactory.defaultPage(), counsellingOrderReservationRequestDTO);
|
return new SuccessResponseData<>(PageResultFactory.createPageResult(page));
|
}
|
|
}
|