| | |
| | | List<Map<String, Object>> rows = query(""" |
| | | select o.id, o.order_no, o.talent_id, tu.name as talent_name, tu.mobile as talent_mobile, |
| | | o.card_id, tc.card_no, tc.card_level, o.benefit_id, b.benefit_name, |
| | | o.merchant_id, m.merchant_name, o.store_id, o.order_type, |
| | | o.merchant_id, m.merchant_name, m.merchant_type, m.contact_mobile, |
| | | m.cover_url as merchant_cover_url, o.store_id, o.order_type, |
| | | o.order_amount, o.subsidy_amount, o.pay_amount, o.order_status, |
| | | o.verify_status, o.created_at, o.updated_at |
| | | from benefit_order o |
| | |
| | | if (rows.isEmpty()) { |
| | | throw new BusinessException(ErrorCode.NOT_FOUND, "订单不存在"); |
| | | } |
| | | return rows.get(0); |
| | | Map<String, Object> detail = rows.get(0); |
| | | List<Map<String, Object>> verificationRows = query(""" |
| | | select verify_time |
| | | from verify_record |
| | | where order_id = ? |
| | | order by id desc limit 1 |
| | | """, detail.get("id")); |
| | | detail.put("verifyTime", verificationRows.isEmpty() ? null : verificationRows.get(0).get("verifyTime")); |
| | | detail.put("items", List.of(Map.of( |
| | | "id", detail.get("benefitId") == null ? "-" : String.valueOf(detail.get("benefitId")), |
| | | "name", detail.get("benefitName") == null ? "-" : detail.get("benefitName"), |
| | | "coverUrl", detail.get("merchantCoverUrl") == null ? "" : detail.get("merchantCoverUrl"), |
| | | "amount", detail.get("orderAmount") == null ? 0 : detail.get("orderAmount") |
| | | ))); |
| | | detail.put("payments", query(""" |
| | | select payment_no, provider, amount, status, provider_transaction_no, paid_at, created_at |
| | | from payment_transaction |
| | | where order_no = ? |
| | | order by id desc |
| | | """, orderNo)); |
| | | detail.put("refunds", query(""" |
| | | select refund_no, provider, paid_amount, refund_amount, refundable_amount, |
| | | refund_status, reason, provider_refund_no, refund_time, created_at |
| | | from order_refund |
| | | where deleted = 0 and order_no = ? |
| | | order by id desc |
| | | """, orderNo)); |
| | | return detail; |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |