| | |
| | | "AND scenic_name IS NOT NULL AND scenic_name <> '' ORDER BY scenic_name") |
| | | List<String> selectGuideEarningScenics(Long guideId); |
| | | |
| | | @Select("SELECT id FROM tour_order WHERE deleted = 0 AND status = 'COMPLETED' " + |
| | | "AND settled_at IS NULL AND settlement_due_at IS NOT NULL " + |
| | | "AND settlement_due_at <= #{now} AND guide_id IS NOT NULL " + |
| | | "AND guide_earning_amount IS NOT NULL " + |
| | | "AND (refund_status IS NULL OR refund_status <> 'REFUNDED') " + |
| | | "ORDER BY settlement_due_at, id LIMIT #{limit}") |
| | | List<Long> selectDueSettlementIds(@Param("now") LocalDateTime now, @Param("limit") int limit); |
| | | |
| | | @Update("UPDATE tour_order SET status = 'COMPLETED', completed_at = #{completedAt}, " + |
| | | "settlement_due_at = TIMESTAMPADD(DAY, COALESCE(settlement_days, 1), #{completedAt}), " + |
| | | "updated_at = NOW() WHERE guide_id = #{guideId} AND receiving_session_id = #{sessionId} " + |
| | | "AND deleted = 0 AND status = 'IN_SERVICE'") |
| | | int completeSessionOrders(@Param("guideId") Long guideId, |
| | | @Param("sessionId") Long sessionId, |
| | | @Param("completedAt") LocalDateTime completedAt); |
| | | |
| | | @Update("UPDATE tour_order SET status = 'CANCELLED', refund_status = 'REFUNDING', updated_at = NOW() " + |
| | | "WHERE id = #{id} AND deleted = 0 AND status = 'PENDING_ACCEPT' " + |
| | | "AND payment_time IS NOT NULL AND (refund_status IS NULL OR refund_status = 'NONE')") |