perf 网关同步记录优化

This commit is contained in:
xxm1995
2023-07-17 14:04:25 +08:00
parent c218677366
commit 1bbb5aced8
9 changed files with 291 additions and 16 deletions

View File

@@ -10,19 +10,25 @@
>
<a-spin :spinning="confirmLoading">
<a-descriptions title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="业务id">
<a-descriptions-item label="支付记录id">
{{ form.paymentId }}
</a-descriptions-item>
<a-descriptions-item label="支付通道">
{{ dictConvert('PayChannel', form.payChannel) }}
</a-descriptions-item>
<a-descriptions-item label="商户编码">
{{ dictConvert('PayChannel', form.mchCode) }}
</a-descriptions-item>
<a-descriptions-item label="商户应用编码">
{{ dictConvert('PayChannel', form.mchAppCode) }}
</a-descriptions-item>
<a-descriptions-item label="通知消息">
<json-preview :data="JSON.parse(form.notifyInfo || '{}')" />
</a-descriptions-item>
<a-descriptions-item label="状态">
{{ dictConvert('PayNotifyProcess', form.status) }}
{{ dictConvert('PayNotifyStatus', form.status) }}
</a-descriptions-item>
<a-descriptions-item label="提示消息">
<a-descriptions-item label="提示消息" v-if="form.msg">
{{ form.msg }}
</a-descriptions-item>
<a-descriptions-item label="通知时间">
@@ -73,7 +79,7 @@
notifyTime: '',
})
// 入口
function init(id, editType: FormEditType) {
function init(id) {
visible.value = true
confirmLoading.value = true
get(id).then(({ data }) => {

View File

@@ -15,7 +15,7 @@
</vxe-column>
<vxe-column field="status" title="处理状态">
<template #default="{ row }">
{{ dictConvert('PayNotifyProcess', row.status) }}
{{ dictConvert('PayNotifyStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="msg" title="提示信息" />
@@ -56,7 +56,7 @@
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDownNumber } = useDict()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
@@ -66,17 +66,19 @@
type: LIST,
name: '支付通道',
placeholder: '请选择支付通道',
selectList: dictDropDownNumber('AsyncPayChannel'),
selectList: dictDropDown('AsyncPayChannel'),
},
{
field: 'status',
type: LIST,
name: '处理状态',
placeholder: '请选择消息处理状态',
selectList: dictDropDownNumber('PayNotifyProcess'),
selectList: dictDropDown('PayNotifyStatus'),
},
] as QueryField[]
console.log(fields)
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const payNotifyRecordInfo = $ref<any>()

View File

@@ -113,7 +113,7 @@
const { handleTableChange, pageQueryResHandel, resetQuery, resetQueryParams, pagination, pages, model, loading, superQueryFlag } =
useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDownNumber } = useDict()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
@@ -134,9 +134,9 @@
{ field: 'amount', name: '金额', type: NUMBER, precision: 2 },
{ field: 'errorCode', name: '错误码', type: STRING },
{ field: 'asyncPayMode', name: '异步支付', type: BOOLEAN },
{ field: 'asyncPayChannel', name: '异步支付方式', type: LIST, selectList: dictDropDownNumber('PayChannel') },
{ field: 'asyncPayChannel', name: '异步支付方式', type: LIST, selectList: dictDropDown('PayChannel') },
{ field: 'payTime', name: '支付时间', type: DATE_TIME },
{ field: 'payStatus', name: '支付状态', type: LIST, selectList: dictDropDownNumber('PayStatus') },
{ field: 'payStatus', name: '支付状态', type: LIST, selectList: dictDropDown('PayStatus') },
] as QueryField[]
let superQueryParam = $ref<QueryParam[]>([])

View File

@@ -31,7 +31,7 @@
{{ form.refundTime }}
</a-descriptions-item>
<a-descriptions-item label="退款状态">
<a-tag>{{ dictConvert('PayRefundProcess', form.refundStatus) }}</a-tag>
<a-tag>{{ dictConvert('PayRefundStatus', form.refundStatus) }}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="退款终端ip">
{{ form.clientIp }}

View File

@@ -21,7 +21,7 @@
<vxe-column field="refundTime" title="退款时间" />
<vxe-column field="refundStatus" title="状态">
<template #default="{ row }">
<a-tag>{{ dictConvert('PayRefundProcess', row.refundStatus) }}</a-tag>
<a-tag>{{ dictConvert('PayRefundStatus', row.refundStatus) }}</a-tag>
</template>
</vxe-column>
<vxe-column fixed="right" width="60" :showOverflow="false" title="操作">
@@ -56,18 +56,32 @@
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'
import { useMessage } from '/@/hooks/web/useMessage'
import { QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { LIST, QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
import PaymentInfo from '/@/views/modules/payment/order/payment/PaymentInfo.vue'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert } = useDict()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
{ field: 'paymentId', type: STRING, name: '支付单号', placeholder: '请输入支付单号' },
{
field: 'payChannel',
type: LIST,
name: '支付通道',
placeholder: '请选择支付通道',
selectList: dictDropDown('AsyncPayChannel'),
},
{
field: 'status',
type: LIST,
name: '处理状态',
placeholder: '请选择处理状态',
selectList: dictDropDown('PayRefundStatus'),
},
{ field: 'businessId', type: STRING, name: '业务ID', placeholder: '请输入业务ID' },
{ field: 'title', type: STRING, name: '标题', placeholder: '请输入标题' },
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },

View File

@@ -0,0 +1,44 @@
import { defHttp } from '/@/utils/http/axios'
import { PageResult, Result } from '/#/axios'
import { BaseEntity } from '/#/web'
/**
* 分页
*/
export function page(params) {
return defHttp.get<Result<PageResult<SyncRecord>>>({
url: '/pay/sync/page',
params,
})
}
/**
* 获取单条
*/
export function get(id) {
return defHttp.get<Result<SyncRecord>>({
url: '/pay/sync/findById',
params: { id },
})
}
/**
* 支付同步记录
*/
export interface SyncRecord extends BaseEntity {
// 支付记录id
paymentId?: string
// 商户编码
mchCode?: string
// 商户应用编码
mchAppCode?: string
// 支付通道
payChannel?: string
// 通知消息
syncInfo?: string
// 同步状态
status?: string
// 同步时间
syncTime?: string
}

View File

@@ -0,0 +1,88 @@
<template>
<basic-modal
title="查看"
:loading="confirmLoading"
:width="modalWidth"
:visible="visible"
:mask-closable="showable"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-descriptions title="" :column="{ md: 1, sm: 1, xs: 1 }">
<a-descriptions-item label="支付记录id">
{{ form.paymentId }}
</a-descriptions-item>
<a-descriptions-item label="支付通道">
{{ dictConvert('PayChannel', form.payChannel) }}
</a-descriptions-item>
<a-descriptions-item label="商户编码">
{{ form.mchCode }}
</a-descriptions-item>
<a-descriptions-item label="应用编码">
{{ form.mchAppCode }}
</a-descriptions-item>
<a-descriptions-item label="通知消息">
<json-preview :data="JSON.parse(form.syncInfo || '{}')" />
</a-descriptions-item>
<a-descriptions-item label="状态">
{{ dictConvert('PaySyncStatus', form.status) }}
</a-descriptions-item>
<a-descriptions-item label="错误消息" v-show="form.msg">
{{ form.msg }}
</a-descriptions-item>
<a-descriptions-item label="同步时间">
{{ form.syncTime }}
</a-descriptions-item>
</a-descriptions>
</a-spin>
<template #footer>
<a-button key="cancel" @click="handleCancel">取消</a-button>
</template>
</basic-modal>
</template>
<script lang="ts" setup>
import { $ref } from 'vue/macros'
import useFormEdit from '/@/hooks/bootx/useFormEdit'
import { get, SyncRecord } from './SyncRecord.api'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { BasicModal } from '/@/components/Modal'
import JsonPreview from '/@/components/CodeEditor/src/json-preview/JsonPreview.vue'
import { useDict } from '/@/hooks/bootx/useDict'
const {
initFormEditType,
handleCancel,
search,
labelCol,
wrapperCol,
modalWidth,
title,
confirmLoading,
visible,
editable,
showable,
formEditType,
} = useFormEdit()
// 表单
const formRef = $ref<FormInstance>()
let form = $ref<SyncRecord>({})
const { dictConvert } = useDict()
/**
* 入口 获取信息
*/
function init(id) {
visible.value = true
console.log(123)
confirmLoading.value = true
get(id).then(({ data }) => {
form = data
confirmLoading.value = false
})
}
defineExpose({
init,
})
</script>
<style lang="less" scoped></style>

View File

@@ -0,0 +1,121 @@
<template>
<div>
<div class="m-3 p-3 pt-5 bg-white">
<b-query :query-params="model.queryParam" :fields="fields" @query="queryPage" @reset="resetQueryParams" />
</div>
<div class="m-3 p-3 bg-white">
<vxe-toolbar ref="xToolbar" custom :refresh="{ queryMethod: queryPage }" />
<vxe-table row-id="id" ref="xTable" :data="pagination.records" :loading="loading">
<vxe-column type="seq" width="60" />
<vxe-column field="paymentId" title="支付记录id" />
<vxe-column field="payChannel" title="支付通道">
<template #default="{ row }">
{{ dictConvert('PayChannel', row.payChannel) }}
</template>
</vxe-column>
<vxe-column field="status" title="处理状态">
<template #default="{ row }">
{{ dictConvert('PaySyncStatus', row.status) }}
</template>
</vxe-column>
<vxe-column field="msg" title="提示信息" />
<vxe-column field="syncTime" title="同步时间" />
<vxe-column fixed="right" width="50" :showOverflow="false" title="操作">
<template #default="{ row }">
<span>
<a-link @click="show(row)">查看</a-link>
</span>
</template>
</vxe-column>
</vxe-table>
<vxe-pager
size="medium"
:loading="loading"
:current-page="pagination.current"
:page-size="pagination.size"
:total="pagination.total"
@page-change="handleTableChange"
/>
<sync-record-info ref="syncRecordInfo" @ok="queryPage" />
</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue'
import { $ref } from 'vue/macros'
import { page } from './SyncRecord.api'
import useTablePage from '/@/hooks/bootx/useTablePage'
import SyncRecordInfo from './SyncRecordInfo.vue'
import { VxeTableInstance, VxeToolbarInstance, VxeTable, VxeColumn, VxePager, VxeToolbar } from 'vxe-table'
import BQuery from '/@/components/Bootx/Query/BQuery.vue'
import { FormEditType } from '/@/enums/formTypeEnum'
import { useMessage } from '/@/hooks/web/useMessage'
import { LIST, QueryField, STRING } from '/@/components/Bootx/Query/Query'
import { useDict } from '/@/hooks/bootx/useDict'
// 使用hooks
const { handleTableChange, pageQueryResHandel, resetQueryParams, pagination, pages, model, loading } = useTablePage(queryPage)
const { notification, createMessage, createConfirm } = useMessage()
const { dictConvert, dictDropDown } = useDict()
// 查询条件
const fields = [
{ field: 'paymentId', type: STRING, name: '支付单号', placeholder: '请输入支付单号' },
{
field: 'payChannel',
type: LIST,
name: '支付通道',
placeholder: '请选择支付通道',
selectList: dictDropDown('AsyncPayChannel'),
},
{
field: 'status',
type: LIST,
name: '处理状态',
placeholder: '请选择处理状态',
selectList: dictDropDown('PaySyncStatus'),
},
{ field: 'mchCode', type: STRING, name: '商户编码', placeholder: '请输入商户编码' },
{ field: 'mchAppCode', type: STRING, name: '应用号编码', placeholder: '请输入商户编码' },
] as QueryField[]
const xTable = $ref<VxeTableInstance>()
const xToolbar = $ref<VxeToolbarInstance>()
const syncRecordInfo = $ref<any>()
onMounted(() => {
vxeBind()
queryPage()
})
/**
* 初始化绑定
*/
function vxeBind() {
xTable?.connect(xToolbar as VxeToolbarInstance)
}
/**
* 分页查询
*/
function queryPage() {
loading.value = true
page({
...model.queryParam,
...pages,
}).then(({ data }) => {
pageQueryResHandel(data)
})
return Promise.resolve()
}
/**
* 查看
*/
function show(record) {
syncRecordInfo.init(record.id)
}
</script>
<style lang="less" scoped></style>

View File

@@ -28,7 +28,7 @@
<a-switch checked-children="启用" un-checked-children="停用" v-model:checked="form.enable" :disabled="showable" />
</a-form-item>
<a-form-item label="备注" name="remark">
<a-textarea v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
<a-textarea :rows="3" v-model:value="form.remark" :disabled="showable" placeholder="请输入备注" />
</a-form-item>
</a-form>
<template #footer>