From 87a8778ce2574a66846dbdb6ba91930c298e9e32 Mon Sep 17 00:00:00 2001 From: Iamasoldier <1272745473@qq.com> Date: Tue, 15 Apr 2025 11:40:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=88=86=E6=B6=A6=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0=EF=BC=8C?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ProfitSharingController.java | 14 ++ .../central/order/mapper/DashboardMapper.java | 8 +- .../order/mapper/ProfitSharingMapper.java | 34 ++++ .../model/vo/ProfitSharingStatisticsVO.java | 56 ++++++ .../order/service/IProfitSharingService.java | 3 + .../service/impl/DashboardServiceImpl.java | 6 +- .../impl/ProfitSharingServiceImpl.java | 68 +++++++ .../src/main/frontend/config/proxy.ts | 32 ++-- .../src/main/frontend/config/routes.ts | 10 +- .../src/pages/orders/ProfitSharing/Detail.tsx | 106 +++++++++++ .../orders/ProfitSharing/Statistics.less | 35 ++++ .../pages/orders/ProfitSharing/Statistics.tsx | 175 ++++++++++++++++++ .../orders/Qrcode/components/UpdateForm.tsx | 43 ++++- .../src/pages/orders/Qrcode/index.less | 23 +++ .../src/pages/orders/Qrcode/index.tsx | 88 +++++++++ .../main/frontend/src/services/orders/api.ts | 38 ++++ .../frontend/src/services/orders/typings.d.ts | 29 +++ 17 files changed, 743 insertions(+), 25 deletions(-) create mode 100644 zlt-business/order-center/src/main/java/com/central/order/model/vo/ProfitSharingStatisticsVO.java create mode 100644 zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Detail.tsx create mode 100644 zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.less create mode 100644 zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.tsx diff --git a/zlt-business/order-center/src/main/java/com/central/order/controller/ProfitSharingController.java b/zlt-business/order-center/src/main/java/com/central/order/controller/ProfitSharingController.java index 78e51a75..bf810ed2 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/controller/ProfitSharingController.java +++ b/zlt-business/order-center/src/main/java/com/central/order/controller/ProfitSharingController.java @@ -3,11 +3,13 @@ package com.central.order.controller; import com.central.common.model.PageResult; import com.central.common.model.Result; import com.central.order.model.ProfitSharing; +import com.central.order.model.vo.ProfitSharingStatisticsVO; import com.central.order.service.IProfitSharingService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Map; @@ -45,4 +47,16 @@ public class ProfitSharingController { return Result.failed("分账执行失败:" + e.getMessage()); } } + + @Operation(summary = "获取分账统计数据") + @GetMapping("/statistics") + public Result getStatistics() { + try { + ProfitSharingStatisticsVO statistics = profitSharingService.getStatistics(); + return Result.succeed(statistics); + } catch (Exception e) { + log.error("获取分账统计数据失败", e); + return Result.failed("获取统计数据失败"); + } + } } \ No newline at end of file diff --git a/zlt-business/order-center/src/main/java/com/central/order/mapper/DashboardMapper.java b/zlt-business/order-center/src/main/java/com/central/order/mapper/DashboardMapper.java index a14f1893..3f066ce6 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/mapper/DashboardMapper.java +++ b/zlt-business/order-center/src/main/java/com/central/order/mapper/DashboardMapper.java @@ -45,16 +45,16 @@ public interface DashboardMapper { }) Long getTodayIncome(); - @Select("SELECT COUNT(*) FROM waylines WHERE is_del = 0") + @Select("SELECT COUNT(*) FROM device-center.wayline_file WHERE is_del = 0") Long getTotalWaylines(); - @Select("SELECT COUNT(*) FROM waylines WHERE is_del = 0 AND last_use_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)") + @Select("SELECT COUNT(*) FROM device-center.wayline_file WHERE is_del = 0 AND last_use_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)") Long getActiveWaylines(); - @Select("SELECT COUNT(*) FROM devices WHERE is_del = 0") + @Select("SELECT COUNT(*) FROM device-center.manage_device WHERE is_del = 0") Long getTotalDevices(); - @Select("SELECT COUNT(*) FROM devices WHERE is_del = 0 AND status = 1") + @Select("SELECT COUNT(*) FROM device-center.manage_device WHERE is_del = 0 AND status = 1") Long getOnlineDevices(); @Select({ diff --git a/zlt-business/order-center/src/main/java/com/central/order/mapper/ProfitSharingMapper.java b/zlt-business/order-center/src/main/java/com/central/order/mapper/ProfitSharingMapper.java index a0115da5..1380b9b3 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/mapper/ProfitSharingMapper.java +++ b/zlt-business/order-center/src/main/java/com/central/order/mapper/ProfitSharingMapper.java @@ -3,7 +3,41 @@ package com.central.order.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.central.order.model.ProfitSharing; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; +import java.util.Map; @Mapper public interface ProfitSharingMapper extends BaseMapper { + // 获取总体统计 + @Select("SELECT " + + "COUNT(*) as total_count, " + + "SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as success_count, " + + "SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as fail_count, " + + "SUM(qrcode_amount) as total_amount " + + "FROM profit_sharing") + Map getTotalStatistics(); + + // 获取每日金额趋势 + @Select("SELECT " + + "DATE_FORMAT(create_time, '%Y-%m-%d') as date, " + + "'DAY' as type, " + + "SUM(qrcode_amount) as amount " + + "FROM profit_sharing " + + "WHERE create_time >= #{startTime} " + + "GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')") + List> getDailyAmountTrend(@Param("startTime") Date startTime); + + // 获取每日成功率 + @Select("SELECT " + + "DATE_FORMAT(create_time, '%Y-%m-%d') as date, " + + "'DAY' as type, " + + "ROUND(SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 2) as value " + + "FROM profit_sharing " + + "WHERE create_time >= #{startTime} " + + "GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d')") + List> getDailySuccessRate(@Param("startTime") Date startTime); } \ No newline at end of file diff --git a/zlt-business/order-center/src/main/java/com/central/order/model/vo/ProfitSharingStatisticsVO.java b/zlt-business/order-center/src/main/java/com/central/order/model/vo/ProfitSharingStatisticsVO.java new file mode 100644 index 00000000..077c906b --- /dev/null +++ b/zlt-business/order-center/src/main/java/com/central/order/model/vo/ProfitSharingStatisticsVO.java @@ -0,0 +1,56 @@ +package com.central.order.model.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.Builder; + +import java.util.List; + +@Data +@Builder +@Schema(description = "分账统计数据") +public class ProfitSharingStatisticsVO { + @Schema(description = "总分账笔数") + private Long totalCount; + + @Schema(description = "成功笔数") + private Long successCount; + + @Schema(description = "失败笔数") + private Long failCount; + + @Schema(description = "总分账金额(分)") + private Long totalAmount; + + @Schema(description = "金额趋势数据") + private List amountTrend; + + @Schema(description = "成功率数据") + private List successRate; + + @Data + @Builder + public static class TrendData { + @Schema(description = "日期") + private String date; + + @Schema(description = "类型(DAY-日,WEEK-周,MONTH-月)") + private String type; + + @Schema(description = "金额(分)") + private Long amount; + } + + @Data + @Builder + public static class RateData { + @Schema(description = "日期") + private String date; + + @Schema(description = "类型(DAY-日,WEEK-周,MONTH-月)") + private String type; + + @Schema(description = "成功率(0-100)") + private Double value; + } +} \ No newline at end of file diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/IProfitSharingService.java b/zlt-business/order-center/src/main/java/com/central/order/service/IProfitSharingService.java index de0fce4d..f58914a9 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/IProfitSharingService.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/IProfitSharingService.java @@ -6,6 +6,7 @@ import com.central.order.model.Order; import com.central.order.model.ProfitSharing; import com.central.order.model.ProfitSharingResult; import com.central.order.model.QrCode; +import com.central.order.model.vo.ProfitSharingStatisticsVO; import java.util.Map; @@ -54,4 +55,6 @@ public interface IProfitSharingService extends ISuperService { * 查询分账状态 */ ProfitSharingResult queryProfitSharingStatus(String orderNo); + + ProfitSharingStatisticsVO getStatistics(); } diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/DashboardServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/DashboardServiceImpl.java index 5a4d5fc6..18236306 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/DashboardServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/DashboardServiceImpl.java @@ -29,10 +29,10 @@ public class DashboardServiceImpl implements IDashboardService { statistics.setIncomeStats(getIncomeStatistics()); // 3. 获取航线统计 - statistics.setWaylineStats(getWaylineStatistics()); +// statistics.setWaylineStats(getWaylineStatistics()); // 4. 获取设备统计 - statistics.setDeviceStats(getDeviceStatistics()); +// statistics.setDeviceStats(getDeviceStatistics()); // 5. 获取图表统计 statistics.setChartStats(getChartStatistics()); @@ -156,7 +156,7 @@ public class DashboardServiceImpl implements IDashboardService { stats.setOrderTrend(dashboardMapper.getOrderTrend()); // 获取设备分布 - stats.setDeviceDistribution(dashboardMapper.getDeviceDistribution()); +// stats.setDeviceDistribution(dashboardMapper.getDeviceDistribution()); // 获取收入构成 stats.setIncomeData(dashboardMapper.getIncomeData()); diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/ProfitSharingServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/ProfitSharingServiceImpl.java index 0c56a092..f9fa6475 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/ProfitSharingServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/ProfitSharingServiceImpl.java @@ -14,6 +14,7 @@ import com.central.order.model.Order; import com.central.order.model.ProfitSharing; import com.central.order.model.ProfitSharingResult; import com.central.order.model.QrCode; +import com.central.order.model.vo.ProfitSharingStatisticsVO; import com.central.order.service.IProfitSharingService; import com.central.order.service.IQrCodeService; import com.wechat.pay.java.service.profitsharing.ProfitsharingService; @@ -21,6 +22,7 @@ import com.wechat.pay.java.service.profitsharing.model.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; @@ -59,6 +61,9 @@ public class ProfitSharingServiceImpl extends SuperServiceImpl totalStats = profitSharingMapper.getTotalStatistics(); + + // 2. 获取最近30天的数据 + Date startTime = DateUtils.addDays(new Date(), -30); + + // 3. 获取趋势数据 + List> dailyTrend = profitSharingMapper.getDailyAmountTrend(startTime); + List amountTrend = convertToTrendData(dailyTrend); + + // 4. 获取成功率数据 + List> dailyRate = profitSharingMapper.getDailySuccessRate(startTime); + List successRate = convertToRateData(dailyRate); + + // 5. 构建返回数据 + return ProfitSharingStatisticsVO.builder() + .totalCount(getLongValue(totalStats, "total_count")) + .successCount(getLongValue(totalStats, "success_count")) + .failCount(getLongValue(totalStats, "fail_count")) + .totalAmount(getLongValue(totalStats, "total_amount")) + .amountTrend(amountTrend) + .successRate(successRate) + .build(); + + } catch (Exception e) { + log.error("获取分账统计数据失败", e); + throw new BusinessException("获取统计数据失败"); + } + } + + private List convertToTrendData(List> dailyTrend) { + return dailyTrend.stream() + .map(map -> ProfitSharingStatisticsVO.TrendData.builder() + .date(String.valueOf(map.get("date"))) + .type(String.valueOf(map.get("type"))) + .amount(getLongValue(map, "amount")) + .build()) + .collect(Collectors.toList()); + } + + private List convertToRateData(List> dailyRate) { + return dailyRate.stream() + .map(map -> ProfitSharingStatisticsVO.RateData.builder() + .date(String.valueOf(map.get("date"))) + .type(String.valueOf(map.get("type"))) + .value(getDoubleValue(map, "value")) + .build()) + .collect(Collectors.toList()); + } + + private Long getLongValue(Map map, String key) { + Object value = map.get(key); + return value == null ? 0L : Long.valueOf(String.valueOf(value)); + } + + private Double getDoubleValue(Map map, String key) { + Object value = map.get(key); + return value == null ? 0.0 : Double.valueOf(String.valueOf(value)); + } } diff --git a/zlt-web/react-web/src/main/frontend/config/proxy.ts b/zlt-web/react-web/src/main/frontend/config/proxy.ts index 61b5280f..2b8d0a36 100644 --- a/zlt-web/react-web/src/main/frontend/config/proxy.ts +++ b/zlt-web/react-web/src/main/frontend/config/proxy.ts @@ -9,43 +9,43 @@ export default { dev: { '/api-uaa/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-user/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-log/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-search/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-generator/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-file/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-order/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, '/api-device/': { - target: 'http://119.45.169.13:9900', - // target: 'http://127.0.0.1:9900', + // target: 'http://119.45.169.13:9900', + target: 'http://127.0.0.1:9900', changeOrigin: true, }, }, diff --git a/zlt-web/react-web/src/main/frontend/config/routes.ts b/zlt-web/react-web/src/main/frontend/config/routes.ts index a1e59757..331c9695 100644 --- a/zlt-web/react-web/src/main/frontend/config/routes.ts +++ b/zlt-web/react-web/src/main/frontend/config/routes.ts @@ -103,7 +103,15 @@ { path: '/orders/statistics.html', component: './orders/statistics', - } + }, + { + path: '/orders/profitSharing.html', + component: './orders/ProfitSharing', + }, + { + path: '/orders/profit-sharing/statistics.html', + component: './orders/ProfitSharing/Statistics', + }, ], }, { diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Detail.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Detail.tsx new file mode 100644 index 00000000..ddb7b695 --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Detail.tsx @@ -0,0 +1,106 @@ +import { PageContainer, ProDescriptions } from '@ant-design/pro-components'; +import { Card, Divider, Button, message } from 'antd'; +import React, { useEffect, useState } from 'react'; +import { useParams, history } from 'umi'; +import { getProfitSharingDetail, executeProfitSharing } from '@/services/orders/api'; + +const ProfitSharingDetail: React.FC = () => { + const { orderNo } = useParams<{ orderNo: string }>(); + const [loading, setLoading] = useState(false); + const [detail, setDetail] = useState(); + + const fetchDetail = async () => { + setLoading(true); + try { + const result = await getProfitSharingDetail(orderNo); + if (result.resp_code === 0) { + setDetail(result.data); + } + } catch (error) { + message.error('获取详情失败'); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchDetail(); + }, [orderNo]); + + const handleExecute = async () => { + try { + const result = await executeProfitSharing(orderNo); + if (result.resp_code === 0) { + message.success('分账执行成功'); + fetchDetail(); + } else { + message.error(result.resp_msg || '分账执行失败'); + } + } catch (error) { + message.error('分账执行失败'); + } + }; + + return ( + history.goBack()} + extra={ + detail?.status === 3 && detail?.retryTimes < 3 && ( + + ) + } + > + + + {detail?.orderNo} + {detail?.transactionId} + + ¥{detail?.totalAmount ? (detail.totalAmount / 100).toFixed(2) : '-'} + + {detail?.createTime} + + + + + + + {STATUS_MAP[detail?.status]?.text} + + {detail?.profitSharingId} + + ¥{detail?.platformAmount ? (detail.platformAmount / 100).toFixed(2) : '-'} + + + ¥{detail?.qrCodeAmount ? (detail.qrCodeAmount / 100).toFixed(2) : '-'} + + + ¥{detail?.receiverAmount ? (detail.receiverAmount / 100).toFixed(2) : '-'} + + {detail?.finishTime} + {detail?.payeeAccount} + + {detail?.payeeType === 'MERCHANT_ID' ? '商户ID' : '个人openid'} + + {detail?.description} + {detail?.status === 3 && ( + + {detail?.failReason} + + )} + {detail?.retryTimes || 0} + {detail?.lastRetryTime} + + + + ); +}; + +export default ProfitSharingDetail; \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.less b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.less new file mode 100644 index 00000000..0b4b560a --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.less @@ -0,0 +1,35 @@ +.chartCard { + margin-top: 24px; +} + +.secondRow { + margin-top: 24px; +} + +.iconTotal { + color: #1890ff; + font-size: 24px; +} + +.iconSuccess { + color: #52c41a; + font-size: 24px; +} + +.iconFail { + color: #ff4d4f; + font-size: 24px; +} + +.iconAmount { + color: #faad14; + font-size: 24px; +} + +:global { + .ant-card { + .ant-card-head { + border-bottom: none; + } + } +} \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.tsx new file mode 100644 index 00000000..2db2c4fb --- /dev/null +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/ProfitSharing/Statistics.tsx @@ -0,0 +1,175 @@ +import { PageContainer, StatisticCard } from '@ant-design/pro-components'; +import { Card, Row, Col, Tabs, DatePicker } from 'antd'; +import { Area, Column } from '@ant-design/plots'; +import React, { useState, useEffect } from 'react'; +import { getProfitSharingStatistics } from '@/services/orders/api'; +import styles from './Statistics.less'; +import { + TransactionOutlined, + CheckCircleOutlined, + CloseCircleOutlined, + PayCircleOutlined, +} from '@ant-design/icons'; + +const { Divider } = StatisticCard; +const { RangePicker } = DatePicker; + +const Statistics: React.FC = () => { + const [loading, setLoading] = useState(false); + const [timeRange, setTimeRange] = useState<[string, string]>(['', '']); + const [statistics, setStatistics] = useState({}); + const [activeTab, setActiveTab] = useState('day'); + + // 获取统计数据 + const fetchStatistics = async () => { + setLoading(true); + try { + const result = await getProfitSharingStatistics({ + startTime: timeRange[0], + endTime: timeRange[1], + type: activeTab, + }); + if (result.resp_code === 0) { + setStatistics(result.data); + } + } catch (error) { + console.error('获取统计数据失败:', error); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchStatistics(); + }, [timeRange, activeTab]); + + // 金额趋势图配置 + const amountTrendConfig = { + data: statistics.amountTrend || [], + xField: 'date', + yField: 'amount', + seriesField: 'type', + smooth: true, + animation: true, + legend: { + position: 'top', + }, + yAxis: { + label: { + formatter: (val: string) => `¥${(Number(val) / 100).toFixed(2)}`, + }, + }, + tooltip: { + formatter: (datum: any) => { + return { + name: datum.type, + value: `¥${(datum.amount / 100).toFixed(2)}`, + }; + }, + }, + }; + + // 成功率统计图配置 + const successRateConfig = { + data: statistics.successRate || [], + xField: 'date', + yField: 'value', + seriesField: 'type', + isGroup: true, + columnStyle: { + radius: [4, 4, 0, 0], + }, + label: { + position: 'middle', + style: { + fill: '#FFFFFF', + }, + }, + }; + + return ( + + {/* 总体统计卡片 */} + + , + }} + /> + + , + }} + /> + + , + }} + /> + + , + }} + /> + + + {/* 时间维度统计 */} + { + if (dates) { + setTimeRange([ + dates[0]?.format('YYYY-MM-DD') || '', + dates[1]?.format('YYYY-MM-DD') || '', + ]); + } + }} + /> + } + > + + + + + + + + + + + + + + + + + + + + ); +}; + +export default Statistics; \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/components/UpdateForm.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/components/UpdateForm.tsx index cd6ef537..e7f87f58 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/components/UpdateForm.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/components/UpdateForm.tsx @@ -3,9 +3,10 @@ import { ProForm, ProFormSelect, ProFormText, + ProFormDigit, } from '@ant-design/pro-components'; import React, { useEffect } from 'react'; -import { STATUS_OPTIONS } from '../index'; +import { STATUS_OPTIONS, PAYEE_TYPE_OPTIONS } from '../index'; export type UpdateFormProps = { onSubmit: (values: ORDERS.Qrcode) => Promise; @@ -105,6 +106,46 @@ const UpdateForm: React.FC = (props) => { rules={[{ required: true, message: '请选择状态' }]} /> + + + + + + {values?.payeeStatus === 2 && ( + + )} + ); }; diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.less b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.less index e104e2e9..1e3f33f2 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.less +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.less @@ -20,3 +20,26 @@ .query-filter { margin-bottom: 16px; } + +.ant-form { + .ant-form-item-group-title { + font-weight: 500; + font-size: 16px; + margin-bottom: 16px; + color: rgba(0, 0, 0, 0.85); + border-bottom: 1px solid #f0f0f0; + padding-bottom: 8px; + } +} + +.payee-status { + &-0 { + color: #d9d9d9; + } + &-1 { + color: #52c41a; + } + &-2 { + color: #ff4d4f; + } +} diff --git a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx index 3a2a3704..ac97e790 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/orders/Qrcode/index.tsx @@ -7,8 +7,10 @@ import { ProForm, ProFormSelect, ProFormText, + ProFormDigit, ProTable, QueryFilter, + Tooltip, } from '@ant-design/pro-components'; import { Typography, Popconfirm, Space, message, Image, Button, Tag } from 'antd'; import React, { useRef, useState, useCallback, useEffect } from 'react'; @@ -28,6 +30,19 @@ export const DEVICE_OPTIONS = [ { label: '5YSZMBS0030BJ8', value: '5YSZMBS0030BJ8' }, ] as const; +// 添加账号类型常量 +export const PAYEE_TYPE_OPTIONS = [ + { label: '商户ID', value: 'MERCHANT_ID' }, + { label: '个人openid', value: 'PERSONAL_OPENID' }, +] as const; + +// 添加账号状态常量 +export const PAYEE_STATUS_OPTIONS = [ + { label: '未验证', value: 0 }, + { label: '已验证', value: 1 }, + { label: '验证失败', value: 2 }, +] as const; + const handleApiRequest = async ( apiCall: () => Promise, loadingMessage: string, @@ -267,6 +282,47 @@ const TableList: React.FC = () => { width: 80, render: (status) => renderStatus(status), }, + { + title: '分账账号', + dataIndex: 'payeeAccount', + width: 140, + ellipsis: true, + }, + { + title: '账号类型', + dataIndex: 'payeeType', + width: 100, + valueEnum: { + 'MERCHANT_ID': { text: '商户ID' }, + 'PERSONAL_OPENID': { text: '个人openid' }, + }, + }, + { + title: '分账比例', + dataIndex: 'profitRate', + width: 100, + render: (val) => val ? `${val}%` : '-', + }, + { + title: '验证状态', + dataIndex: 'payeeStatus', + width: 100, + render: (status, record) => { + const statusMap = { + 0: { color: 'default', text: '未验证' }, + 1: { color: 'success', text: '已验证' }, + 2: { color: 'error', text: '验证失败' }, + }; + const { color, text } = statusMap[status] || statusMap[0]; + return record.payeeFailReason ? ( + + {text} + + ) : ( + {text} + ); + }, + }, { title: '创建时间', dataIndex: 'createTime', @@ -447,6 +503,38 @@ const TableList: React.FC = () => { rules={[{ required: true, message: '请选择状态' }]} /> + + + + + + { diff --git a/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts b/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts index 1a27ef43..77218a2f 100644 --- a/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts +++ b/zlt-web/react-web/src/main/frontend/src/services/orders/api.ts @@ -179,3 +179,41 @@ export async function dashboard() { }); } +/** 分页查询分账记录 */ +export async function profitSharingList(params: { + page: number; + limit: number; + [key: string]: any; +}) { + return request('/api-order/profitSharing/list', { + method: 'GET', + params, + }); +} + +/** 获取分账记录详情 */ +export async function getProfitSharingDetail(orderNo: string) { + return request(`/api-order/profitSharing/${orderNo}`, { + method: 'GET', + }); +} + +/** 执行分账 */ +export async function executeProfitSharing(orderNo: string) { + return request(`/api-order/profitSharing/execute/${orderNo}`, { + method: 'POST', + }); +} + +/** 获取分账统计数据 */ +export async function getProfitSharingStatistics(params: { + startTime?: string; + endTime?: string; + type: 'day' | 'week' | 'month'; +}) { + return request('/api-order/profitSharing/statistics', { + method: 'GET', + params, + }); +} + diff --git a/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts b/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts index 41c6002a..be9057c8 100644 --- a/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts +++ b/zlt-web/react-web/src/main/frontend/src/services/orders/typings.d.ts @@ -64,6 +64,11 @@ declare namespace ORDERS { status: number; tenantId?: string; updateTime?: string; + payeeAccount?: string; + payeeType?: 'MERCHANT_ID' | 'PERSONAL_OPENID'; + profitRate?: number; + payeeStatus?: number; + payeeFailReason?: string; } type HomeCarousel = { @@ -138,6 +143,30 @@ declare namespace ORDERS { value: number; }>; } + + interface ProfitSharing { + id: number; + orderId: string; + orderNo: string; + transactionId: string; + profitSharingId: string; + totalAmount: number; + platformAmount: number; + qrCodeAmount: number; + status: number; + codeId: string; + payeeAccount: string; + payeeType: string; + description: string; + failReason: string; + receiverAmount: number; + finishTime: string; + outOrderNo: string; + retryTimes: number; + lastRetryTime: string; + createTime: string; + updateTime: string; + } } declare namespace API {