Commit 6e446a2b authored by mlchun's avatar mlchun

添加老人的今日订单、全部订单、根据状态查询订单接口

parent 3670ce25
......@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
......@@ -53,25 +54,29 @@ public class PensionOrderController {
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
// @Login
// @GetMapping("todayOrderPage")
// @ApiOperation("今日订单分页(未接单)")
// @ApiImplicitParams({
// @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
// @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
// @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
// @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
// })
// public Result<PageData<PensionOrderDTO>> todayOrderPage(@ApiIgnore @LoginUser UserEntity user,
// @ApiIgnore @RequestParam Map<String, Object> params){
// PageData<PensionOrderDTO> page = pensionOrderService.getTodayOrderPage(params, user.getId());
//
// return new Result<PageData<PensionOrderDTO>>().ok(page);
// }
@Login
@GetMapping("getElderAllOrderOrByStatusList")
@ApiOperation("全部/根据状态返回订单(老人)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "status", value = "订单状态: 0未接单 1已接单 2已完成 3已取消", paramType = "query", dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<PensionOrderDTO>> getElderAllOrderOrByStatusList(@ApiIgnore @LoginUser UserEntity creator,
@ApiIgnore @RequestParam Map<String, Object> params){
Integer status = null;
if (null != params.get("status")) {
status = Integer.parseInt(params.get("status").toString());
}
PageData<PensionOrderDTO> page = pensionOrderService.getElderAllOrderOrByStatusPage(params, creator.getId(), status);
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
@Login
@GetMapping("getOrderPageByStatus")
@ApiOperation(value = "根据状态返回订单(带图片)", notes = "不能查看未接单订单")
@ApiOperation(value = "根据状态返回订单(志愿者)", notes = "不能查看未接单订单")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
......@@ -87,7 +92,7 @@ public class PensionOrderController {
@Login
@GetMapping("getTodayOrderPageWithCover")
@ApiOperation("今日订单(带图片)")
@ApiOperation("今日订单(志愿者)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
......@@ -100,25 +105,24 @@ public class PensionOrderController {
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
// @Login
// @GetMapping("todayOrderPage")
// @ApiOperation("今日订单分页(未接单)")
// @ApiImplicitParams({
// @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
// @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
// @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
// @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
// })
// public Result<PageData<PensionOrderDTO>> todayOrderPage(@ApiIgnore @LoginUser UserEntity user,
// @ApiIgnore @RequestParam Map<String, Object> params){
// PageData<PensionOrderDTO> page = pensionOrderService.getTodayOrderPage(params, user.getId());
//
// return new Result<PageData<PensionOrderDTO>>().ok(page);
// }
@Login
@GetMapping("getElderTodayOrderPage")
@ApiOperation("今日订单(老人)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
public Result<PageData<PensionOrderDTO>> getElderTodayOrderPage(@ApiIgnore @LoginUser UserEntity creator,
@ApiIgnore @RequestParam Map<String, Object> params){
PageData<PensionOrderDTO> page = pensionOrderService.getElderTodayOrderPage(params, creator.getId());
return new Result<PageData<PensionOrderDTO>>().ok(page);
}
@Login
@GetMapping("orderInfo/{id}")
@ApiOperation("预约订单详情(带图片)")
@ApiOperation("预约订单详情(志愿者)")
public Result<PensionOrderDTO> getOrderInfo(@ApiIgnore @LoginUser UserEntity user,
@PathVariable("id") Long id){
PensionOrderDTO data = pensionOrderService.getOrderInfoByIdAndUserIdOrStatus(id, null, null);
......@@ -127,7 +131,7 @@ public class PensionOrderController {
@Login
@PutMapping("takingOrder/{id}")
@ApiOperation("接单")
@ApiOperation("接单(志愿者)")
public Result takingOrder(@ApiIgnore @LoginUser UserEntity user,
@PathVariable("id") Long id){
PensionOrderDTO pensionOrderDTO = pensionOrderService.getOrderInfoByIdAndStatus(id, Constant.OrderStatus.BOOKED.geStatus());
......
......@@ -2,10 +2,14 @@ package io.hmit.modules.serviceOrder.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.dao.BaseDao;
import io.hmit.common.page.PageData;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 订单表
*
......@@ -15,6 +19,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
/**
* 志愿者:今日订单接单接口
* @param page
* @return
*/
IPage<PensionOrderDTO> getTodayNoProceedOrderPage(IPage<PensionOrderEntity> page);
PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status);
......@@ -23,4 +32,21 @@ public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
/**
* 老人:今日订单
* @param page
* @param creator
* @return
*/
IPage<PensionOrderDTO> getElderTodayOrderPage(IPage<PensionOrderEntity> page, Long creator);
/**
* 老人:全部订单
* @param params
* @param creator
* @return
*/
List<PensionOrderDTO> getElderAllOrderOrByStatusList(Map<String, Object> params, Long creator, Integer status);
}
......@@ -33,4 +33,10 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//根据用户ID或订单状态查询(带图)
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
//老人今日订单
PageData<PensionOrderDTO> getElderTodayOrderPage(Map<String, Object> params, Long creator);
//老人全部订单或根据订单状态查询
PageData<PensionOrderDTO> getElderAllOrderOrByStatusPage(Map<String, Object> params, Long creator, Integer status);
}
......@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -91,5 +92,18 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
return pensionOrderDTO;
}
@Override
public PageData<PensionOrderDTO> getElderTodayOrderPage(Map<String, Object> params, Long creator) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getElderTodayOrderPage(page, creator);
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getElderAllOrderOrByStatusPage(Map<String, Object> params, Long creator, Integer status) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
List<PensionOrderDTO> list = pensionOrderDao.getElderAllOrderOrByStatusList(params, creator, status);
return getPageData(list, page.getTotal(), PensionOrderDTO.class);
}
}
......@@ -80,4 +80,25 @@
where po.service_id = ps.id and TO_DAYS(appointment_time) = TO_DAYS(NOW()) and po.status = 0 and order_recipient_id IS NULL
</select>
<select id="getElderTodayOrderPage" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and TO_DAYS(appointment_time) = TO_DAYS(NOW()) and po.creator = #{creator}
</select>
<select id="getElderAllOrderOrByStatusList" resultType="io.hmit.modules.serviceOrder.dto.PensionOrderDTO">
select po.id, po.order_num, po.status, po.status_name, po.address, po.service_id, po.service_name,
po.appointment_person, po.appointment_phone, po.appointment_time, po.remark, po.order_recipient_id,
po.order_recipient_name, po.order_recipient_phone, po.dept_id, po.creator, po.creator_name,
po.creator_tel, po.create_date, po.update_date, po.act_price, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and po.creator = #{creator}
<if test="status != null">
and po.status = #{status}
</if>
</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