Commit 162cb20f by 张立顺

feat 异常订单功能开发

1 parent 7ece8e62
{"timestamp":"2026-07-13T03:21:27.969+0000","status":404,"error":"Not Found","message":"Not Found","path":"/rop-dj-car-boutique/v3/api-docs"}
\ No newline at end of file \ No newline at end of file
{"timestamp":"2026-07-13T03:21:45.172+0000","status":404,"error":"Not Found","message":"Not Found","path":"/rop-dj-car-boutique/swagger-resources"}
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
.swagger-ui .topbar .download-url-wrapper{
display: none;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: window.location.href.replace(/swagger-ui\/v3\/index.html/, "swagger-rop/api-docs"),
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>
{"timestamp":"2026-07-13T03:21:44.945+0000","status":404,"error":"Not Found","message":"Not Found","path":"/rop-dj-car-boutique/v2/api-docs"}
\ No newline at end of file \ No newline at end of file
/**
* @file 异常流水 API 纯函数:枚举与提交参数规范化(无 request 依赖,供单测与 api 层复用)
*/
/**
* 异常类型(Swagger AbnormalFlowType)
* @readonly
*/
export const ABNORMAL_FLOW_TYPE = {
PAID_NOT_RECORDED: 1,
MULTI_FLOW_ONE_ORDER: 2,
ONE_FLOW_MULTI_ORDER: 3,
PUBLIC_PAYMENT: 4,
MIXED_PAYMENT: 5,
AMOUNT_MISMATCH: 6,
OTHER: 7
}
/**
* 异常类型展示文案(Swagger 枚举描述)
* @type {Record<number, string>}
*/
export const ABNORMAL_FLOW_TYPE_LABEL = {
1: '已付款未录单',
2: '多流水对应一单',
3: '一流水对应多单',
4: '对公收款',
5: '混合支付',
6: '金额不一致',
7: '其他异常'
}
/**
* 审批状态(Swagger AbnormalFlowApprovalStatus)
* @readonly
*/
export const ABNORMAL_FLOW_APPROVAL_STATUS = {
RM_PENDING: 1,
RM_REJECTED: 2,
BG_PENDING: 3,
BG_REJECTED: 4,
APPROVED: 5
}
/**
* 流水报备标记(响应字段 declarationFlag)
* @readonly
*/
export const DECLARATION_FLAG = {
NOT_DECLARED: 0,
DECLARED: 1
}
/**
* 提交报备前规范化入参(voucherImageUrls 数组 → qs indices 序列化)
* @param {Object} data
* @param {string} data.outTradeNo 支付订单号
* @param {number|string} data.abnormalType
* @param {string} data.remark
* @param {string[]} [data.voucherImageUrls]
* @returns {Object}
*/
export function buildDeclarationSubmitParams(data = {}) {
const params = {
outTradeNo: data.outTradeNo,
abnormalType: data.abnormalType,
remark: data.remark
}
const urls = Array.isArray(data.voucherImageUrls)
? data.voucherImageUrls.filter(Boolean)
: []
if (urls.length) {
params.voucherImageUrls = urls
}
return params
}
/**
* @file 异常流水报备 / 合并待补录 — ROP API 封装(Swagger: rop-dj-car-boutique/swagger-rop/api-docs)
* 仅请求层,不调 setData;sessionId 由 request 自动注入。
*/
import api from '~/utils/request/request.js'
import {
buildDeclarationSubmitParams
} from './abnormalFlowDeclaration.helpers.js'
export {
ABNORMAL_FLOW_TYPE,
ABNORMAL_FLOW_TYPE_LABEL,
ABNORMAL_FLOW_APPROVAL_STATUS,
DECLARATION_FLAG,
buildDeclarationSubmitParams
} from './abnormalFlowDeclaration.helpers.js'
/**
* @typedef {1|2|3|4|5|6|7} AbnormalFlowTypeValue
*/
/**
* @typedef {1|2|3|4|5} AbnormalFlowApprovalStatusValue
*/
/**
* @typedef {Object} RopResponse
* @property {string|number} code 0 成功
* @property {string} [errId]
* @property {string} [message]
* @property {*} [data]
*/
/**
* @typedef {Object} WaitInputOrderUnionCountData
* @property {number} [totalCount] 交易记录条数 / 流水总数
* @property {number} [notDeclaredCount] 待报备总数
* @property {number} [declaredCount] 已报备总数
* @property {number} [waitInputCount] 待补录条数
* @property {number} [inputtedCount] 已补录条数
*/
/**
* @typedef {Object} WaitInputOrderPageItem
* @property {string} [outTradeNo] 支付订单号
* @property {string} [tradeNo] 交易凭证号
* @property {number} [totalFee] 支付金额(分)
* @property {string} [accountDate] 支付时间
* @property {string|number} [payType] 收款来源
* @property {string} [shopMerchantName] 流水所属导流方商户名称
* @property {string|number} [declarationFlag] 0-未报备 1-已报备
* @property {string|number} [inputStatus] 补录状态
*/
/**
* @typedef {Object} RpcPagination
* @property {number} [pageNum]
* @property {number} [pageSize]
* @property {number} [total]
* @property {number} [pages]
* @property {Array<*>} [list]
*/
/**
* @typedef {Object} AbnormalFlowDeclarationPageItem
* @property {number} [id] 报备记录 ID
* @property {string} [tradeNo] 交易参考号
* @property {string|number} [abnormalType] 异常类型
* @property {string} [submitterName] 提交人
* @property {number} [totalPrice] 原支付金额(元)
* @property {string} [accountDate] 支付时间
* @property {string} [merchantName] 商户名称
* @property {string|number} [approvalStatus] 审批状态
*/
/**
* @typedef {Object} AbnormalFlowDeclarationInfo
* @property {string|number} [abnormalType]
* @property {string} [remark]
* @property {string} [createdBy] 报备人
* @property {string} [createdDate] 报备时间
* @property {string[]} [voucherImageUrls]
*/
/**
* @typedef {Object} AbnormalPaymentDetail
* @property {string} [tradeNo]
* @property {number} [totalPrice]
* @property {string} [payDate]
* @property {string} [merchantName]
* @property {string} [payChannel]
*/
/**
* @typedef {Object} AbnormalFlowApprovalLogItem
* @property {string|number} [approvalStatus]
* @property {string} [operatorName]
* @property {string} [createdDate]
* @property {string} [remark]
* @property {string|number} [approvalSource] 0 区域经理 1 总部运营
*/
/**
* @typedef {Object} AbnormalFlowDeclarationDetailData
* @property {AbnormalPaymentDetail} [tradeInfo]
* @property {AbnormalFlowDeclarationInfo} [declarationInfo]
* @property {AbnormalFlowApprovalLogItem[]} [approvalLogs]
*/
/**
* @typedef {Object} AbnormalFlowDeclarationSubmitData
* @property {number} [declarationId]
*/
/**
* 异常流水统计次数(无业务入参,sessionId 自动注入)
* @param {Object} [data]
* @returns {Promise<RopResponse & { data?: WaitInputOrderUnionCountData }>}
*/
export function waitInputOrderUnionCount(data = {}) {
return api.post('dj.api.smartcarlife.weapp.waitinputorder.union.count', data)
}
/**
* 查询门店锁单限制
* @param {{ merchantId: number|string }} data 4S 店 merchantId
* @returns {Promise<RopResponse & { data?: boolean }>}
*/
export function checkAbnormalFlowShopLock(data) {
return api.post(
'dj.api.smartcarlife.abnormalFlowDeclaration.checkShopLock',
data
)
}
/**
* 分页查询合并的待补录订单(Swagger 未声明 declarationFlag 入参)
* @param {Object} data
* @param {number} data.currentPage
* @param {number} data.pageSize
* @param {number} [data.totalFee] 订单金额
* @param {1|2} [data.inputOrderType] 1 正常分账期 2 超分账期
* @returns {Promise<RopResponse & { data?: RpcPagination & { list?: WaitInputOrderPageItem[] } }>}
*/
export function waitInputOrderUnionPage(data) {
return api.post('dj.api.smartcarlife.weapp.waitinputorder.union.page', data)
}
/**
* 分页查询异常流水报备列表
* @param {Object} data
* @param {number} [data.currentPage]
* @param {number} [data.pageSize]
* @param {number|string} [data.appShopMerchantId] 流水所属 4S 店商户号
* @param {string} [data.submitterName]
* @param {string} [data.accountStartDate] yyyy-MM-dd HH:mm:ss
* @param {string} [data.accountEndDate]
* @param {AbnormalFlowApprovalStatusValue} [data.approvalStatus]
* @returns {Promise<RopResponse & { data?: RpcPagination & { list?: AbnormalFlowDeclarationPageItem[] } }>}
*/
export function abnormalFlowDeclarationPage(data) {
return api.post('dj.api.smartcarlife.abnormalFlowDeclaration.page', data)
}
/**
* 提交流水报备信息
* @param {Object} data 建议经 buildDeclarationSubmitParams 处理
* @param {string} data.outTradeNo
* @param {AbnormalFlowTypeValue|number|string} data.abnormalType
* @param {string} data.remark
* @param {string[]} [data.voucherImageUrls]
* @returns {Promise<RopResponse & { data?: AbnormalFlowDeclarationSubmitData }>}
*/
export function abnormalFlowDeclarationSubmit(data) {
return api.post(
'dj.api.smartcarlife.abnormalFlowDeclaration.submit',
buildDeclarationSubmitParams(data)
)
}
/**
* 查询异常流水报备详情
* @param {{ id: number|string }} data 报备记录 ID
* @returns {Promise<RopResponse & { data?: AbnormalFlowDeclarationDetailData }>}
*/
export function abnormalFlowDeclarationDetail(data) {
return api.post('dj.api.smartcarlife.abnormalFlowDeclaration.detail', data)
}
...@@ -557,6 +557,45 @@ module.exports = { ...@@ -557,6 +557,45 @@ module.exports = {
} }
}) })
}, },
/** 异常流水统计次数 → 见 api/abnormalFlowDeclaration.js */
waitInputOrderUnionCount(data = {}) {
return api.post('dj.api.smartcarlife.weapp.waitinputorder.union.count', data)
},
/** 查询门店异常流水锁单限制 → 见 api/abnormalFlowDeclaration.js */
checkAbnormalFlowShopLock(data) {
return api.post(
'dj.api.smartcarlife.abnormalFlowDeclaration.checkShopLock',
data
)
},
/** 分页查询合并待补录订单 → 见 api/abnormalFlowDeclaration.js */
waitInputOrderUnionPage(data) {
return api.post('dj.api.smartcarlife.weapp.waitinputorder.union.page', data)
},
/** 分页查询异常流水报备列表 → 见 api/abnormalFlowDeclaration.js */
abnormalFlowDeclarationPage(data) {
return api.post('dj.api.smartcarlife.abnormalFlowDeclaration.page', data)
},
/** 提交流水报备 → 见 api/abnormalFlowDeclaration.js */
abnormalFlowDeclarationSubmit(data) {
const params = {
outTradeNo: data.outTradeNo,
abnormalType: data.abnormalType,
remark: data.remark
}
const urls = Array.isArray(data.voucherImageUrls)
? data.voucherImageUrls.filter(Boolean)
: []
if (urls.length) params.voucherImageUrls = urls
return api.post(
'dj.api.smartcarlife.abnormalFlowDeclaration.submit',
params
)
},
/** 异常流水报备详情 → 见 api/abnormalFlowDeclaration.js */
abnormalFlowDeclarationDetail(data) {
return api.post('dj.api.smartcarlife.abnormalFlowDeclaration.detail', data)
},
// http://localhost:8081/rop-dj-riskmanage/router//dj.api.staff.miniprogram.salaryapply.daily.report.fill.check/1.0.0 // http://localhost:8081/rop-dj-riskmanage/router//dj.api.staff.miniprogram.salaryapply.daily.report.fill.check/1.0.0
// 检查今天是否在T1-T5之间 // 检查今天是否在T1-T5之间
salaryapplyFillCheck(data) { salaryapplyFillCheck(data) {
......
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
describe('abnormalFlowDeclaration helpers', async () => {
const {
ABNORMAL_FLOW_TYPE,
ABNORMAL_FLOW_TYPE_LABEL,
ABNORMAL_FLOW_APPROVAL_STATUS,
DECLARATION_FLAG,
buildDeclarationSubmitParams
} = await import('../api/abnormalFlowDeclaration.helpers.js')
it('ABNORMAL_FLOW_TYPE has 7 type values', () => {
assert.equal(Object.keys(ABNORMAL_FLOW_TYPE).length, 7)
assert.equal(ABNORMAL_FLOW_TYPE_LABEL[7], '其他异常')
})
it('ABNORMAL_FLOW_APPROVAL_STATUS has 5 approval statuses', () => {
assert.equal(Object.keys(ABNORMAL_FLOW_APPROVAL_STATUS).length, 5)
assert.equal(ABNORMAL_FLOW_APPROVAL_STATUS.APPROVED, 5)
})
it('DECLARATION_FLAG defines not declared and declared', () => {
assert.equal(DECLARATION_FLAG.NOT_DECLARED, 0)
assert.equal(DECLARATION_FLAG.DECLARED, 1)
})
it('buildDeclarationSubmitParams passes required fields', () => {
const params = buildDeclarationSubmitParams({
outTradeNo: 'PAY001',
abnormalType: 1,
remark: '备注'
})
assert.deepEqual(params, {
outTradeNo: 'PAY001',
abnormalType: 1,
remark: '备注'
})
})
it('buildDeclarationSubmitParams includes voucherImageUrls when non-empty', () => {
const params = buildDeclarationSubmitParams({
outTradeNo: 'PAY001',
abnormalType: 2,
remark: 'x',
voucherImageUrls: ['https://a/1.png', '', 'https://a/2.png']
})
assert.deepEqual(params.voucherImageUrls, [
'https://a/1.png',
'https://a/2.png'
])
})
it('buildDeclarationSubmitParams omits voucherImageUrls when empty', () => {
const params = buildDeclarationSubmitParams({
outTradeNo: 'PAY001',
abnormalType: 1,
remark: 'x',
voucherImageUrls: []
})
assert.equal(params.voucherImageUrls, undefined)
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!