Commit bcb2760a by 吕明尚

换房新增历史订单

parent a360b3d0
......@@ -577,6 +577,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public Boolean changeRoom(SOrderDto dto) {
SOrder sOrder = getById(dto.getId());
SOrder oldSOrder = new SOrder();
LambdaQueryWrapper<SRoom> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SRoom::getStoreId, sOrder.getStoreId());
List<SRoom> list = roomService.list(queryWrapper);
BeanUtils.copyProperties(sOrder, oldSOrder);
LambdaQueryWrapper<SOrder> sOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
sOrderLambdaQueryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
sOrderLambdaQueryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
......@@ -619,8 +624,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sRoom.setStatus(RoomStatusEnum.HOLD.getValue());
roomService.updateById(sRoom);
}
sOrder.setRoomId(dto.getRoomId());
return updateById(sOrder);
sOrder.setIsDelete(YesNoEnum.yes.getIndex());
;
sOrder.setRemark("订单:" + sOrder.getOrderNo() + "由原来的" + list.stream().filter(item -> item.getId().equals(sOrder.getRoomId())).findFirst().orElse(null).getName()
+ "换到" + list.stream().filter(item -> item.getId().equals(dto.getRoomId())).findFirst().orElse(null).getName() + "房间");
sOrder.setCreateTime(new Date());
save(sOrder);
oldSOrder.setRoomId(dto.getRoomId());
return updateById(oldSOrder);
}
@Override
......
......@@ -84,6 +84,7 @@
<select id="selectSOrderList" parameterType="SOrder" resultMap="SOrderResult">
<include refid="selectSOrderVo"/>
where pay_status = 1
and is_delete = 0
<if test="orderNo != null and orderNo != ''">and order_no = #{orderNo}</if>
<if test="outTradeNo != null and outTradeNo != ''">and out_trade_no = #{outTradeNo}</if>
<if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
......
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