Commit bb9eb9b5 authored by mlchun's avatar mlchun

订单接口更新,表查询更改

parent f5bb3fe9
......@@ -27,7 +27,7 @@ public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com")
// .host("byyl.zjhmit.com")
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,才生成接口文档
......
......@@ -2,6 +2,7 @@ package io.hmit.modules.serviceOrder.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import org.apache.ibatis.annotations.Mapper;
......@@ -14,18 +15,16 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
IPage<PensionOrderEntity> getAllOrderPage(IPage<PensionOrderEntity> page, Long userId);
IPage<PensionOrderEntity> getTodayOrderPage(IPage<PensionOrderEntity> page, Long userId);
IPage<PensionOrderEntity> getTodayNoProceedOrderPage(IPage<PensionOrderEntity> page);
IPage<PensionOrderDTO> getTodayNoProceedOrderPage(IPage<PensionOrderEntity> page);
IPage<PensionOrderEntity> getOrderPageByStatus(IPage<PensionOrderEntity> page, Long userId, Integer status);
IPage<PensionOrderEntity> getNoProceedOrderPage(IPage<PensionOrderEntity> page);
PensionOrderEntity getOrderInfoByIdAndUserId(Long orderId, Long userId);
PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status);
IPage<PensionOrderDTO> getOrderPageByStatusOrUserId(IPage<PensionOrderEntity> page, Long userId, Integer status);
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
}
\ No newline at end of file
......@@ -85,5 +85,7 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "封面")
private String icon;
}
......@@ -3,7 +3,6 @@ package io.hmit.modules.serviceOrder.service;
import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import java.util.Map;
......@@ -20,32 +19,18 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId);
//查询今日订单
PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params, Long userId);
//查询未完成订单
PageData<PensionOrderDTO> getIncompleteOrderPage(Map<String, Object> params, Long userId);
//查询已接单订单
PageData<PensionOrderDTO> getTakingOrderPage(Map<String, Object> params, Long userId);
//查询已完成订单
PageData<PensionOrderDTO> getFinishedOrderPage(Map<String, Object> params, Long userId);
//查询已取消订单
PageData<PensionOrderDTO> getCanceledOrderPage(Map<String, Object> params, Long userId);
//查询未接单订单
PageData<PensionOrderDTO> getNoProceedOrderPage(Map<String, Object> params);
PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params);
//查询预约订单详情
PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId);
//根据订单Id和订单状态查询
//根据订单Id和订单状态查询 (接单时使用)
PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);
void reservation(ReservationDTO reservationDTO);
//查询已完成订单
PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status);
}
//根据用户ID或订单状态查询(带图)
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.serviceOrder.dao.PensionOrderDao;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.ReservationDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;
import io.hmit.modules.serviceOrder.service.PensionOrderService;
import org.apache.commons.lang3.StringUtils;
......@@ -26,11 +25,6 @@ import java.util.Map;
@Service
public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, PensionOrderEntity, PensionOrderDTO> implements PensionOrderService {
private static final Integer INCOMPLETE_ORDER = 0;
private static final Integer TAKING_ORDER = 1;
private static final Integer FINISHED_ORDER = 2;
private static final Integer CANCELED_ORDER = 3;
@Override
public QueryWrapper<PensionOrderEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
......@@ -46,55 +40,17 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Override
public PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId) {
//分页
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
//查询 -- 自定义分页
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getAllOrderPage(page, userId);
IPage<PensionOrderDTO> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatusOrUserId(page, userId, null);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params, Long userId) {
public PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
// IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getTodayOrderPage(page, userId); //TODO 今日订单中展示未接单订单
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getTodayNoProceedOrderPage(page);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getIncompleteOrderPage(Map<String, Object> params, Long userId) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, INCOMPLETE_ORDER);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getTakingOrderPage(Map<String, Object> params, Long userId) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, TAKING_ORDER);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getFinishedOrderPage(Map<String, Object> params, Long userId) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, FINISHED_ORDER);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getCanceledOrderPage(Map<String, Object> params, Long userId) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, CANCELED_ORDER);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getNoProceedOrderPage(Map<String, Object> params) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getNoProceedOrderPage(page);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getTodayNoProceedOrderPage(page);
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
}
@Override
......@@ -116,17 +72,17 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
}
@Override
public void reservation(ReservationDTO reservationDTO) {
public PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getOrderPageByStatusOrUserId(page, userId, status);
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
}
@Override
public PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status) {
IPage<PensionOrderEntity> page = getPage(params, Constant.CREATE_DATE, false);
IPage<PensionOrderEntity> pensionOrderEntityIPage = pensionOrderDao.getOrderPageByStatus(page, userId, status);
return getPageData(pensionOrderEntityIPage, PensionOrderDTO.class);
public PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status) {
PensionOrderDTO pensionOrderDTO = pensionOrderDao.getOrderInfoByIdAndUserIdOrStatus(orderId, userId, status);
return pensionOrderDTO;
}
}
}
\ No newline at end of file
......@@ -28,26 +28,10 @@
<result property="updateDate" column="update_date"/>
</resultMap>
<select id="getAllOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE order_recipient_id = #{userId}
</select>
<select id="getTodayOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE TO_DAYS(appointment_time) = TO_DAYS(NOW()) and order_recipient_id = #{userId}
</select>
<select id="getTodayNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE TO_DAYS(appointment_time) = TO_DAYS(NOW()) AND pension_order.status = 0 AND order_recipient_id IS NULL
</select>
<select id="getOrderPageByStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.status = #{status} and order_recipient_id = #{userId}
</select>
<select id="getNoProceedOrderPage" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.status = 0 AND order_recipient_id IS NULL
</select>
<select id="getOrderInfoByIdAndUserId" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.order_recipient_id = #{userId}
</select>
......@@ -56,4 +40,52 @@
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
</select>
<select id="getOrderPageByStatusOrUserId" 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, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id
<if test="status != null and status == 0">
<if test="userId != null">
and order_recipient_id is null
</if>
and po.status = 0
</if>
<if test="status != null and status != 0">
<if test="userId != null">
and order_recipient_id = #{userId}
</if>
and po.status = #{status}
</if>
<if test="status == null and userId != null">
and order_recipient_id = #{userId}
</if>
</select>
<select id="getOrderInfoByIdAndUserIdOrStatus" 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, ps.icon
from pension_order po, pension_service ps
where po.service_id = ps.id and po.id = #{orderId}
<if test="userId != null">
and po.order_recipient_id = #{userId}
</if>
<if test="status != null">
and po.status = #{status}
</if>
</select>
<select id="getTodayNoProceedOrderPage" 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, 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.status = 0 and order_recipient_id IS NULL
</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