Commit 155ab080 authored by mengmeng's avatar mengmeng

Merge branch 'lings' into 'master'

4、预约详情接口 5、当前预约排队人数接口 6、现场签到接口

See merge request !2
parents cd69ad0f cff2199f
This diff is collapsed.
......@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -77,15 +78,21 @@ public class AppointmentOrderController {
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@RequiresPermissions("appointment:appointmentorder:update")
public Result update(@RequestBody AppointmentOrderDTO dto){
//校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
appointmentOrderService.update(dto);
@GetMapping(value = "/signin/{appointmentOrderId}")
@ApiOperation("签到")
@LogOperation("签到")
public Result update(@PathVariable(value = "appointmentOrderId") Long appointmentOrderId){
//根据appointmentOrderId获取到订单实体
AppointmentOrderDTO appointmentOrderDTO = appointmentOrderService.get(appointmentOrderId);
if (appointmentOrderDTO.getAppointmentTime().getTime() > new Date().getTime()) {
appointmentOrderDTO.setStatus(2);
appointmentOrderDTO.setStatusName("签到");
}
appointmentOrderService.update(appointmentOrderDTO);
return new Result();
}
......
......@@ -2,6 +2,7 @@ package io.hmit.modules.appointment.controller;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.DateUtils;
import io.hmit.common.utils.Result;
import io.hmit.common.validator.AssertUtils;
import io.hmit.common.validator.ValidatorUtils;
......@@ -56,7 +57,7 @@ public class AppointmentOrderController {
}
@GetMapping("{id}")
@ApiOperation("信息")
@ApiOperation("信息,预约详情接口")
public Result<AppointmentOrderDTO> get(@PathVariable("id") Long id){
AppointmentOrderDTO data = appointmentOrderService.get(id);
......@@ -108,6 +109,54 @@ public class AppointmentOrderController {
return new Result();
}
@GetMapping(value = "/signin/{appointmentOrderId}")
@ApiOperation("签到")
public Result signin(@PathVariable(value = "appointmentOrderId") Long appointmentOrderId){
//根据appointmentOrderId获取到订单实体
AppointmentOrderDTO appointmentOrderDTO = appointmentOrderService.get(appointmentOrderId);
//判断签到时间是否在预约时间前
if (appointmentOrderDTO.getAppointmentTime().getTime() > new Date().getTime()) {
appointmentOrderDTO.setStatus(2);
appointmentOrderDTO.setStatusName("签到");
appointmentOrderDTO.setUpdateDate(new Date());
appointmentOrderService.update(appointmentOrderDTO);
return new Result();
}else{
return new Result().error("预约时间已过,签到失败!");
}
}
@GetMapping(value = "/waitingNum/{appointmentOrderId}")
@ApiOperation("获取当前预约的排队人数")
public Result waitingNum (@PathVariable(value = "appointmentOrderId") Long appointmentOrderId){
//根据appointmentOrderId获取到订单实体
AppointmentOrderDTO appointmentOrderDTO = appointmentOrderService.get(appointmentOrderId);
//获取当前订单预约时间
Integer waitingNum = appointmentOrderService.waitingNum(DateUtils.format(appointmentOrderDTO.getAppointmentTime()));
return new Result().ok(waitingNum);
}
@GetMapping(value = "/serviceWaitingNum/{serviceId}")
@ApiOperation("获取当前事项的预约排队人数")
public Result serviceWaitingNum (@PathVariable(value = "serviceId") Long serviceId){
Integer serviceWaitingNum = appointmentOrderService.serviceWaitingNum(serviceId);
return new Result().ok(serviceWaitingNum);
}
@PutMapping
@ApiOperation("修改")
public Result update(@RequestBody AppointmentOrderDTO dto){
......
......@@ -5,6 +5,7 @@ import io.hmit.common.dao.BaseDao;
import io.hmit.modules.appointment.dto.AppointmentOrderDTO;
import io.hmit.modules.appointment.entity.AppointmentOrderEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 预约订单表
......@@ -16,5 +17,7 @@ import org.apache.ibatis.annotations.Mapper;
public interface AppointmentOrderDao extends BaseDao<AppointmentOrderEntity> {
IPage<AppointmentOrderDTO> getAppointmentInfo(IPage<AppointmentOrderEntity> page, String phone, String idCard);
Integer waitingNum(@Param("appointmentTime") String appointmentTime);
Integer serviceWaitingNum(@Param("serviceId") Long serviceId);
}
......@@ -17,4 +17,8 @@ public interface AppointmentOrderService extends CrudService<AppointmentOrderEnt
PageData<AppointmentOrderDTO> getAppointmentInfoPage(Map<String, Object> params, String identity);
Integer waitingNum (String appointmentTime);
Integer serviceWaitingNum (Long serviceId);
}
......@@ -62,4 +62,16 @@ public class AppointmentOrderServiceImpl extends CrudServiceImpl<AppointmentOrde
IPage<AppointmentOrderDTO> appointmentOrderDTOIPage = appointmentOrderDao.getAppointmentInfo(page, phone, idCard);
return getPageData(appointmentOrderDTOIPage, AppointmentOrderDTO.class);
}
@Override
public Integer waitingNum(String appointmentTime) {
return appointmentOrderDao.waitingNum(appointmentTime);
}
@Override
public Integer serviceWaitingNum(Long serviceId) {
return appointmentOrderDao.serviceWaitingNum(serviceId) ;
}
}
......@@ -42,4 +42,20 @@
</choose>
</select>
<select id="waitingNum" resultType="int">
SELECT count(*) FROM appointment_order where 1=1
<if test="appointmentTime != null and appointmentTime.trim() != ''">
and #{appointmentTime} >= appointmentTime
</if>
and status = 2
</select>
<select id="serviceWaitingNum" resultType="int">
SELECT count(*) FROM appointment_order where 1=1
<if test="serviceId != null ">
and service_id = #{serviceId}
</if>
and (status = 1 or status = 2)
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment