package com.panzhihua.service_community.api;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.panzhihua.common.model.dtos.community.CancelRecordDTO;
|
import com.panzhihua.common.model.dtos.community.OperationDetailDTO;
|
import com.panzhihua.common.model.dtos.community.PageUserReserveDTO;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.common.model.vos.community.ComActReserveCommitVO;
|
import com.panzhihua.service_community.dao.ComActReserveOperationRecordMapper;
|
import com.panzhihua.service_community.model.dos.ComActReserveOperationRecordDO;
|
import com.panzhihua.service_community.model.dos.ComActReserveRecordDO;
|
import com.panzhihua.service_community.service.ComActReserveOperationRecordService;
|
import com.panzhihua.service_community.service.ComActReserveRecordService;
|
import com.panzhihua.service_community.service.ComActReserveService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
|
/**
|
* 预约登记
|
*/
|
@Slf4j
|
@RestController
|
@RequestMapping("/reserve")
|
public class ComActReserveApi {
|
|
@Resource
|
private ComActReserveService comActReserveService;
|
@Resource
|
private ComActReserveRecordService comActReserveRecordService;
|
@Resource
|
private ComActReserveOperationRecordService comActReserveOperationRecordService;
|
/**
|
* 预约登记详情
|
* @param id
|
* @return
|
*/
|
@GetMapping("/detail")
|
public R detail(@RequestParam("id") Long id){
|
if(id!=null){
|
return R.ok(comActReserveService.getById(id));
|
}
|
return R.fail();
|
}
|
|
/**
|
* 小程序提交预约/登记
|
* @param comActReserveCommitVO
|
* @return
|
*/
|
@PostMapping("/commit")
|
public R commit(@RequestBody ComActReserveCommitVO comActReserveCommitVO){
|
return comActReserveService.commit(comActReserveCommitVO);
|
}
|
|
/**
|
* 我的预约/登记
|
* @param pageUserReserveDTO
|
* @return
|
*/
|
@PostMapping("/userReserveList")
|
public R userReserveList(@RequestBody PageUserReserveDTO pageUserReserveDTO){
|
return comActReserveService.pageReserveList(pageUserReserveDTO);
|
}
|
/**
|
* 取消预约/登记
|
*/
|
@PostMapping("/cancelReserve")
|
public R userCancelReserve(@RequestBody CancelRecordDTO cancelRecordDTO){
|
return comActReserveRecordService.cancel(cancelRecordDTO);
|
}
|
|
/**
|
* 预约详情操作记录
|
*/
|
@PostMapping("/detailOperation")
|
public R reserveOperation(@RequestBody OperationDetailDTO comActReserveOperationRecordDO){
|
if(comActReserveOperationRecordDO!=null){
|
QueryWrapper<ComActReserveOperationRecordDO> queryWrapper=new QueryWrapper<>();
|
if(comActReserveOperationRecordDO.getUserId()!=null){
|
queryWrapper.eq("user_id",comActReserveOperationRecordDO.getUserId());
|
}
|
if(comActReserveOperationRecordDO.getReserveRecordId()!=null){
|
queryWrapper.eq("reserve_record_id",comActReserveOperationRecordDO.getReserveRecordId());
|
}
|
if(comActReserveOperationRecordDO.getType()!=null){
|
queryWrapper.eq("type",comActReserveOperationRecordDO.getType());
|
}
|
queryWrapper.orderByDesc("reserve_time");
|
return R.ok(comActReserveOperationRecordService.list(queryWrapper));
|
}
|
return R.ok();
|
}
|
}
|