Commit 27c355a8 authored by mengmeng's avatar mengmeng

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOrderDTO.java
#	hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/PensionOrderService.java
#	hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/PensionOrderServiceImpl.java
parents cb445a4f 88afbe88
......@@ -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,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PensionOrderDao extends BaseDao<PensionOrderEntity> {
IPage<PensionOrderEntity> getAllOrderPage(IPage<PensionOrderEntity> page, Long userId);
IPage<PensionOrderDTO> getTodayNoProceedOrderPage(IPage<PensionOrderEntity> page);
IPage<PensionOrderEntity> getTodayOrderPage(IPage<PensionOrderEntity> page, Long userId);
IPage<PensionOrderEntity> getTodayNoProceedOrderPage(IPage<PensionOrderEntity> page);
IPage<PensionOrderEntity> getOrderPageByStatus(IPage<PensionOrderEntity> page, Long userId, Integer status);
IPage<PensionOrderEntity> getNoProceedOrderPage(IPage<PensionOrderEntity> page);
PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status);
PensionOrderEntity getOrderInfoByIdAndUserId(Long orderId, Long userId);
IPage<PensionOrderDTO> getOrderPageByStatusOrUserId(IPage<PensionOrderEntity> page, Long userId, Integer status);
PensionOrderEntity getOrderInfoByIdAndStatus(Long orderId, Integer status);
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ import java.util.UUID;
@Data
@ApiModel(value = "订单表")
public class PensionOrderDTO implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
......@@ -68,6 +68,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "接单人电话")
private String orderRecipientPhone;
@ApiModelProperty(value = "实际金额")
private String actPrice;
@ApiModelProperty(value = "部门ID")
private Long deptId;
......@@ -89,6 +92,9 @@ public class PensionOrderDTO implements Serializable {
@ApiModelProperty(value = "更新时间")
private Date updateDate;
@ApiModelProperty(value = "封面")
private String icon;
public PensionOrderDTO assemblePensionOrder(ReservationDTO reservationDTO, UserEntity user){
PensionOrderDTO pensionOrder = new PensionOrderDTO();
pensionOrder.setOrderNum("");
......
......@@ -75,6 +75,10 @@ public class PensionOrderEntity extends BaseEntity {
* 接单人电话
*/
private String orderRecipientPhone;
/**
* 实际金额
*/
private String actPrice;
/**
* 部门ID
*/
......
......@@ -22,25 +22,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询今日订单
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);
//查询预约订单详情
PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId);
//根据订单Id和订单状态查询
//根据订单Id和订单状态查询 (接单时使用)
PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);
//服务订单预约
......@@ -49,4 +31,7 @@ public interface PensionOrderService extends CrudService<PensionOrderEntity, Pen
//查询已完成订单
PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status);
//根据用户ID或订单状态查询(带图)
PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);
}
......@@ -28,11 +28,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");
......@@ -49,71 +44,24 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@Autowired
private PensionOrderServiceService pensionOrderServiceService;
//查询全部订单
@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);
}
@Override
public PensionOrderDTO getOrderInfoByIdAndUserId(Long id, Long userId) {
PensionOrderEntity orderEntity = pensionOrderDao.getOrderInfoByIdAndUserId(id, userId);
orderEntity.setServiceId(null);
orderEntity.setOrderRecipientId(null);
orderEntity.setDeptId(null);
orderEntity.setCreator(null);
orderEntity.setUpdater(null);
orderEntity.setUpdateDate(null);
return ConvertUtils.sourceToTarget(orderEntity, PensionOrderDTO.class);
IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getTodayNoProceedOrderPage(page);
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
}
//根据订单Id和订单状态查询 (接单时使用)
@Override
public PensionOrderDTO getOrderInfoByIdAndStatus(Long id, Integer status) {
PensionOrderEntity orderEntity = pensionOrderDao.getOrderInfoByIdAndStatus(id, status);
......@@ -132,9 +80,16 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
@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);
IPage<PensionOrderDTO> pensionOrderDTOIPage = pensionOrderDao.getOrderPageByStatusOrUserId(page, userId, status);
return getPageData(pensionOrderDTOIPage, PensionOrderDTO.class);
}
}
//根据用户ID或订单状态查询(带图)
@Override
public PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status) {
PensionOrderDTO pensionOrderDTO = pensionOrderDao.getOrderInfoByIdAndUserIdOrStatus(orderId, userId, status);
return pensionOrderDTO;
}
}
......@@ -28,32 +28,56 @@
<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 id="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
</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 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, po.act_price, 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="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 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, po.act_price, 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="getOrderInfoByIdAndStatus" resultType="io.hmit.modules.serviceOrder.entity.PensionOrderEntity">
SELECT * FROM pension_order WHERE pension_order.id = #{orderId} and pension_order.status = #{status}
<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, 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.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