diff --git a/es/aspects/AspectDict.d.ts b/es/aspects/AspectDict.d.ts index c94493b9..4cd36e12 100644 --- a/es/aspects/AspectDict.d.ts +++ b/es/aspects/AspectDict.d.ts @@ -1,5 +1,5 @@ -import { BRC } from '@project/types/RuntimeCxt'; -import { EntityDict } from '@project/oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; export type AspectDict = { getAccountPayRefunds: (params: { accountId: string; diff --git a/es/checkers/index.js b/es/checkers/index.js index 76e20c90..fc76150b 100644 --- a/es/checkers/index.js +++ b/es/checkers/index.js @@ -2,10 +2,12 @@ import aoCheckers from './accountOper'; import payCheckers from './pay'; import orderCheckers from './order'; import applicationCheckers from './application'; +import offlineAccountCheckers from './offlineAccount'; const checkers = [ ...aoCheckers, ...payCheckers, ...orderCheckers, ...applicationCheckers, + ...offlineAccountCheckers, ]; export default checkers; diff --git a/es/checkers/offlineAccount.d.ts b/es/checkers/offlineAccount.d.ts new file mode 100644 index 00000000..54714d63 --- /dev/null +++ b/es/checkers/offlineAccount.d.ts @@ -0,0 +1,5 @@ +import { Checker } from 'oak-domain/lib/types/Auth'; +import { EntityDict } from '../oak-app-domain'; +import { RuntimeCxt } from '../types/RuntimeCxt'; +declare const checkers: Checker[]; +export default checkers; diff --git a/es/checkers/offlineAccount.js b/es/checkers/offlineAccount.js new file mode 100644 index 00000000..c5327d1d --- /dev/null +++ b/es/checkers/offlineAccount.js @@ -0,0 +1,62 @@ +import assert from 'assert'; +import { OakAttrNotNullException, OakInputIllegalException } from 'oak-domain/lib/types'; +import { pipeline } from 'oak-domain/lib/utils/executor'; +function checkAttributes(data) { + const { type, channel, name, qrCode } = data; + switch (type) { + case 'bank': { + if (!channel || !name || !qrCode) { + throw new OakAttrNotNullException('offlineAccount', ['channel', 'name', 'qrCode'].filter(ele => !data[ele])); + } + break; + } + case 'shouqianba': + case 'wechat': + case 'alipay': { + if (!name && !qrCode) { + throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull'); + } + break; + } + case 'others': { + if (!name && !qrCode) { + throw new OakAttrNotNullException('offlineAccount', ['name', 'qrCode']); + } + if (!channel) { + throw new OakAttrNotNullException('offlineAccount', ['channel']); + } + } + } +} +const checkers = [ + { + entity: 'offlineAccount', + action: 'create', + type: 'data', + checker(data) { + assert(!(data instanceof Array)); + checkAttributes(data); + } + }, + { + entity: 'offlineAccount', + action: 'update', + type: 'logicalData', + checker: (operation, context) => { + const { data, filter } = operation; + return pipeline(() => context.select('offlineAccount', { + data: { + id: 1, + type: 1, + channel: 1, + name: 1, + qrCode: 1, + }, + filter + }, { dontCollect: true }), (accounts) => { + accounts.forEach((ele) => checkAttributes(Object.assign(ele, data))); + }); + } + } +]; +export default checkers; diff --git a/es/checkers/pay.d.ts b/es/checkers/pay.d.ts index 96ed6c49..c92e5353 100644 --- a/es/checkers/pay.d.ts +++ b/es/checkers/pay.d.ts @@ -1,5 +1,5 @@ import { Checker } from 'oak-domain/lib/types/Auth'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { RuntimeCxt } from '../types/RuntimeCxt'; declare const checkers: Checker[]; export default checkers; diff --git a/es/checkers/refund.d.ts b/es/checkers/refund.d.ts index 5621432e..b7d20df2 100644 --- a/es/checkers/refund.d.ts +++ b/es/checkers/refund.d.ts @@ -1,5 +1,5 @@ import { Checker } from 'oak-domain/lib/types/Auth'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { RuntimeCxt } from '../types/RuntimeCxt'; declare const checkers: Checker[]; export default checkers; diff --git a/es/components/AbstractComponents.d.ts b/es/components/AbstractComponents.d.ts index c34b05d2..7bc4fdd2 100644 --- a/es/components/AbstractComponents.d.ts +++ b/es/components/AbstractComponents.d.ts @@ -2,7 +2,7 @@ * 抽象组件在业务层根据EntityDict的重新声明 * by Xc 20230807 */ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { ReactComponentProps, ColumnProps, RowWithActions, OakExtraActionProps, OakAbsAttrDef, onActionFnDef, ListButtonProps, OakAbsAttrUpsertDef } from 'oak-frontend-base'; declare const FilterPanel: (props: ReactComponentProps(props: ReactComponentProps(props: { tablePagination?: any; rowSelection?: any; disableSerialNumber?: boolean | undefined; - size?: "small" | "large" | "middle" | undefined; + size?: "small" | "middle" | "large" | undefined; scroll?: any; locale?: any; opWidth?: number | undefined; diff --git a/es/components/account/deposit/web.d.ts b/es/components/account/deposit/web.d.ts index b92ff2a5..bddd1e44 100644 --- a/es/components/account/deposit/web.d.ts +++ b/es/components/account/deposit/web.d.ts @@ -1,7 +1,7 @@ import React from 'react'; import { WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; -import { AccountPayConfig, PayConfig } from '@project/types/PayConfig'; +import { EntityDict } from '../../../oak-app-domain'; +import { AccountPayConfig, PayConfig } from '../../../types/PayConfig'; export default function Render(props: WebComponentProps; depositMaxCent: number; diff --git a/es/components/account/detail/web.pc.d.ts b/es/components/account/detail/web.pc.d.ts index af66ee89..b0eaf555 100644 --- a/es/components/account/detail/web.pc.d.ts +++ b/es/components/account/detail/web.pc.d.ts @@ -1,6 +1,6 @@ import React from 'react'; import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; export default function Render(props: WebComponentProps; depositMaxCent: number; diff --git a/es/components/accountOper/list/web.d.ts b/es/components/accountOper/list/web.d.ts index 069aaa4d..9629d9be 100644 --- a/es/components/accountOper/list/web.d.ts +++ b/es/components/accountOper/list/web.d.ts @@ -1,5 +1,5 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; export default function Render(props: WebComponentProps[]; }>): string; diff --git a/es/components/accountOper/list/web.pc.d.ts b/es/components/accountOper/list/web.pc.d.ts index 069aaa4d..9629d9be 100644 --- a/es/components/accountOper/list/web.pc.d.ts +++ b/es/components/accountOper/list/web.pc.d.ts @@ -1,5 +1,5 @@ import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; export default function Render(props: WebComponentProps[]; }>): string; diff --git a/es/components/accountOper/pure/List.pc.d.ts b/es/components/accountOper/pure/List.pc.d.ts index 4cd5bb68..ec3cb8e6 100644 --- a/es/components/accountOper/pure/List.pc.d.ts +++ b/es/components/accountOper/pure/List.pc.d.ts @@ -1,5 +1,5 @@ /// -import { EntityDict } from "@project/oak-app-domain"; +import { EntityDict } from "../../../oak-app-domain"; export default function Render(props: { accountOpers: EntityDict['accountOper']['OpSchema'][]; t: (k: string) => string; diff --git a/es/components/offlineAccount/config/index.d.ts b/es/components/offlineAccount/config/index.d.ts index 9fa0f886..dd47125a 100644 --- a/es/components/offlineAccount/config/index.d.ts +++ b/es/components/offlineAccount/config/index.d.ts @@ -1,3 +1,4 @@ -/// -declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; export default _default; diff --git a/es/components/offlineAccount/config/index.js b/es/components/offlineAccount/config/index.js index 7629f753..97ea1db6 100644 --- a/es/components/offlineAccount/config/index.js +++ b/es/components/offlineAccount/config/index.js @@ -7,12 +7,27 @@ export default OakComponent({ channel: 1, name: 1, qrCode: 1, - desc: 1, + allowDeposit: 1, + allowPay: 1, systemId: 1, + price: 1, + enabled: 1, }, - formData({ data }) { + properties: { + systemId: '', + }, + formData({ data, legalActions }) { return { - accounts: data, + accounts: data.map((ele) => { + const { type } = ele; + const color = this.features.style.getColor('offlineAccount', 'type', type); + return { + color, + ...ele, + }; + }), + canCreate: legalActions?.includes('create'), }; - } + }, + actions: ['create', 'update', 'remove'], }); diff --git a/es/components/offlineAccount/config/locales/zh-CN.json b/es/components/offlineAccount/config/locales/zh-CN.json new file mode 100644 index 00000000..dc4c3ad0 --- /dev/null +++ b/es/components/offlineAccount/config/locales/zh-CN.json @@ -0,0 +1,7 @@ +{ + "tips": "线下账户是需要system的相关工作人员手动同步收款和打款结果的账户", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" +} diff --git a/es/components/offlineAccount/config/web.pc.d.ts b/es/components/offlineAccount/config/web.pc.d.ts index 8e31a268..422024fa 100644 --- a/es/components/offlineAccount/config/web.pc.d.ts +++ b/es/components/offlineAccount/config/web.pc.d.ts @@ -2,5 +2,9 @@ import React from 'react'; import { EntityDict } from "../../../oak-app-domain"; import { RowWithActions, WebComponentProps } from "oak-frontend-base"; export default function render(props: WebComponentProps[]; + accounts?: (RowWithActions & { + color: string; + })[]; + systemId: string; + canCreate?: boolean; }>): React.JSX.Element; diff --git a/es/components/offlineAccount/config/web.pc.js b/es/components/offlineAccount/config/web.pc.js index 4fbb3cba..7d3cf483 100644 --- a/es/components/offlineAccount/config/web.pc.js +++ b/es/components/offlineAccount/config/web.pc.js @@ -1,32 +1,110 @@ -import React from 'react'; -import { Button } from 'antd'; +import React, { useState } from 'react'; +import { Button, Modal, Alert, Descriptions, QRCode } from 'antd'; import { PlusCircleOutlined } from '@ant-design/icons'; -import { Detail } from '../../../components/AbstractComponents'; import Styles from './web.pc.module.less'; +import Upsert from '../upsert'; +import { OakAttrNotNullException, OakException } from 'oak-domain/lib/types'; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; +function OfflineAccount(props) { + const { account, t, onUpdate, onRemove, onQrCodeClick } = props; + const { type, channel, name, qrCode, allowDeposit, allowPay, color, enabled, price } = account; + const legalActions = account['#oakLegalActions']; + return ( + {legalActions.includes('update') && } + {legalActions.includes('remove') && } + } column={1} bordered size="small" labelStyle={{ width: 98 }}> + {t(`offlineAccount:v.type.${type}`)} + {channel && {channel}} + {name && {name}} + {qrCode && + {type === 'bank' ? qrCode : } + } + {price} + {t(`common::${allowDeposit}`)} + {t(`common::${allowPay}`)} + {t(`common::${enabled}`)} + ); +} export default function render(props) { - const { accounts } = props.data; - const { t } = props.methods; - if (accounts.length > 0) { + const { accounts, oakFullpath, oakExecutable, systemId, canCreate } = props.data; + const { t, addItem, execute, clean } = props.methods; + const [upsertId, setUpsertId] = useState(''); + const getNotNullMessage = (attr) => { + if (['channel', 'name', 'qrCode'].includes(attr)) { + const upsertRow = accounts?.find(ele => ele.id === upsertId); + return t('notnull', { value: t(`offlineAccount::label.${attr}.${upsertRow.type}`) }); + } + return t('notnull', { value: t(`offlineAccount:attr.${attr}`) }); + }; + const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getAttributes()[0]) : t(oakExecutable.message)); + const U = ( { + clean(); + setUpsertId(''); + }} closeIcon={null} onOk={async () => { + await execute(); + setUpsertId(''); + }} okButtonProps={{ + disabled: oakExecutable !== true, + }} okText={t('common::confirm')} cancelText={(t('common::action.cancel'))}> +
+ {errMsg && } + +
+
); + const [showQrCodeId, setShowQrCodeId] = useState(''); + const showQrCodeRow = showQrCodeId ? accounts.find(ele => ele.id === showQrCodeId) : undefined; + if (accounts && accounts.length > 0) { return (
+ + {U}
- {accounts.map((ele) =>
- -
)} + {accounts.filter(ele => ele.$$createAt$$ > 1).map((ele, idx) =>
+ { + Modal.confirm({ + title: t('confirmDelete'), + content: t('areYouSure'), + onOk: async () => execute(undefined, undefined, undefined, [ + { + entity: 'offlineAccount', + operation: { + id: await generateNewIdAsync(), + action: 'remove', + data: {}, + filter: { + id: ele.id, + }, + } + } + ]), + }); + }} onUpdate={() => setUpsertId(ele.id)} onQrCodeClick={() => setShowQrCodeId(ele.id)}/> +
)}
- + }
+ {showQrCodeRow && setShowQrCodeId('')}> + + }
); } return (
-
); } diff --git a/es/components/offlineAccount/upsert/index.js b/es/components/offlineAccount/upsert/index.js index b0e8467d..ca7f4588 100644 --- a/es/components/offlineAccount/upsert/index.js +++ b/es/components/offlineAccount/upsert/index.js @@ -6,7 +6,8 @@ export default OakComponent({ channel: 1, name: 1, qrCode: 1, - desc: 1, + allowDeposit: 1, + allowPay: 1, systemId: 1, }, isList: false, @@ -15,4 +16,16 @@ export default OakComponent({ offlineAccount: data, }; }, + lifetimes: { + ready() { + if (this.isCreation()) { + this.update({ + allowDeposit: false, + allowPay: false, + price: 0, + enabled: true, + }); + } + } + } }); diff --git a/es/components/offlineAccount/upsert/locales/zh-CN.json b/es/components/offlineAccount/upsert/locales/zh-CN.json index 01460208..5a620db7 100644 --- a/es/components/offlineAccount/upsert/locales/zh-CN.json +++ b/es/components/offlineAccount/upsert/locales/zh-CN.json @@ -1,13 +1,26 @@ { - "tips": "线下交易账户是需要人工同步收款和打款行为的账户", - "label": { - "channel": { - "bank": "银行及所属支行" - } - }, "placeholder": { "channel": { - "bank": "银行-所属支行" + "bank": "银行/支行", + "others": "请输入途径名称" + }, + "name": { + "bank": "输入户主姓名", + "alipay": "输入支付宝帐号", + "wechat": "输入微信号", + "shouqianba": "输入收钱吧商户号", + "others": "输入该收款途径的唯一账号" + }, + "qrCode": { + "bank": "请输入银行账号", + "alipay": "请将二维码解析后的字符串填入", + "wechat": "请将二维码解析后的字符串填入", + "shouqianba": "请将二维码解析后的字符串填入", + "others": "请将二维码解析后的字符串填入" } + }, + "help": { + "allowDeposit": "是否允许用户在系统中主动向此账号发起充值", + "allowPay": "是否允许用户在系统中主动向此账号发起支付" } } diff --git a/es/components/offlineAccount/upsert/web.pc.js b/es/components/offlineAccount/upsert/web.pc.js index 27ef4f00..2d18c8e7 100644 --- a/es/components/offlineAccount/upsert/web.pc.js +++ b/es/components/offlineAccount/upsert/web.pc.js @@ -1,25 +1,61 @@ import React from 'react'; -import { Alert, Form, Input, Select } from 'antd'; +import { Form, Switch, Input, Select } from 'antd'; export default function render(props) { const { offlineAccount } = props.data; const { t, update } = props.methods; if (offlineAccount) { return (
- - - ({ label: t(`offlineAccount:v.type.${ele}`), value: ele, - }))}/> + }))} onSelect={(value) => update({ type: value })}/> - {offlineAccount.type === 'bank' && + {['bank', 'others'].includes(offlineAccount.type) && { const { value } = currentTarget; update({ channel: value, }); - }} placeholder={t('placeholder.channel.bank')}/> + }} placeholder={t(`placeholder.channel.${offlineAccount.type}`)}/> } + {!!offlineAccount.type && + { + const { value } = currentTarget; + update({ + name: value, + }); + }} placeholder={t(`placeholder.name.${offlineAccount.type}`)}/> + } + {!!offlineAccount.type && + {offlineAccount.type === 'bank' && { + const { value } = currentTarget; + update({ + qrCode: value, + }); + }} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>} + {offlineAccount.type !== 'bank' && { + const { value } = currentTarget; + update({ + qrCode: value, + }); + }} placeholder={t(`placeholder.qrCode.${offlineAccount.type}`)}/>} + } + {!!offlineAccount.type && + { + update({ allowDeposit }); + }}/> + } + {!!offlineAccount.type && + { + update({ allowPay }); + }}/> + } + + { + update({ enabled }); + }}/> + ); } } diff --git a/es/components/order/pay/index.d.ts b/es/components/order/pay/index.d.ts index 5987fbf9..7af46070 100644 --- a/es/components/order/pay/index.d.ts +++ b/es/components/order/pay/index.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from "@project/oak-app-domain"; +import { EntityDict } from "../../../oak-app-domain"; declare const _default: (props: import("oak-frontend-base").ReactComponentProps; diff --git a/es/components/pay/detail/web.pc.d.ts b/es/components/pay/detail/web.pc.d.ts index db4894f8..78c96c2e 100644 --- a/es/components/pay/detail/web.pc.d.ts +++ b/es/components/pay/detail/web.pc.d.ts @@ -1,6 +1,6 @@ import React from 'react'; import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; import { OfflinePayConfig, PayConfig } from '../../../types/PayConfig'; export declare function RenderOffline(props: { pay: RowWithActions; diff --git a/es/components/pay/list/web.pc.d.ts b/es/components/pay/list/web.pc.d.ts index eef015cf..fc3d6464 100644 --- a/es/components/pay/list/web.pc.d.ts +++ b/es/components/pay/list/web.pc.d.ts @@ -1,6 +1,6 @@ import React from 'react'; import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; import { OfflinePayConfig } from '../../../types/PayConfig'; export default function Render(props: WebComponentProps & { diff --git a/es/components/payConfig/system/index.js b/es/components/payConfig/system/index.js index 68f91119..8e34751b 100644 --- a/es/components/payConfig/system/index.js +++ b/es/components/payConfig/system/index.js @@ -1,10 +1,8 @@ -import { composeServerUrl } from 'oak-general-business/es/utils/domain'; export default OakComponent({ entity: 'system', isList: false, projection: { id: 1, - payConfig: 1, wpAccount$system: { $entity: 'wpAccount', data: { @@ -17,25 +15,12 @@ export default OakComponent({ id: 1, }, }, - domain$system: { - $entity: 'domain', - data: { - id: 1, - protocol: 1, - url: 1, - apiPath: 1, - port: 1, - }, - }, }, formData({ data, features }) { const operation = this.state.oakFullpath && this.features.runningTree.getOperations(this.state.oakFullpath); - const domain = data && data.domain$system[0]; - const serverUrl = domain && composeServerUrl(domain); return { operation: operation && operation[0].operation, system: data, - serverUrl, }; }, }); diff --git a/es/components/payConfig/system/web.pc.d.ts b/es/components/payConfig/system/web.pc.d.ts index dedb7031..7a4ed924 100644 --- a/es/components/payConfig/system/web.pc.d.ts +++ b/es/components/payConfig/system/web.pc.d.ts @@ -1,6 +1,11 @@ import React from 'react'; import { RowWithActions, WebComponentProps } from 'oak-frontend-base'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; +import { EntityDict } from '../../../oak-app-domain'; +export declare function registerPayChannelConfigDict(entity: T, component: (option: { + oakPath: string; + systemId: string; +}) => React.ReactElement): void; export default function render(props: WebComponentProps; operation?: EntityDict['system']['Update']; diff --git a/es/components/payConfig/system/web.pc.js b/es/components/payConfig/system/web.pc.js index 3d2055d9..75e624c4 100644 --- a/es/components/payConfig/system/web.pc.js +++ b/es/components/payConfig/system/web.pc.js @@ -2,20 +2,37 @@ import React, { useState } from 'react'; import { Tabs } from 'antd'; import Styles from './web.pc.module.less'; import OfflineConfig from '../../offlineAccount/config'; +import WpAccountConfig from '../../wpAccount/config'; +const PayChannelConfigDict = { + 'wpAccount': WpAccountConfig, +}; +export function registerPayChannelConfigDict(entity, component) { + PayChannelConfigDict[entity] = component; +} export default function render(props) { const { system, oakFullpath, operation, oakDirty, serverUrl, oakExecutable } = props.data; const { t, update, setMessage, execute } = props.methods; const [key, setKey] = useState(''); if (system && oakFullpath) { return (
- - {t('system')} + {t('offlineAccount:name')}
), key: 'offlineAccount', - children: (), + children: (), }, + ...Object.keys(PayChannelConfigDict).map((ele) => { + const C = PayChannelConfigDict[ele]; + return { + label: (
+ {t(`${ele}:name`)} +
), + key: 'ele', + children: + }; + }) ]}/> ); } diff --git a/es/components/payConfig/upsert/account/index.d.ts b/es/components/payConfig/upsert/account/index.d.ts index 71d1a6ef..29ac7e9f 100644 --- a/es/components/payConfig/upsert/account/index.d.ts +++ b/es/components/payConfig/upsert/account/index.d.ts @@ -1,4 +1,4 @@ -import { AccountPayConfig } from '@project/types/PayConfig'; +import { AccountPayConfig } from '../../../types/PayConfig'; import React from 'react'; export default function Account(props: { config: AccountPayConfig; diff --git a/es/components/payConfig/upsert/index.d.ts b/es/components/payConfig/upsert/index.d.ts index 5c044309..cb26e2ed 100644 --- a/es/components/payConfig/upsert/index.d.ts +++ b/es/components/payConfig/upsert/index.d.ts @@ -1,5 +1,5 @@ import React from 'react'; -import { PayConfig, ConfigBase } from '@project/types/PayConfig'; +import { PayConfig, ConfigBase } from '../../../types/PayConfig'; type FC = React.FC<{ config: T; update: (config: Omit) => void; diff --git a/es/components/payConfig/upsert/offline/index.d.ts b/es/components/payConfig/upsert/offline/index.d.ts index 348204b1..4315364f 100644 --- a/es/components/payConfig/upsert/offline/index.d.ts +++ b/es/components/payConfig/upsert/offline/index.d.ts @@ -1,5 +1,5 @@ import React from 'react'; -import { OfflinePayConfig } from '@project/types/PayConfig'; +import { OfflinePayConfig } from '../../../types/PayConfig'; export default function Offline(props: { config: OfflinePayConfig; update: (config: Omit) => void; diff --git a/es/components/payConfig/upsert/wechatPay/index.d.ts b/es/components/payConfig/upsert/wechatPay/index.d.ts index 7a53068c..f432dfd8 100644 --- a/es/components/payConfig/upsert/wechatPay/index.d.ts +++ b/es/components/payConfig/upsert/wechatPay/index.d.ts @@ -1,4 +1,4 @@ -import { WechatPayConfig } from '@project/types/PayConfig'; +import { WechatPayConfig } from '../../../types/PayConfig'; import React from 'react'; export default function WechatPay(props: { config: WechatPayConfig; diff --git a/es/components/wechatPay/upsert/index.d.ts b/es/components/wechatPay/upsert/index.d.ts new file mode 100644 index 00000000..3308b274 --- /dev/null +++ b/es/components/wechatPay/upsert/index.d.ts @@ -0,0 +1,4 @@ +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/wechatPay/upsert/index.js b/es/components/wechatPay/upsert/index.js new file mode 100644 index 00000000..64156e38 --- /dev/null +++ b/es/components/wechatPay/upsert/index.js @@ -0,0 +1,44 @@ +import { composeServerUrl } from "oak-general-business/es/utils/domain"; +export default OakComponent({ + entity: 'wechatPay', + projection: { + id: 1, + refundNotifyUrl: 1, + payNotifyUrl: 1, + system: { + id: 1, + domain$system: { + $entity: 'domain', + data: { + id: 1, + protocol: 1, + url: 1, + apiPath: 1, + port: 1, + }, + }, + } + }, + isList: false, + formData({ data }) { + const domain = data && data.system?.domain$system?.[0]; + const serverUrl = domain && composeServerUrl(domain); + return { + wechatPay: data, + serverUrl, + }; + }, + properties: { + systemId: '', + }, + lifetimes: { + ready() { + const { systemId } = this.props; + if (this.isCreation()) { + this.update({ + systemId, + }); + } + } + } +}); diff --git a/es/components/wechatPay/upsert/index.json b/es/components/wechatPay/upsert/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/wechatPay/upsert/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/wechatPay/upsert/locales/zh-CN.json b/es/components/wechatPay/upsert/locales/zh-CN.json new file mode 100644 index 00000000..a40c3784 --- /dev/null +++ b/es/components/wechatPay/upsert/locales/zh-CN.json @@ -0,0 +1,7 @@ +{ + "placeholder": { + "lossRatio": "填百分比(0.6就代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint" + } +} diff --git a/es/components/wechatPay/upsert/web.pc.d.ts b/es/components/wechatPay/upsert/web.pc.d.ts new file mode 100644 index 00000000..547223a3 --- /dev/null +++ b/es/components/wechatPay/upsert/web.pc.d.ts @@ -0,0 +1,7 @@ +import React from 'react'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +export default function render(props: WebComponentProps); + serverUrl: string; +}>): React.JSX.Element | null; diff --git a/es/components/wechatPay/upsert/web.pc.js b/es/components/wechatPay/upsert/web.pc.js new file mode 100644 index 00000000..5665a45a --- /dev/null +++ b/es/components/wechatPay/upsert/web.pc.js @@ -0,0 +1,23 @@ +import React from 'react'; +import { Form, Input } from 'antd'; +export default function render(props) { + const { wechatPay, serverUrl } = props.data; + const { t, update } = props.methods; + if (wechatPay) { + return (<> + + { + const payNotifyUrl = currentTarget.value; + update({ payNotifyUrl }); + }}/> + + + { + const refundNotifyUrl = currentTarget.value; + update({ refundNotifyUrl }); + }}/> + + ); + } + return null; +} diff --git a/es/components/withdraw/dry/Detail.mobile.d.ts b/es/components/withdraw/dry/Detail.mobile.d.ts index 4ab3a941..650013d1 100644 --- a/es/components/withdraw/dry/Detail.mobile.d.ts +++ b/es/components/withdraw/dry/Detail.mobile.d.ts @@ -1,5 +1,5 @@ /// -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; export default function Detail(props: { createAt?: string; withdrawMethod?: 'refund' | 'channel'; diff --git a/es/components/withdraw/dry/Detail.mobile.js b/es/components/withdraw/dry/Detail.mobile.js index a13d987e..f176f9f6 100644 --- a/es/components/withdraw/dry/Detail.mobile.js +++ b/es/components/withdraw/dry/Detail.mobile.js @@ -18,7 +18,7 @@ export default function Detail(props) { = 0 ? classNames(Styles.label, Styles.active) : Styles.label}>{t('steps.1.title')}} description={= 0 ? classNames(Styles.label, Styles.active) : Styles.label}>{createAt}} key="1"/> = 1 ? classNames(Styles.label, Styles.active) : Styles.label}>{t('steps.2.title')}} description={= 1 ? classNames(Styles.label, Styles.active) : Styles.label}>{t(`method.v.${withdrawMethod}`)}} key="2"/> - = 2 ? classNames(Styles.label, iState === 'failed' ? Styles.failed : Styles.success) : Styles.label}>{iState === 'failed' ? t('steps.3.failed') : (iState === 'partiallySuccess' ? t('steps.3.partiallySuccess') : t('steps.3.success'))}} key="3"/> + = 2 ? classNames(Styles.label, iState === 'failed' ? Styles.failed : Styles.success) : Styles.label}>{iState === 'failed' ? t('steps.3.failed') : (iState === 'partiallySuccessful' ? t('steps.3.partiallySuccess') : t('steps.3.success'))}} key="3"/> {refundData.map((data, idx) => (
diff --git a/es/components/withdraw/dry/Detail.pc.d.ts b/es/components/withdraw/dry/Detail.pc.d.ts index 4ab3a941..650013d1 100644 --- a/es/components/withdraw/dry/Detail.pc.d.ts +++ b/es/components/withdraw/dry/Detail.pc.d.ts @@ -1,5 +1,5 @@ /// -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../../../oak-app-domain'; export default function Detail(props: { createAt?: string; withdrawMethod?: 'refund' | 'channel'; diff --git a/es/components/withdrawChannel/list/web.pc.d.ts b/es/components/withdrawChannel/list/web.pc.d.ts index b475ae9c..cdf7030b 100644 --- a/es/components/withdrawChannel/list/web.pc.d.ts +++ b/es/components/withdrawChannel/list/web.pc.d.ts @@ -1,5 +1,5 @@ /// -import { EntityDict } from "@project/oak-app-domain"; +import { EntityDict } from "../../../oak-app-domain"; import { RowWithActions, WebComponentProps } from "oak-frontend-base"; export default function render(props: WebComponentProps[]; diff --git a/es/components/withdrawChannel/upsert/web.pc.d.ts b/es/components/withdrawChannel/upsert/web.pc.d.ts index 956d641b..f52b2cad 100644 --- a/es/components/withdrawChannel/upsert/web.pc.d.ts +++ b/es/components/withdrawChannel/upsert/web.pc.d.ts @@ -1,5 +1,5 @@ /// -import { EntityDict } from "@project/oak-app-domain"; +import { EntityDict } from "../../../oak-app-domain"; import { RowWithActions, WebComponentProps } from "oak-frontend-base"; export default function render(props: WebComponentProps; diff --git a/es/components/wpAccount/config/index.d.ts b/es/components/wpAccount/config/index.d.ts new file mode 100644 index 00000000..f10bc4d4 --- /dev/null +++ b/es/components/wpAccount/config/index.d.ts @@ -0,0 +1,3 @@ +/// +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/wpAccount/config/index.js b/es/components/wpAccount/config/index.js new file mode 100644 index 00000000..63932d55 --- /dev/null +++ b/es/components/wpAccount/config/index.js @@ -0,0 +1,18 @@ +export default OakComponent({ + entity: 'wpAccount', + isList: true, + projection: { + id: 1, + price: 1, + mchId: 1, + refundGapDays: 1, + enabled: 1, + }, + formData({ data, legalActions }) { + return { + accounts: data, + canCreate: legalActions?.includes('create'), + }; + }, + actions: ['create', 'update', 'remove'], +}); diff --git a/es/components/wpAccount/config/index.json b/es/components/wpAccount/config/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/wpAccount/config/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/wpAccount/config/locales/zh-CN.json b/es/components/wpAccount/config/locales/zh-CN.json new file mode 100644 index 00000000..a0e1a56a --- /dev/null +++ b/es/components/wpAccount/config/locales/zh-CN.json @@ -0,0 +1,7 @@ +{ + "tips": "微信支付账户是用来配置微信支付的账户相关信息", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" +} diff --git a/es/components/wpAccount/config/web.pc.d.ts b/es/components/wpAccount/config/web.pc.d.ts new file mode 100644 index 00000000..5bfc4fab --- /dev/null +++ b/es/components/wpAccount/config/web.pc.d.ts @@ -0,0 +1,8 @@ +import React from 'react'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +export default function render(props: WebComponentProps & {})[]; + systemId: string; + canCreate?: boolean; +}>): React.JSX.Element; diff --git a/es/components/wpAccount/config/web.pc.js b/es/components/wpAccount/config/web.pc.js new file mode 100644 index 00000000..31d44ee3 --- /dev/null +++ b/es/components/wpAccount/config/web.pc.js @@ -0,0 +1,110 @@ +import React, { useState } from 'react'; +import { Button, Modal, Alert, Descriptions, Tabs } from 'antd'; +import { PlusCircleOutlined } from '@ant-design/icons'; +import Styles from './web.pc.module.less'; +import Upsert from '../upsert'; +import WpProductConfig from '../../wpProduct/config'; +import { OakAttrNotNullException, OakException } from 'oak-domain/lib/types'; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; +function WpAccount(props) { + const { account, t, onUpdate, onRemove, oakFullpath, systemId } = props; + const { refundGapDays, mchId, enabled, price } = account; + const legalActions = account['#oakLegalActions']; + const [activeKey, setActiveKey] = useState("1"); + return ( { + setActiveKey(activeKey); + }} tabBarExtraContent={activeKey === "1" && <> + {legalActions.includes('update') && } + {legalActions.includes('remove') && } + } style={{ width: 380, height: 520 }} items={[ + { + key: '1', + label: t('common::action.detail'), + children: ( + {mchId} + {price} + {refundGapDays} + {t(`common::${enabled}`)} + ) + }, + { + key: '2', + label: t('wpProduct:name'), + children: () + } + ]}/>); +} +export default function render(props) { + const { accounts, oakFullpath, oakExecutable, canCreate, systemId } = props.data; + const { t, addItem, execute, clean } = props.methods; + const getNotNullMessage = (entity, attr) => { + return t('notnull', { value: t(`${entity}:attr.${attr}`) }); + }; + const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message)); + const [upsertId, setUpsertId] = useState(''); + const U = ( { + clean(); + setUpsertId(''); + }} closeIcon={null} onOk={async () => { + await execute(); + setUpsertId(''); + }} okButtonProps={{ + disabled: oakExecutable !== true, + }} okText={t('common::confirm')} cancelText={(t('common::action.cancel'))}> +
+ {errMsg && } + +
+
); + if (accounts && accounts?.length) { + return (
+ + {U} +
+ {accounts.filter(ele => ele.$$createAt$$ > 1).map((ele, idx) =>
+ { + Modal.confirm({ + title: t('confirmDelete'), + content: t('areYouSure'), + onOk: async () => execute(undefined, undefined, undefined, [ + { + entity: 'wpAccount', + operation: { + id: await generateNewIdAsync(), + action: 'remove', + data: {}, + filter: { + id: ele.id, + }, + } + } + ]), + }); + }} onUpdate={() => setUpsertId(ele.id)}/> +
)} +
+
+ {canCreate && } +
+
); + } + return (
+ + {U} +
+ {canCreate ? { + const id = addItem({ systemId }); + setUpsertId(id); + }}/> : t('noData')} +
+
); +} diff --git a/es/components/wpAccount/upsert/index.d.ts b/es/components/wpAccount/upsert/index.d.ts new file mode 100644 index 00000000..d6bc658a --- /dev/null +++ b/es/components/wpAccount/upsert/index.d.ts @@ -0,0 +1,4 @@ +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/wpAccount/upsert/index.js b/es/components/wpAccount/upsert/index.js new file mode 100644 index 00000000..21b00130 --- /dev/null +++ b/es/components/wpAccount/upsert/index.js @@ -0,0 +1,70 @@ +export default OakComponent({ + entity: 'wpAccount', + isList: false, + projection: { + id: 1, + price: 1, + mchId: 1, + refundGapDays: 1, + enabled: 1, + wechatPay: { + id: 1, + payNotifyUrl: 1, + refundNotifyUrl: 1, + }, + taxlossRatio: 1, + publicKeyFilePath: 1, + privateKeyFilePath: 1, + refundLossFloor: 1, + refundLossRatio: 1, + apiV3Key: 1, + systemId: 1, + }, + formData({ data, features }) { + const { systemId } = this.props; + const [wechatPay] = features.cache.get('wechatPay', { + data: { + id: 1, + refundNotifyUrl: 1, + payNotifyUrl: 1, + }, + filter: { + systemId, + } + }); + return { + wpAccount: data, + wechatPay, + }; + }, + properties: { + systemId: '', + }, + lifetimes: { + async ready() { + if (this.isCreation()) { + this.update({ + price: 0, + enabled: true, + taxlossRatio: 0.6, + }); + const { systemId } = this.props; + const { data: [wechatPay] } = await this.features.cache.refresh('wechatPay', { + data: { + id: 1, + refundNotifyUrl: 1, + payNotifyUrl: 1, + }, + filter: { + systemId, + } + }); + if (wechatPay) { + this.update({ + wechatPayId: wechatPay.id, + }); + } + } + } + } +}); diff --git a/es/components/wpAccount/upsert/index.json b/es/components/wpAccount/upsert/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/wpAccount/upsert/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/wpAccount/upsert/locales/zh-CN.json b/es/components/wpAccount/upsert/locales/zh-CN.json new file mode 100644 index 00000000..b91b08e4 --- /dev/null +++ b/es/components/wpAccount/upsert/locales/zh-CN.json @@ -0,0 +1,14 @@ +{ + "placeholder": { + "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", + "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", + "taxlossRatio": "微信支付收取的手续费,一般为0.6(代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint", + "apiV3Key": "需要登录商户后台获取", + "refundGapDays": "超过这个天数后无法退款", + "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", + "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" + }, + "wechatPayIsShared": "以上配置是全局的,请谨慎修改" +} diff --git a/es/components/wpAccount/upsert/web.pc.d.ts b/es/components/wpAccount/upsert/web.pc.d.ts new file mode 100644 index 00000000..ba91c5f9 --- /dev/null +++ b/es/components/wpAccount/upsert/web.pc.d.ts @@ -0,0 +1,8 @@ +import React from 'react'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +export default function render(props: WebComponentProps & {}); + wechatPay?: EntityDict['wechatPay']['OpSchema']; + systemId: string; +}>): React.JSX.Element | null; diff --git a/es/components/wpAccount/upsert/web.pc.js b/es/components/wpAccount/upsert/web.pc.js new file mode 100644 index 00000000..cf673d5b --- /dev/null +++ b/es/components/wpAccount/upsert/web.pc.js @@ -0,0 +1,78 @@ +import React from 'react'; +import { Form, Switch, InputNumber, Input, Radio, Divider } from 'antd'; +import Styles from './web.pc.module.less'; +import WechatPayUpsert from '../../wechatPay/upsert'; +export default function render(props) { + const { wpAccount, wechatPay, oakFullpath, systemId } = props.data; + const { t, update } = props.methods; + if (wpAccount) { + return (
+ {(!wechatPay || wechatPay.$$createAt$$ === 1) && } + {wpAccount.wechatPayId && } + +
+ {t('wechatPayIsShared')} +
+
+ + + { + const mchId = currentTarget.value; + update({ mchId }); + }}/> + + + { + const privateKeyFilePath = currentTarget.value; + update({ privateKeyFilePath }); + }}/> + + + { + const publicKeyFilePath = currentTarget.value; + update({ publicKeyFilePath }); + }}/> + + + { + const apiV3Key = currentTarget.value; + update({ apiV3Key }); + }}/> + + + { + const taxlossRatio = value; + update({ taxlossRatio }); + }}/> + + + { + const refundGapDays = value; + update({ refundGapDays }); + }}/> + + + { + const refundLossRatio = value; + update({ refundLossRatio }); + }}/> + + + { + const { value } = target; + const refundLossFloor = value; + update({ refundLossFloor }); + }} value={wpAccount.refundLossFloor}> + + + + + + { + update({ enabled }); + }}/> + + ); + } + return null; +} diff --git a/es/components/wpProduct/config/index.d.ts b/es/components/wpProduct/config/index.d.ts new file mode 100644 index 00000000..77310893 --- /dev/null +++ b/es/components/wpProduct/config/index.d.ts @@ -0,0 +1,5 @@ +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/wpProduct/config/index.js b/es/components/wpProduct/config/index.js new file mode 100644 index 00000000..0bc37fff --- /dev/null +++ b/es/components/wpProduct/config/index.js @@ -0,0 +1,51 @@ +export default OakComponent({ + entity: 'wpProduct', + isList: true, + projection: { + id: 1, + type: 1, + wpAccountId: 1, + applicationId: 1, + application: { + id: 1, + type: 1, + name: 1, + }, + }, + filters: [ + { + filter() { + const { wpAccountId } = this.props; + return { + wpAccountId, + }; + } + } + ], + properties: { + systemId: '', + wpAccountId: '', + }, + formData({ data, legalActions }) { + return { + wpProducts: data, + canCreate: legalActions?.includes('create'), + }; + }, + actions: ['create', 'update', 'remove'], + lifetimes: { + ready() { + const { systemId } = this.props; + this.features.cache.refresh('application', { + data: { + id: 1, + name: 1, + type: 1, + }, + filter: { + systemId, + }, + }); + } + } +}); diff --git a/es/components/wpProduct/config/index.json b/es/components/wpProduct/config/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/wpProduct/config/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/wpProduct/config/locales/zh-CN.json b/es/components/wpProduct/config/locales/zh-CN.json new file mode 100644 index 00000000..cf139318 --- /dev/null +++ b/es/components/wpProduct/config/locales/zh-CN.json @@ -0,0 +1,6 @@ +{ + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" +} diff --git a/es/components/wpProduct/config/web.pc.d.ts b/es/components/wpProduct/config/web.pc.d.ts new file mode 100644 index 00000000..6beadb44 --- /dev/null +++ b/es/components/wpProduct/config/web.pc.d.ts @@ -0,0 +1,9 @@ +import React from 'react'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +export default function render(props: WebComponentProps & {})[]; + systemId: string; + canCreate?: boolean; + wpAccountId: string; +}>): React.JSX.Element; diff --git a/es/components/wpProduct/config/web.pc.js b/es/components/wpProduct/config/web.pc.js new file mode 100644 index 00000000..61f02eb5 --- /dev/null +++ b/es/components/wpProduct/config/web.pc.js @@ -0,0 +1,79 @@ +import React, { useState } from 'react'; +import { Button, Modal, Alert } from 'antd'; +import { PlusCircleOutlined } from '@ant-design/icons'; +import Styles from './web.pc.module.less'; +import Upsert from '../upsert'; +import { OakAttrNotNullException, OakException } from 'oak-domain/lib/types'; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; +function WpProduct(props) { + return null; +} +export default function render(props) { + const { wpAccountId, wpProducts, oakFullpath, oakExecutable, canCreate, systemId } = props.data; + const { t, addItem, execute, clean } = props.methods; + const getNotNullMessage = (entity, attr) => { + return t('notnull', { value: t(`${entity}:attr.${attr}`) }); + }; + const errMsg = oakExecutable instanceof OakException && (oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity(), oakExecutable.getAttributes()[0]) : t(oakExecutable.message)); + const [upsertId, setUpsertId] = useState(''); + const U = ( { + clean(); + setUpsertId(''); + }} closeIcon={null} onOk={async () => { + await execute(); + setUpsertId(''); + }} okButtonProps={{ + disabled: oakExecutable !== true, + }} okText={t('common::confirm')} cancelText={(t('common::action.cancel'))}> +
+ {errMsg && } + +
+
); + if (wpProducts && wpProducts.length) { + return (
+ + {U} +
+ {wpProducts.filter(ele => ele.$$createAt$$ > 1).map((ele, idx) =>
+ { + Modal.confirm({ + title: t('confirmDelete'), + content: t('areYouSure'), + onOk: async () => execute(undefined, undefined, undefined, [ + { + entity: 'wpProduct', + operation: { + id: await generateNewIdAsync(), + action: 'remove', + data: {}, + filter: { + id: ele.id, + }, + } + } + ]), + }); + }} onUpdate={() => setUpsertId(ele.id)}/> +
)} +
+
+ {canCreate && } +
+
); + } + return (
+ {U} +
+ {canCreate ? { + const id = addItem({}); + setUpsertId(id); + }}/> : t('noData')} +
+
); +} diff --git a/es/components/wpProduct/upsert/index.d.ts b/es/components/wpProduct/upsert/index.d.ts new file mode 100644 index 00000000..5f76448c --- /dev/null +++ b/es/components/wpProduct/upsert/index.d.ts @@ -0,0 +1,5 @@ +declare const _default: (props: import("oak-frontend-base").ReactComponentProps) => React.ReactElement; +export default _default; diff --git a/es/components/wpProduct/upsert/index.js b/es/components/wpProduct/upsert/index.js new file mode 100644 index 00000000..2e053844 --- /dev/null +++ b/es/components/wpProduct/upsert/index.js @@ -0,0 +1,53 @@ +import { getAppTypeFromProductType } from "../../../utils/wpProduct"; +export default OakComponent({ + entity: 'wpProduct', + isList: false, + projection: { + id: 1, + type: 1, + wpAccountId: 1, + applicationId: 1, + application: { + id: 1, + type: 1, + name: 1, + }, + }, + properties: { + systemId: '', + wpAccountId: '', + }, + formData({ data, features }) { + const { systemId } = this.props; + const applications = data?.type && features.cache.get('application', { + data: { + id: 1, + name: 1, + type: 1, + }, + filter: { + systemId, + wpProduct$application: { + "#sqp": 'not in', + }, + type: { + $in: getAppTypeFromProductType(data.type), + } + } + }); + return { + applications, + wpProduct: data, + }; + }, + lifetimes: { + ready() { + if (this.isCreation()) { + const { wpAccountId } = this.props; + this.update({ + wpAccountId, + }); + } + } + } +}); diff --git a/es/components/wpProduct/upsert/index.json b/es/components/wpProduct/upsert/index.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/es/components/wpProduct/upsert/index.json @@ -0,0 +1 @@ +{} diff --git a/es/components/wpProduct/upsert/web.pc.d.ts b/es/components/wpProduct/upsert/web.pc.d.ts new file mode 100644 index 00000000..04c85011 --- /dev/null +++ b/es/components/wpProduct/upsert/web.pc.d.ts @@ -0,0 +1,8 @@ +import React from 'react'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +export default function render(props: WebComponentProps & {}); + applications?: EntityDict['application']['OpSchema'][]; + systemId: string; +}>): React.JSX.Element | null; diff --git a/es/components/wpProduct/upsert/web.pc.js b/es/components/wpProduct/upsert/web.pc.js new file mode 100644 index 00000000..1680a173 --- /dev/null +++ b/es/components/wpProduct/upsert/web.pc.js @@ -0,0 +1,23 @@ +import React from 'react'; +import { Form, Select } from 'antd'; +export default function render(props) { + const { wpProduct, applications, oakFullpath, systemId } = props.data; + const { t, update } = props.methods; + if (wpProduct) { + return (
+ + ({ + label: ele.name, + value: ele.id, + }))} onSelect={(value) => update({ applicationId: value })}/> + )} +
); + } + return null; +} diff --git a/es/configuration/attrUpdateMatrix.d.ts b/es/configuration/attrUpdateMatrix.d.ts index 1f9d800f..e2fb199f 100644 --- a/es/configuration/attrUpdateMatrix.d.ts +++ b/es/configuration/attrUpdateMatrix.d.ts @@ -1,4 +1,4 @@ import { AttrUpdateMatrix } from 'oak-domain/lib/types/EntityDesc'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const attrUpdateMatrix: AttrUpdateMatrix; export default attrUpdateMatrix; diff --git a/es/configuration/attrUpdateMatrix.js b/es/configuration/attrUpdateMatrix.js index 29cea1e3..c6036afa 100644 --- a/es/configuration/attrUpdateMatrix.js +++ b/es/configuration/attrUpdateMatrix.js @@ -61,6 +61,70 @@ const attrUpdateMatrix = { meta: { actions: ['succeed', 'fail', 'succeedPartially'], }, - } + }, + offlineAccount: { + name: { + actions: ['update'], + filter: { + // 只有从来没用过的才能改 + sysAccountOper$entity: { + "#sqp": 'not in', + } + } + }, + channel: { + actions: ['update'], + filter: { + // 只有从来没用过的才能改 + sysAccountOper$entity: { + "#sqp": 'not in', + } + } + }, + qrCode: { + actions: ['update'], + }, + enabled: { + actions: ['update'], + }, + price: { + actions: ['pay', 'refund', 'deposit', 'withdraw', 'tax'], + } + }, + wpAccount: { + wechatPay: { + actions: ['update'], + }, + taxlossRatio: { + actions: ['update'], + }, + depositLossRatio: { + actions: ['update'], + }, + refundGapDays: { + actions: ['update'], + }, + refundLossRatio: { + actions: ['update'], + }, + refundLossFloor: { + actions: ['update'], + }, + publicKeyFilePath: { + actions: ['update'], + }, + privateKeyFilePath: { + actions: ['update'], + }, + apiV3Key: { + actions: ['update'], + }, + enabled: { + actions: ['update'], + }, + price: { + actions: ['pay', 'refund', 'deposit', 'withdraw', 'tax'], + } + }, }; export default attrUpdateMatrix; diff --git a/es/configuration/cache.d.ts b/es/configuration/cache.d.ts index 9a57f1b0..0189e1d1 100644 --- a/es/configuration/cache.d.ts +++ b/es/configuration/cache.d.ts @@ -1,3 +1,3 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const cacheSavedEntities: (keyof EntityDict)[]; export default cacheSavedEntities; diff --git a/es/configuration/index.d.ts b/es/configuration/index.d.ts index d92b8134..dc4a26a5 100644 --- a/es/configuration/index.d.ts +++ b/es/configuration/index.d.ts @@ -1,4 +1,4 @@ import { CommonConfiguration } from 'oak-domain/lib/types/Configuration'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const _default: CommonConfiguration; export default _default; diff --git a/es/configuration/index.js b/es/configuration/index.js index 13e41504..24d2e36d 100644 --- a/es/configuration/index.js +++ b/es/configuration/index.js @@ -2,7 +2,7 @@ * index中汇总了前端启动需要的引用配置 */ import attrUpdateMatrix from './attrUpdateMatrix'; -import { actionDefDict } from '@project/oak-app-domain/ActionDefDict'; +import { actionDefDict } from '../oak-app-domain/ActionDefDict'; import { selectFreeEntities, authDeduceRelationMap, updateFreeDict } from './relation'; import cacheSavedEntities from './cache'; export default { diff --git a/es/configuration/relation.d.ts b/es/configuration/relation.d.ts index 3230f46e..35709b70 100644 --- a/es/configuration/relation.d.ts +++ b/es/configuration/relation.d.ts @@ -1,5 +1,5 @@ import { AuthDeduceRelationMap, UpdateFreeDict } from 'oak-domain/lib/types/Entity'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; export declare const authDeduceRelationMap: AuthDeduceRelationMap; export declare const selectFreeEntities: string[]; export declare const updateFreeDict: UpdateFreeDict; diff --git a/es/configuration/relation.js b/es/configuration/relation.js index 726d9e02..ca749e04 100644 --- a/es/configuration/relation.js +++ b/es/configuration/relation.js @@ -1,7 +1,8 @@ // 此对象所标识的entity的权限由其外键指向的父对象判定 export const authDeduceRelationMap = {}; export const selectFreeEntities = [ - 'payChannel', + 'offlineAccount', + 'wpProduct', ]; export const updateFreeDict = {}; export default { diff --git a/es/configuration/render.d.ts b/es/configuration/render.d.ts index eccbd37b..06b97f82 100644 --- a/es/configuration/render.d.ts +++ b/es/configuration/render.d.ts @@ -1,4 +1,4 @@ import { RenderConfiguration } from 'oak-domain/lib/types/Configuration'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const _default: RenderConfiguration; export default _default; diff --git a/es/context/BackendRuntimeContext.d.ts b/es/context/BackendRuntimeContext.d.ts index f4062fa4..d2a9c518 100644 --- a/es/context/BackendRuntimeContext.d.ts +++ b/es/context/BackendRuntimeContext.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; import { RuntimeContext } from './RuntimeContext'; import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; diff --git a/es/context/BackendRuntimeContext.js b/es/context/BackendRuntimeContext.js index 3f0fe574..cca9a33e 100644 --- a/es/context/BackendRuntimeContext.js +++ b/es/context/BackendRuntimeContext.js @@ -1,5 +1,5 @@ import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; -import { mergedProjection } from '@project/utils/application'; +import { mergedProjection } from '../utils/application'; export class BackendRuntimeContext extends DependentBackendRuntimeContext { applicationProjection = mergedProjection; async toString() { @@ -21,6 +21,4 @@ export class BackendRuntimeContext extends DependentBackendRuntimeContext { } } ; - -console.log('aaaa'); export default BackendRuntimeContext; diff --git a/es/context/FrontendRuntimeContext.d.ts b/es/context/FrontendRuntimeContext.d.ts index 84022845..469bf7c4 100644 --- a/es/context/FrontendRuntimeContext.d.ts +++ b/es/context/FrontendRuntimeContext.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from './DependentContext'; import { RuntimeContext } from './RuntimeContext'; diff --git a/es/data/actionAuth.d.ts b/es/data/actionAuth.d.ts index 6d24ca70..41f922ec 100644 --- a/es/data/actionAuth.d.ts +++ b/es/data/actionAuth.d.ts @@ -1,3 +1,3 @@ -import { CreateOperationData as ActionAuth } from '@project/oak-app-domain/ActionAuth/Schema'; +import { CreateOperationData as ActionAuth } from '../oak-app-domain/ActionAuth/Schema'; declare const actionAuths: ActionAuth[]; export default actionAuths; diff --git a/es/data/i18n.js b/es/data/i18n.js index 6a69fff2..ea045c43 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -53,6 +53,20 @@ const i18ns = [ position: "src/components/accountOper/list", data: {} }, + { + id: "50388a328d027544c140578a7a614845", + namespace: "oak-pay-business-c-offlineAccount-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/offlineAccount/config", + data: { + "tips": "线下账户是需要system的相关工作人员手动同步收款和打款结果的账户", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, { id: "17cdc7adc4c7b439ae2298a7f9920855", namespace: "oak-pay-business-c-offlineAccount-upsert", @@ -60,16 +74,29 @@ const i18ns = [ module: "oak-pay-business", position: "src/components/offlineAccount/upsert", data: { - "tips": "线下交易账户是需要人工同步收款和打款行为的账户", - "label": { - "channel": { - "bank": "银行及所属支行" - } - }, "placeholder": { "channel": { - "bank": "银行-所属支行" + "bank": "银行/支行", + "others": "请输入途径名称" + }, + "name": { + "bank": "输入户主姓名", + "alipay": "输入支付宝帐号", + "wechat": "输入微信号", + "shouqianba": "输入收钱吧商户号", + "others": "输入该收款途径的唯一账号" + }, + "qrCode": { + "bank": "请输入银行账号", + "alipay": "请将二维码解析后的字符串填入", + "wechat": "请将二维码解析后的字符串填入", + "shouqianba": "请将二维码解析后的字符串填入", + "others": "请将二维码解析后的字符串填入" } + }, + "help": { + "allowDeposit": "是否允许用户在系统中主动向此账号发起充值", + "allowPay": "是否允许用户在系统中主动向此账号发起支付" } } }, @@ -264,6 +291,20 @@ const i18ns = [ } } }, + { + id: "79255be8c093dfef9765b3f367cab553", + namespace: "oak-pay-business-c-wechatPay-upsert", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wechatPay/upsert", + data: { + "placeholder": { + "lossRatio": "填百分比(0.6就代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint" + } + } + }, { id: "6a1df36d072d367121b49dfc665b4100", namespace: "oak-pay-business-c-withdraw-create", @@ -399,6 +440,54 @@ const i18ns = [ } } }, + { + id: "7273f5a9fdb45407416554325a1abb1e", + namespace: "oak-pay-business-c-wpAccount-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpAccount/config", + data: { + "tips": "微信支付账户是用来配置微信支付的账户相关信息", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, + { + id: "33691d391e052cccf005d0f0da84e20e", + namespace: "oak-pay-business-c-wpAccount-upsert", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpAccount/upsert", + data: { + "placeholder": { + "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", + "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", + "taxlossRatio": "微信支付收取的手续费,一般为0.6(代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint", + "apiV3Key": "需要登录商户后台获取", + "refundGapDays": "超过这个天数后无法退款", + "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", + "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" + }, + "wechatPayIsShared": "以上配置是全局的,请谨慎修改" + } + }, + { + id: "634284beff0e0bdf84fb23cdeea9107d", + namespace: "oak-pay-business-c-wpProduct-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpProduct/config", + data: { + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, { id: "2127948cb52e116e3ceccd93db8f319c", namespace: "oak-pay-business-l-common", @@ -470,6 +559,38 @@ const i18ns = [ } } }, + { + id: "8ff2d28d93f47ceaa08aab6211449db8", + namespace: "oak-pay-business-l-offlineAccount", + language: "zh-CN", + module: "oak-pay-business", + position: "locales/offlineAccount", + data: { + "label": { + "channel": { + "bank": "银行及所属支行", + "others": "途径名" + }, + "name": { + "bank": "户主姓名", + "alipay": "支付宝账号", + "wechat": "微信号", + "shouqianba": "收钱吧商户号", + "others": "相应帐号" + }, + "qrCode": { + "bank": "银行账号", + "alipay": "收款二维码", + "wechat": "收款二维码", + "shouqianba": "收款二维码", + "others": "收款二维码" + } + }, + "error": { + "nameQrCodeBothNull": "账号名和二维码不能同时为空" + } + } + }, { id: "e8c0a965783373d9117f9447ebbbad8d", namespace: "oak-pay-business-l-payChannel", diff --git a/es/data/path.d.ts b/es/data/path.d.ts index a5c1abca..f1acfd9e 100644 --- a/es/data/path.d.ts +++ b/es/data/path.d.ts @@ -1,3 +1,3 @@ -import { CreateOperationData as Path } from '@project/oak-app-domain/Path/Schema'; +import { CreateOperationData as Path } from '../oak-app-domain/Path/Schema'; declare const paths: Path[]; export default paths; diff --git a/es/entities/OfflineAccount.d.ts b/es/entities/OfflineAccount.d.ts index f8527159..419b9a4c 100644 --- a/es/entities/OfflineAccount.d.ts +++ b/es/entities/OfflineAccount.d.ts @@ -1,8 +1,9 @@ -import { String, Text, Boolean } from 'oak-domain/lib/types/DataType'; +import { String, Text, Price, Boolean } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as System } from 'oak-general-business/lib/entities/System'; import { Schema as Pay } from './Pay'; +import { Schema as SysAccountOper } from './SysAccountOper'; export interface Schema extends EntityShape { type: 'bank' | 'alipay' | 'wechat' | 'shouqianba' | 'others'; channel?: String<32>; @@ -11,8 +12,12 @@ export interface Schema extends EntityShape { allowDeposit: Boolean; allowPay: Boolean; system: System; + price: Price; pays: Pay[]; + opers: SysAccountOper[]; + enabled: Boolean; } -export declare const entityDesc: EntityDesc; diff --git a/es/entities/OfflineAccount.js b/es/entities/OfflineAccount.js index 8681ce5e..ecf56324 100644 --- a/es/entities/OfflineAccount.js +++ b/es/entities/OfflineAccount.js @@ -2,7 +2,7 @@ export const entityDesc = { locales: { zh_CN: { - name: '离线账号管理', + name: '线下账户', attr: { type: '类型', channel: '通道', @@ -11,7 +11,10 @@ export const entityDesc = { allowDeposit: '允许主动充值', allowPay: '允许主动支付', system: '所属系统', + price: '余额', pays: '支付', + opers: '操作记录', + enabled: '是否启用', }, v: { type: { @@ -22,17 +25,31 @@ export const entityDesc = { others: '其它', }, }, + action: { + pay: '支付', + refund: '退款', + deposit: '充值', + withdraw: '提现', + tax: '渠道费', + } }, }, style: { color: { type: { bank: '#E74C3C', - alipay: '#3498DB', - wechat: '#27AE60', - shouqianba: '#F1C40F', + alipay: '#1678ff', + wechat: '#04BE02', + shouqianba: '#ffc106', others: '#34495E', }, }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', + } }, }; diff --git a/es/entities/SysAccountOper.d.ts b/es/entities/SysAccountOper.d.ts new file mode 100644 index 00000000..8d98b7c8 --- /dev/null +++ b/es/entities/SysAccountOper.d.ts @@ -0,0 +1,12 @@ +import { String, Price } from 'oak-domain/lib/types/DataType'; +import { EntityShape } from 'oak-domain/lib/types/Entity'; +import { EntityDesc } from 'oak-domain/lib/types'; +export interface Schema extends EntityShape { + delta: Price; + type: 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; + entity: String<32>; + entityId: String<64>; +} +export declare const entityDesc: EntityDesc; diff --git a/es/entities/SysAccountOper.js b/es/entities/SysAccountOper.js new file mode 100644 index 00000000..2b2856c8 --- /dev/null +++ b/es/entities/SysAccountOper.js @@ -0,0 +1,37 @@ +; +export const entityDesc = { + locales: { + zh_CN: { + name: '系统账户操作', + attr: { + type: '类型', + delta: '余额变化', + entity: '关联对象', + entityId: '关联对象Id', + }, + v: { + type: { + deposit: '充值', + withdraw: '提现', + pay: '支付', + refund: '退款', + tax: '渠道手续费' + }, + }, + }, + }, + style: { + color: { + type: { + deposit: '#3498DB', + withdraw: '#F7DC6F', + pay: '#82E0AA', + tax: '#2E4053', + refund: '#2E4053', + } + } + }, + configuration: { + actionType: 'appendOnly', + } +}; diff --git a/es/entities/WechatPay.d.ts b/es/entities/WechatPay.d.ts index 8851471b..0beb08ce 100644 --- a/es/entities/WechatPay.d.ts +++ b/es/entities/WechatPay.d.ts @@ -1,9 +1,10 @@ -import { String, Decimal } from 'oak-domain/lib/types/DataType'; +import { String } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; +import { Schema as System } from 'oak-general-business/lib/entities/System'; export interface Schema extends EntityShape { payNotifyUrl: String<128>; refundNotifyUrl: String<128>; - lossRatio: Decimal<4, 2>; + system: System; } export declare const entityDesc: EntityDesc; diff --git a/es/entities/WechatPay.js b/es/entities/WechatPay.js index 5e3f303a..537da65c 100644 --- a/es/entities/WechatPay.js +++ b/es/entities/WechatPay.js @@ -6,7 +6,7 @@ export const entityDesc = { attr: { payNotifyUrl: '支付通知回调', refundNotifyUrl: '退款通知回调', - lossRatio: '支付损耗比例' + system: '关联系统' }, }, }, diff --git a/es/entities/WpAccount.d.ts b/es/entities/WpAccount.d.ts index 93f267a8..2851ab37 100644 --- a/es/entities/WpAccount.d.ts +++ b/es/entities/WpAccount.d.ts @@ -1,10 +1,12 @@ -import { String, Text, Price, Int, Decimal } from 'oak-domain/lib/types/DataType'; +import { String, Text, Price, Boolean, Int, Decimal } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as WechatPay } from './WechatPay'; import { Schema as System } from 'oak-general-business/lib/entities/System'; +import { Schema as SysAccountOper } from './SysAccountOper'; export interface Schema extends EntityShape { wechatPay: WechatPay; + taxlossRatio: Decimal<4, 2>; depositLossRatio?: Decimal<4, 2>; refundGapDays?: Int<4>; refundLossRatio?: Decimal<4, 2>; @@ -15,7 +17,10 @@ export interface Schema extends EntityShape { apiV3Key: String<32>; price: Price; system: System; + opers: SysAccountOper[]; + enabled: Boolean; } -export declare const entityDesc: EntityDesc; }>; diff --git a/es/entities/WpAccount.js b/es/entities/WpAccount.js index f7e87fa5..59761de8 100644 --- a/es/entities/WpAccount.js +++ b/es/entities/WpAccount.js @@ -5,6 +5,7 @@ export const entityDesc = { name: '微信支付帐号', attr: { wechatPay: '微信支付', + taxlossRatio: '商户号手续费(百分比)', depositLossRatio: '充值损耗百分比', refundGapDays: '(支付后)允许退款的天数', refundLossRatio: '退款损耗百分比', @@ -14,13 +15,22 @@ export const entityDesc = { privateKeyFilePath: '私钥文件路径', apiV3Key: 'apiV3Key', price: '余额', - system: '关联系统' + system: '关联系统', + opers: '操作记录', + enabled: '是否启用', }, v: { refundLossFloor: { yuan: '元', jiao: '角' }, + }, + action: { + pay: '支付', + refund: '退款', + deposit: '充值', + withdraw: '提现', + tax: '渠道费', } }, }, @@ -30,6 +40,13 @@ export const entityDesc = { yuan: '#FFFF00', jiao: '#00FF00' } + }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', } } }; diff --git a/es/entities/WpProduct.d.ts b/es/entities/WpProduct.d.ts index b3f2a6ac..4ecd87b3 100644 --- a/es/entities/WpProduct.d.ts +++ b/es/entities/WpProduct.d.ts @@ -1,3 +1,4 @@ +import { Boolean } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as WpAccount } from './WpAccount'; @@ -7,6 +8,7 @@ export interface Schema extends EntityShape { wpAccount: WpAccount; type: 'native' | 'mp' | 'jsapi' | 'h5' | 'app'; application: Application; + enabled: Boolean; pays: Pay[]; } export declare const entityDesc: EntityDesc['application']); diff --git a/es/features/Pay.js b/es/features/Pay.js index f079b353..4ac09197 100644 --- a/es/features/Pay.js +++ b/es/features/Pay.js @@ -1,5 +1,5 @@ import { Feature } from "oak-frontend-base"; -// import { getDepositRatio } from "@project/utils/pay"; +// import { getDepositRatio } from "../utils/pay"; export default class Pay extends Feature { application; constructor(application) { diff --git a/es/features/index.d.ts b/es/features/index.d.ts index a57b00a4..6f8bd326 100644 --- a/es/features/index.d.ts +++ b/es/features/index.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { AccessConfiguration } from 'oak-domain/lib/types/Configuration'; import { BasicFeatures } from 'oak-frontend-base'; import { FeatureDict as Ogb0FeatureDict } from "oak-general-business"; diff --git a/es/features/index.js b/es/features/index.js index c5b2b9bb..380f4e7b 100644 --- a/es/features/index.js +++ b/es/features/index.js @@ -1,7 +1,7 @@ import { merge } from 'oak-domain/lib/utils/lodash'; import { initialize as initializeGeneral } from 'oak-general-business/es/features'; import Pay from './Pay'; -import { applicationProjection } from '@project/utils/application'; +import { applicationProjection } from '../utils/application'; export function create(features) { const pay = new Pay(features.application); return { diff --git a/es/hooks/useFeatures.d.ts b/es/hooks/useFeatures.d.ts index 5e78bfa8..783fdd89 100644 --- a/es/hooks/useFeatures.d.ts +++ b/es/hooks/useFeatures.d.ts @@ -1,2 +1,2 @@ -import { AFD } from '@project/types/RuntimeCxt'; +import { AFD } from '../types/RuntimeCxt'; export default function useFeatures(): AFD; diff --git a/es/locales/offlineAccount/zh-CN.json b/es/locales/offlineAccount/zh-CN.json new file mode 100644 index 00000000..4bf98003 --- /dev/null +++ b/es/locales/offlineAccount/zh-CN.json @@ -0,0 +1,25 @@ +{ + "label": { + "channel": { + "bank": "银行及所属支行", + "others": "途径名" + }, + "name": { + "bank": "户主姓名", + "alipay": "支付宝账号", + "wechat": "微信号", + "shouqianba": "收钱吧商户号", + "others": "相应帐号" + }, + "qrCode": { + "bank": "银行账号", + "alipay": "收款二维码", + "wechat": "收款二维码", + "shouqianba": "收款二维码", + "others": "收款二维码" + } + }, + "error": { + "nameQrCodeBothNull": "账号名和二维码不能同时为空" + } +} diff --git a/es/oak-app-domain/ActionDefDict.d.ts b/es/oak-app-domain/ActionDefDict.d.ts index 5892bd9b..bb83c723 100644 --- a/es/oak-app-domain/ActionDefDict.d.ts +++ b/es/oak-app-domain/ActionDefDict.d.ts @@ -42,6 +42,7 @@ export declare const actionDefDict: { deposit: { iState: import("oak-domain/lib/types").ActionDef; }; + offlineAccount: {}; order: { iState: import("oak-domain/lib/types").ActionDef; }; @@ -58,4 +59,5 @@ export declare const actionDefDict: { withdraw: { iState: import("oak-domain/lib/types").ActionDef; }; + wpAccount: {}; }; diff --git a/es/oak-app-domain/ActionDefDict.js b/es/oak-app-domain/ActionDefDict.js index c50dbe58..a8dff2fa 100644 --- a/es/oak-app-domain/ActionDefDict.js +++ b/es/oak-app-domain/ActionDefDict.js @@ -14,11 +14,13 @@ import { actionDefDict as wechatMenu } from "./WechatMenu/Action"; import { actionDefDict as wechatPublicTag } from "./WechatPublicTag/Action"; import { actionDefDict as account } from "./Account/Action"; import { actionDefDict as deposit } from "./Deposit/Action"; +import { actionDefDict as offlineAccount } from "./OfflineAccount/Action"; import { actionDefDict as order } from "./Order/Action"; import { actionDefDict as pay } from "./Pay/Action"; import { actionDefDict as refund } from "./Refund/Action"; import { actionDefDict as user } from "./User/Action"; import { actionDefDict as withdraw } from "./Withdraw/Action"; +import { actionDefDict as wpAccount } from "./WpAccount/Action"; export const actionDefDict = { modi, captcha, @@ -36,9 +38,11 @@ export const actionDefDict = { wechatPublicTag, account, deposit, + offlineAccount, order, pay, refund, user, - withdraw + withdraw, + wpAccount }; diff --git a/es/oak-app-domain/EntityDict.d.ts b/es/oak-app-domain/EntityDict.d.ts index 1a00feb0..1e718b66 100644 --- a/es/oak-app-domain/EntityDict.d.ts +++ b/es/oak-app-domain/EntityDict.d.ts @@ -59,6 +59,7 @@ import { EntityDef as OfflineAccount } from "./OfflineAccount/Schema"; import { EntityDef as Order } from "./Order/Schema"; import { EntityDef as Pay } from "./Pay/Schema"; import { EntityDef as Refund } from "./Refund/Schema"; +import { EntityDef as SysAccountOper } from "./SysAccountOper/Schema"; import { EntityDef as WechatPay } from "./WechatPay/Schema"; import { EntityDef as Withdraw } from "./Withdraw/Schema"; import { EntityDef as WithdrawAccount } from "./WithdrawAccount/Schema"; @@ -127,6 +128,7 @@ export type EntityDict = { order: Order; pay: Pay; refund: Refund; + sysAccountOper: SysAccountOper; wechatPay: WechatPay; withdraw: Withdraw; withdrawAccount: WithdrawAccount; diff --git a/es/oak-app-domain/OfflineAccount/Action.d.ts b/es/oak-app-domain/OfflineAccount/Action.d.ts new file mode 100644 index 00000000..bbec0c80 --- /dev/null +++ b/es/oak-app-domain/OfflineAccount/Action.d.ts @@ -0,0 +1,5 @@ +import { GenericAction } from "oak-domain/lib/actions/action"; +export type ParticularAction = 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; +export declare const actions: string[]; +export type Action = GenericAction | ParticularAction | string; +export declare const actionDefDict: {}; diff --git a/es/oak-app-domain/OfflineAccount/Action.js b/es/oak-app-domain/OfflineAccount/Action.js new file mode 100644 index 00000000..31c501f2 --- /dev/null +++ b/es/oak-app-domain/OfflineAccount/Action.js @@ -0,0 +1,2 @@ +export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "pay", "refund", "deposit", "withdraw", "tax"]; +export const actionDefDict = {}; diff --git a/es/oak-app-domain/OfflineAccount/Schema.d.ts b/es/oak-app-domain/OfflineAccount/Schema.d.ts index 17556d9f..75d59edc 100644 --- a/es/oak-app-domain/OfflineAccount/Schema.d.ts +++ b/es/oak-app-domain/OfflineAccount/Schema.d.ts @@ -2,10 +2,11 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; -import { GenericAction } from "oak-domain/lib/actions/action"; -import { String, Text, Boolean } from "oak-domain/lib/types/DataType"; +import { Action, ParticularAction } from "./Action"; +import { String, Text, Boolean, Price } from "oak-domain/lib/types/DataType"; import * as System from "../System/Schema"; import * as Pay from "../Pay/Schema"; +import * as SysAccountOper from "../SysAccountOper/Schema"; export type OpSchema = EntityShape & { type: "bank" | "alipay" | "wechat" | "shouqianba" | "others"; channel?: String<32> | null; @@ -14,6 +15,8 @@ export type OpSchema = EntityShape & { allowDeposit: Boolean; allowPay: Boolean; systemId: ForeignKey<"system">; + price: Price; + enabled: Boolean; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { @@ -24,9 +27,13 @@ export type Schema = EntityShape & { allowDeposit: Boolean; allowPay: Boolean; systemId: ForeignKey<"system">; + price: Price; + enabled: Boolean; system: System.Schema; pay$entity?: Array; pay$entity$$aggr?: AggregationResult; + sysAccountOper$entity?: Array; + sysAccountOper$entity$$aggr?: AggregationResult; } & { [A in ExpressionKey]?: any; }; @@ -43,7 +50,10 @@ type AttrFilter = { allowPay: Q_BooleanValue; systemId: Q_StringValue; system: System.Filter; + price: Q_NumberValue; + enabled: Q_BooleanValue; pay$entity: Pay.Filter & SubQueryPredicateMetadata; + sysAccountOper$entity: SysAccountOper.Filter & SubQueryPredicateMetadata; }; export type Filter = MakeFilter>; export type Projection = { @@ -61,12 +71,20 @@ export type Projection = { allowPay?: number; systemId?: number; system?: System.Projection; + price?: number; + enabled?: number; pay$entity?: Pay.Selection & { $entity: "pay"; }; pay$entity$$aggr?: Pay.Aggregation & { $entity: "pay"; }; + sysAccountOper$entity?: SysAccountOper.Selection & { + $entity: "sysAccountOper"; + }; + sysAccountOper$entity$$aggr?: SysAccountOper.Aggregation & { + $entity: "sysAccountOper"; + }; } & Partial>; type OfflineAccountIdProjection = OneOf<{ id: number; @@ -98,6 +116,10 @@ export type SortAttr = { systemId: number; } | { system: System.SortAttr; +} | { + price: number; +} | { + enabled: number; } | { [k: string]: any; } | OneOf>; @@ -120,6 +142,7 @@ export type CreateOperationData = FormCreateData> & ( systemId: ForeignKey<"system">; })) & { pay$entity?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; @@ -139,8 +162,9 @@ export type UpdateOperationData = FormUpdateData> & ( })) & { [k: string]: any; pay$entity?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; export type RemoveOperationData = {} & (({ system?: System.UpdateOperation | System.RemoveOperation; })); @@ -151,7 +175,7 @@ export type OfflineAccountIdSubQuery = Selection; export type EntityDef = { Schema: Schema; OpSchema: OpSchema; - Action: OakMakeAction | string; + Action: OakMakeAction | string; Selection: Selection; Aggregation: Aggregation; Operation: Operation; @@ -160,5 +184,6 @@ export type EntityDef = { Remove: RemoveOperation; CreateSingle: CreateSingleOperation; CreateMulti: CreateMultipleOperation; + ParticularAction: ParticularAction; }; export {}; diff --git a/es/oak-app-domain/OfflineAccount/Storage.js b/es/oak-app-domain/OfflineAccount/Storage.js index ca833335..544ba590 100644 --- a/es/oak-app-domain/OfflineAccount/Storage.js +++ b/es/oak-app-domain/OfflineAccount/Storage.js @@ -1,4 +1,4 @@ -import { genericActions as actions } from "oak-domain/lib/actions/action"; +import { actions } from "./Action"; export const desc = { attributes: { type: { @@ -33,6 +33,14 @@ export const desc = { notNull: true, type: "ref", ref: "system" + }, + price: { + notNull: true, + type: "money" + }, + enabled: { + notNull: true, + type: "boolean" } }, actionType: "crud", diff --git a/es/oak-app-domain/OfflineAccount/Style.js b/es/oak-app-domain/OfflineAccount/Style.js index 4a742f0a..9a31b21a 100644 --- a/es/oak-app-domain/OfflineAccount/Style.js +++ b/es/oak-app-domain/OfflineAccount/Style.js @@ -2,10 +2,17 @@ export const style = { color: { type: { bank: '#E74C3C', - alipay: '#3498DB', - wechat: '#27AE60', - shouqianba: '#F1C40F', + alipay: '#1678ff', + wechat: '#04BE02', + shouqianba: '#ffc106', others: '#34495E', }, }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', + } }; diff --git a/es/oak-app-domain/OfflineAccount/locales/zh_CN.json b/es/oak-app-domain/OfflineAccount/locales/zh_CN.json index 97d66119..0171aec1 100644 --- a/es/oak-app-domain/OfflineAccount/locales/zh_CN.json +++ b/es/oak-app-domain/OfflineAccount/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "离线账号管理", "attr": { "type": "类型", "channel": "通道", "name": "用户/帐号", "qrCode": "收款二维码", "allowDeposit": "允许主动充值", "allowPay": "允许主动支付", "system": "所属系统", "pays": "支付" }, "v": { "type": { "bank": "银行", "alipay": "支付宝", "wechat": "微信", "shouqianba": "收钱吧", "others": "其它" } } } +{ "name": "线下账户", "attr": { "type": "类型", "channel": "通道", "name": "用户/帐号", "qrCode": "收款二维码", "allowDeposit": "允许主动充值", "allowPay": "允许主动支付", "system": "所属系统", "price": "余额", "pays": "支付", "opers": "操作记录", "enabled": "是否启用" }, "v": { "type": { "bank": "银行", "alipay": "支付宝", "wechat": "微信", "shouqianba": "收钱吧", "others": "其它" } }, "action": { "pay": "支付", "refund": "退款", "deposit": "充值", "withdraw": "提现", "tax": "渠道费" } } diff --git a/es/oak-app-domain/Storage.js b/es/oak-app-domain/Storage.js index 6fccdf22..60a7c475 100644 --- a/es/oak-app-domain/Storage.js +++ b/es/oak-app-domain/Storage.js @@ -59,6 +59,7 @@ import { desc as offlineAccountDesc } from "./OfflineAccount/Storage"; import { desc as orderDesc } from "./Order/Storage"; import { desc as payDesc } from "./Pay/Storage"; import { desc as refundDesc } from "./Refund/Storage"; +import { desc as sysAccountOperDesc } from "./SysAccountOper/Storage"; import { desc as wechatPayDesc } from "./WechatPay/Storage"; import { desc as withdrawDesc } from "./Withdraw/Storage"; import { desc as withdrawAccountDesc } from "./WithdrawAccount/Storage"; @@ -127,6 +128,7 @@ export const storageSchema = { order: orderDesc, pay: payDesc, refund: refundDesc, + sysAccountOper: sysAccountOperDesc, wechatPay: wechatPayDesc, withdraw: withdrawDesc, withdrawAccount: withdrawAccountDesc, diff --git a/es/oak-app-domain/StyleDict.js b/es/oak-app-domain/StyleDict.js index e0295d54..99a90ee3 100644 --- a/es/oak-app-domain/StyleDict.js +++ b/es/oak-app-domain/StyleDict.js @@ -27,6 +27,7 @@ import { style as offlineAccount } from "./OfflineAccount/Style"; import { style as order } from "./Order/Style"; import { style as pay } from "./Pay/Style"; import { style as refund } from "./Refund/Style"; +import { style as sysAccountOper } from "./SysAccountOper/Style"; import { style as user } from "./User/Style"; import { style as withdraw } from "./Withdraw/Style"; import { style as wpAccount } from "./WpAccount/Style"; @@ -61,6 +62,7 @@ export const styleDict = { order, pay, refund, + sysAccountOper, user, withdraw, wpAccount, diff --git a/es/oak-app-domain/SysAccountOper/Schema.d.ts b/es/oak-app-domain/SysAccountOper/Schema.d.ts new file mode 100644 index 00000000..e25fb97c --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/Schema.d.ts @@ -0,0 +1,167 @@ +import { ForeignKey } from "oak-domain/lib/types/DataType"; +import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand"; +import { OneOf } from "oak-domain/lib/types/Polyfill"; +import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity"; +import { AppendOnlyAction } from "oak-domain/lib/actions/action"; +import { Price, String } from "oak-domain/lib/types/DataType"; +import * as OfflineAccount from "../OfflineAccount/Schema"; +import * as WpAccount from "../WpAccount/Schema"; +export type OpSchema = EntityShape & { + delta: Price; + type: "pay" | "refund" | "deposit" | "withdraw" | "tax"; + entity: "offlineAccount" | "wpAccount" | string; + entityId: String<64>; +}; +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { + delta: Price; + type: "pay" | "refund" | "deposit" | "withdraw" | "tax"; + entity: "offlineAccount" | "wpAccount" | string; + entityId: String<64>; + offlineAccount?: OfflineAccount.Schema; + wpAccount?: WpAccount.Schema; +} & { + [A in ExpressionKey]?: any; +}; +type AttrFilter = { + id: Q_StringValue; + $$createAt$$: Q_DateValue; + $$seq$$: Q_NumberValue; + $$updateAt$$: Q_DateValue; + delta: Q_NumberValue; + type: Q_EnumValue<"pay" | "refund" | "deposit" | "withdraw" | "tax">; + entity: Q_EnumValue<"offlineAccount" | "wpAccount" | string>; + entityId: Q_StringValue; + offlineAccount: OfflineAccount.Filter; + wpAccount: WpAccount.Filter; +}; +export type Filter = MakeFilter>; +export type Projection = { + "#id"?: NodeId; + [k: string]: any; + id?: number; + $$createAt$$?: number; + $$updateAt$$?: number; + $$seq$$?: number; + delta?: number; + type?: number; + entity?: number; + entityId?: number; + offlineAccount?: OfflineAccount.Projection; + wpAccount?: WpAccount.Projection; +} & Partial>; +type SysAccountOperIdProjection = OneOf<{ + id: number; +}>; +type OfflineAccountIdProjection = OneOf<{ + entityId: number; +}>; +type WpAccountIdProjection = OneOf<{ + entityId: number; +}>; +export type SortAttr = { + id: number; +} | { + $$createAt$$: number; +} | { + $$seq$$: number; +} | { + $$updateAt$$: number; +} | { + delta: number; +} | { + type: number; +} | { + entity: number; +} | { + entityId: number; +} | { + offlineAccount: OfflineAccount.SortAttr; +} | { + wpAccount: WpAccount.SortAttr; +} | { + [k: string]: any; +} | OneOf>; +export type SortNode = { + $attr: SortAttr; + $direction?: "asc" | "desc"; +}; +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= SelectOperation

; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ + entity?: never; + entityId?: never; + offlineAccount: OfflineAccount.CreateSingleOperation; +} | { + entity: "offlineAccount"; + entityId: ForeignKey<"OfflineAccount">; + offlineAccount?: OfflineAccount.UpdateOperation; +} | { + entity: "offlineAccount"; + entityId: ForeignKey<"OfflineAccount">; + offlineAccount?: never; +} | { + entity?: never; + entityId?: never; + wpAccount: WpAccount.CreateSingleOperation; +} | { + entity: "wpAccount"; + entityId: ForeignKey<"WpAccount">; + wpAccount?: WpAccount.UpdateOperation; +} | { + entity: "wpAccount"; + entityId: ForeignKey<"WpAccount">; + wpAccount?: never; +} | { + entity?: string; + entityId?: string; + [K: string]: any; +}); +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & ({ + offlineAccount?: OfflineAccount.CreateSingleOperation | OfflineAccount.UpdateOperation | OfflineAccount.RemoveOperation; + entityId?: never; + entity?: never; +} | { + wpAccount?: WpAccount.CreateSingleOperation | WpAccount.UpdateOperation | WpAccount.RemoveOperation; + entityId?: never; + entity?: never; +} | { + entity?: ("offlineAccount" | "wpAccount" | string) | null; + entityId?: ForeignKey<"OfflineAccount" | "WpAccount"> | null; + offlineAccount?: never; + wpAccount?: never; +}) & { + [k: string]: any; +}; +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & ({ + offlineAccount?: OfflineAccount.UpdateOperation | OfflineAccount.RemoveOperation; +} | { + wpAccount?: WpAccount.UpdateOperation | WpAccount.RemoveOperation; +} | { + [k: string]: any; +}); +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type OfflineAccountIdSubQuery = Selection; +export type WpAccountIdSubQuery = Selection; +export type SysAccountOperIdSubQuery = Selection; +export type EntityDef = { + Schema: Schema; + OpSchema: OpSchema; + Action: OakMakeAction | string; + Selection: Selection; + Aggregation: Aggregation; + Operation: Operation; + Create: CreateOperation; + Update: UpdateOperation; + Remove: RemoveOperation; + CreateSingle: CreateSingleOperation; + CreateMulti: CreateMultipleOperation; +}; +export {}; diff --git a/es/oak-app-domain/SysAccountOper/Schema.js b/es/oak-app-domain/SysAccountOper/Schema.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/Schema.js @@ -0,0 +1 @@ +export {}; diff --git a/es/oak-app-domain/SysAccountOper/Storage.d.ts b/es/oak-app-domain/SysAccountOper/Storage.d.ts new file mode 100644 index 00000000..a3f0fbbb --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/Storage.d.ts @@ -0,0 +1,3 @@ +import { StorageDesc } from "oak-domain/lib/types/Storage"; +import { OpSchema } from "./Schema"; +export declare const desc: StorageDesc; diff --git a/es/oak-app-domain/SysAccountOper/Storage.js b/es/oak-app-domain/SysAccountOper/Storage.js new file mode 100644 index 00000000..e2496f56 --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/Storage.js @@ -0,0 +1,31 @@ +import { appendOnlyActions as actions } from "oak-domain/lib/actions/action"; +export const desc = { + attributes: { + delta: { + notNull: true, + type: "money" + }, + type: { + notNull: true, + type: "enum", + enumeration: ["pay", "refund", "deposit", "withdraw", "tax"] + }, + entity: { + notNull: true, + type: "varchar", + params: { + length: 32 + }, + ref: ["offlineAccount", "wpAccount"] + }, + entityId: { + notNull: true, + type: "varchar", + params: { + length: 64 + } + } + }, + actionType: "appendOnly", + actions +}; diff --git a/es/oak-app-domain/SysAccountOper/Style.d.ts b/es/oak-app-domain/SysAccountOper/Style.d.ts new file mode 100644 index 00000000..a0bf8206 --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/Style.d.ts @@ -0,0 +1,3 @@ +import { EntityDef } from "./Schema"; +import { StyleDef } from "oak-domain/lib/types/Style"; +export declare const style: StyleDef; diff --git a/es/oak-app-domain/SysAccountOper/Style.js b/es/oak-app-domain/SysAccountOper/Style.js new file mode 100644 index 00000000..e158da94 --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/Style.js @@ -0,0 +1,11 @@ +export const style = { + color: { + type: { + deposit: '#3498DB', + withdraw: '#F7DC6F', + pay: '#82E0AA', + tax: '#2E4053', + refund: '#2E4053', + } + } +}; diff --git a/es/oak-app-domain/SysAccountOper/locales/zh_CN.json b/es/oak-app-domain/SysAccountOper/locales/zh_CN.json new file mode 100644 index 00000000..ca749e03 --- /dev/null +++ b/es/oak-app-domain/SysAccountOper/locales/zh_CN.json @@ -0,0 +1 @@ +{ "name": "系统账户操作", "attr": { "type": "类型", "delta": "余额变化", "entity": "关联对象", "entityId": "关联对象Id" }, "v": { "type": { "deposit": "充值", "withdraw": "提现", "pay": "支付", "refund": "退款", "tax": "渠道手续费" } } } diff --git a/es/oak-app-domain/System/Schema.d.ts b/es/oak-app-domain/System/Schema.d.ts index 0123a52b..d4d1be2a 100644 --- a/es/oak-app-domain/System/Schema.d.ts +++ b/es/oak-app-domain/System/Schema.d.ts @@ -14,6 +14,7 @@ import * as SmsTemplate from "../SmsTemplate/Schema"; import * as UserSystem from "../UserSystem/Schema"; import * as Account from "../Account/Schema"; import * as OfflineAccount from "../OfflineAccount/Schema"; +import * as WechatPay from "../WechatPay/Schema"; import * as WithdrawChannel from "../WithdrawChannel/Schema"; import * as WpAccount from "../WpAccount/Schema"; export type OpSchema = EntityShape & { @@ -53,6 +54,8 @@ export type Schema = EntityShape & { account$system$$aggr?: AggregationResult; offlineAccount$system?: Array; offlineAccount$system$$aggr?: AggregationResult; + wechatPay$system?: Array; + wechatPay$system$$aggr?: AggregationResult; withdrawChannel$system?: Array; withdrawChannel$system$$aggr?: AggregationResult; wpAccount$system?: Array; @@ -82,6 +85,7 @@ type AttrFilter = { userSystem$system: UserSystem.Filter & SubQueryPredicateMetadata; account$system: Account.Filter & SubQueryPredicateMetadata; offlineAccount$system: OfflineAccount.Filter & SubQueryPredicateMetadata; + wechatPay$system: WechatPay.Filter & SubQueryPredicateMetadata; withdrawChannel$system: WithdrawChannel.Filter & SubQueryPredicateMetadata; wpAccount$system: WpAccount.Filter & SubQueryPredicateMetadata; }; @@ -145,6 +149,12 @@ export type Projection = { offlineAccount$system$$aggr?: OfflineAccount.Aggregation & { $entity: "offlineAccount"; }; + wechatPay$system?: WechatPay.Selection & { + $entity: "wechatPay"; + }; + wechatPay$system$$aggr?: WechatPay.Aggregation & { + $entity: "wechatPay"; + }; withdrawChannel$system?: WithdrawChannel.Selection & { $entity: "withdrawChannel"; }; @@ -224,6 +234,7 @@ export type CreateOperationData = FormCreateData, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; account$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; offlineAccount$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; + wechatPay$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; withdrawChannel$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; wpAccount$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; }; @@ -251,6 +262,7 @@ export type UpdateOperationData = FormUpdateData> & userSystem$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; account$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; offlineAccount$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; + wechatPay$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; withdrawChannel$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; wpAccount$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; }; diff --git a/es/oak-app-domain/WechatPay/Schema.d.ts b/es/oak-app-domain/WechatPay/Schema.d.ts index 23f88053..b5fe2c74 100644 --- a/es/oak-app-domain/WechatPay/Schema.d.ts +++ b/es/oak-app-domain/WechatPay/Schema.d.ts @@ -1,21 +1,24 @@ +import { ForeignKey } from "oak-domain/lib/types/DataType"; import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; import { GenericAction } from "oak-domain/lib/actions/action"; -import { String, Decimal } from "oak-domain/lib/types/DataType"; +import { String } from "oak-domain/lib/types/DataType"; +import * as System from "../System/Schema"; import * as WpAccount from "../WpAccount/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; export type OpSchema = EntityShape & { payNotifyUrl: String<128>; refundNotifyUrl: String<128>; - lossRatio: Decimal<4, 2>; + systemId: ForeignKey<"system">; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { payNotifyUrl: String<128>; refundNotifyUrl: String<128>; - lossRatio: Decimal<4, 2>; + systemId: ForeignKey<"system">; + system: System.Schema; wpAccount$wechatPay?: Array; wpAccount$wechatPay$$aggr?: AggregationResult; modiEntity$entity?: Array; @@ -32,7 +35,8 @@ type AttrFilter = { $$updateAt$$: Q_DateValue; payNotifyUrl: Q_StringValue; refundNotifyUrl: Q_StringValue; - lossRatio: Q_NumberValue; + systemId: Q_StringValue; + system: System.Filter; wpAccount$wechatPay: WpAccount.Filter & SubQueryPredicateMetadata; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata; @@ -47,7 +51,8 @@ export type Projection = { $$seq$$?: number; payNotifyUrl?: number; refundNotifyUrl?: number; - lossRatio?: number; + systemId?: number; + system?: System.Projection; wpAccount$wechatPay?: WpAccount.Selection & { $entity: "wpAccount"; }; @@ -70,6 +75,9 @@ export type Projection = { type WechatPayIdProjection = OneOf<{ id: number; }>; +type SystemIdProjection = OneOf<{ + systemId: number; +}>; export type SortAttr = { id: number; } | { @@ -83,7 +91,9 @@ export type SortAttr = { } | { refundNotifyUrl: number; } | { - lossRatio: number; + systemId: number; +} | { + system: System.SortAttr; } | { [k: string]: any; } | OneOf>; @@ -95,7 +105,16 @@ export type Sorter = SortNode[]; export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; export type Selection

= SelectOperation

; export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData & { +export type CreateOperationData = FormCreateData> & (({ + systemId?: never; + system: System.CreateSingleOperation; +} | { + systemId: ForeignKey<"system">; + system?: System.UpdateOperation; +} | { + system?: never; + systemId: ForeignKey<"system">; +})) & { wpAccount$wechatPay?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; @@ -103,16 +122,31 @@ export type CreateOperationData = FormCreateData & { export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export type UpdateOperationData = FormUpdateData> & (({ + system?: System.CreateSingleOperation; + systemId?: never; +} | { + system?: System.UpdateOperation; + systemId?: never; +} | { + system?: System.RemoveOperation; + systemId?: never; +} | { + system?: never; + systemId?: ForeignKey<"system">; +})) & { [k: string]: any; wpAccount$wechatPay?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; +export type RemoveOperationData = {} & (({ + system?: System.UpdateOperation | System.RemoveOperation; +})); export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type SystemIdSubQuery = Selection; export type WechatPayIdSubQuery = Selection; export type EntityDef = { Schema: Schema; diff --git a/es/oak-app-domain/WechatPay/Storage.js b/es/oak-app-domain/WechatPay/Storage.js index 2db2fcd4..2baa51db 100644 --- a/es/oak-app-domain/WechatPay/Storage.js +++ b/es/oak-app-domain/WechatPay/Storage.js @@ -15,13 +15,10 @@ export const desc = { length: 128 } }, - lossRatio: { + systemId: { notNull: true, - type: "decimal", - params: { - precision: 4, - scale: 2 - } + type: "ref", + ref: "system" } }, actionType: "crud", diff --git a/es/oak-app-domain/WechatPay/locales/zh_CN.json b/es/oak-app-domain/WechatPay/locales/zh_CN.json index 099fde3c..bea0f6cf 100644 --- a/es/oak-app-domain/WechatPay/locales/zh_CN.json +++ b/es/oak-app-domain/WechatPay/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "微信支付", "attr": { "payNotifyUrl": "支付通知回调", "refundNotifyUrl": "退款通知回调", "lossRatio": "支付损耗比例" } } +{ "name": "微信支付", "attr": { "payNotifyUrl": "支付通知回调", "refundNotifyUrl": "退款通知回调", "system": "关联系统" } } diff --git a/es/oak-app-domain/WpAccount/Action.d.ts b/es/oak-app-domain/WpAccount/Action.d.ts new file mode 100644 index 00000000..bbec0c80 --- /dev/null +++ b/es/oak-app-domain/WpAccount/Action.d.ts @@ -0,0 +1,5 @@ +import { GenericAction } from "oak-domain/lib/actions/action"; +export type ParticularAction = 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; +export declare const actions: string[]; +export type Action = GenericAction | ParticularAction | string; +export declare const actionDefDict: {}; diff --git a/es/oak-app-domain/WpAccount/Action.js b/es/oak-app-domain/WpAccount/Action.js new file mode 100644 index 00000000..31c501f2 --- /dev/null +++ b/es/oak-app-domain/WpAccount/Action.js @@ -0,0 +1,2 @@ +export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "pay", "refund", "deposit", "withdraw", "tax"]; +export const actionDefDict = {}; diff --git a/es/oak-app-domain/WpAccount/Schema.d.ts b/es/oak-app-domain/WpAccount/Schema.d.ts index e9b46788..022503af 100644 --- a/es/oak-app-domain/WpAccount/Schema.d.ts +++ b/es/oak-app-domain/WpAccount/Schema.d.ts @@ -1,16 +1,18 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; -import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; +import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; -import { GenericAction } from "oak-domain/lib/actions/action"; -import { Decimal, Int, String, Text, Price } from "oak-domain/lib/types/DataType"; +import { Action, ParticularAction } from "./Action"; +import { Decimal, Int, String, Text, Price, Boolean } from "oak-domain/lib/types/DataType"; import * as WechatPay from "../WechatPay/Schema"; import * as System from "../System/Schema"; import * as WpProduct from "../WpProduct/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; +import * as SysAccountOper from "../SysAccountOper/Schema"; export type OpSchema = EntityShape & { wechatPayId: ForeignKey<"wechatPay">; + taxlossRatio: Decimal<4, 2>; depositLossRatio?: Decimal<4, 2> | null; refundGapDays?: Int<4> | null; refundLossRatio?: Decimal<4, 2> | null; @@ -21,10 +23,12 @@ export type OpSchema = EntityShape & { apiV3Key: String<32>; price: Price; systemId: ForeignKey<"system">; + enabled: Boolean; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { wechatPayId: ForeignKey<"wechatPay">; + taxlossRatio: Decimal<4, 2>; depositLossRatio?: Decimal<4, 2> | null; refundGapDays?: Int<4> | null; refundLossRatio?: Decimal<4, 2> | null; @@ -35,6 +39,7 @@ export type Schema = EntityShape & { apiV3Key: String<32>; price: Price; systemId: ForeignKey<"system">; + enabled: Boolean; wechatPay: WechatPay.Schema; system: System.Schema; wpProduct$wpAccount?: Array; @@ -43,6 +48,8 @@ export type Schema = EntityShape & { modiEntity$entity$$aggr?: AggregationResult; operEntity$entity?: Array; operEntity$entity$$aggr?: AggregationResult; + sysAccountOper$entity?: Array; + sysAccountOper$entity$$aggr?: AggregationResult; } & { [A in ExpressionKey]?: any; }; @@ -53,6 +60,7 @@ type AttrFilter = { $$updateAt$$: Q_DateValue; wechatPayId: Q_StringValue; wechatPay: WechatPay.Filter; + taxlossRatio: Q_NumberValue; depositLossRatio: Q_NumberValue; refundGapDays: Q_NumberValue; refundLossRatio: Q_NumberValue; @@ -64,9 +72,11 @@ type AttrFilter = { price: Q_NumberValue; systemId: Q_StringValue; system: System.Filter; + enabled: Q_BooleanValue; wpProduct$wpAccount: WpProduct.Filter & SubQueryPredicateMetadata; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata; + sysAccountOper$entity: SysAccountOper.Filter & SubQueryPredicateMetadata; }; export type Filter = MakeFilter>; export type Projection = { @@ -78,6 +88,7 @@ export type Projection = { $$seq$$?: number; wechatPayId?: number; wechatPay?: WechatPay.Projection; + taxlossRatio?: number; depositLossRatio?: number; refundGapDays?: number; refundLossRatio?: number; @@ -89,6 +100,7 @@ export type Projection = { price?: number; systemId?: number; system?: System.Projection; + enabled?: number; wpProduct$wpAccount?: WpProduct.Selection & { $entity: "wpProduct"; }; @@ -107,6 +119,12 @@ export type Projection = { operEntity$entity$$aggr?: OperEntity.Aggregation & { $entity: "operEntity"; }; + sysAccountOper$entity?: SysAccountOper.Selection & { + $entity: "sysAccountOper"; + }; + sysAccountOper$entity$$aggr?: SysAccountOper.Aggregation & { + $entity: "sysAccountOper"; + }; } & Partial>; type WpAccountIdProjection = OneOf<{ id: number; @@ -129,6 +147,8 @@ export type SortAttr = { wechatPayId: number; } | { wechatPay: WechatPay.SortAttr; +} | { + taxlossRatio: number; } | { depositLossRatio: number; } | { @@ -151,6 +171,8 @@ export type SortAttr = { systemId: number; } | { system: System.SortAttr; +} | { + enabled: number; } | { [k: string]: any; } | OneOf>; @@ -184,6 +206,7 @@ export type CreateOperationData = FormCreateData, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; @@ -217,8 +240,9 @@ export type UpdateOperationData = FormUpdateData, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; export type RemoveOperationData = {} & (({ wechatPay?: WechatPay.UpdateOperation | WechatPay.RemoveOperation; }) & ({ @@ -232,7 +256,7 @@ export type WpAccountIdSubQuery = Selection; export type EntityDef = { Schema: Schema; OpSchema: OpSchema; - Action: OakMakeAction | string; + Action: OakMakeAction | string; Selection: Selection; Aggregation: Aggregation; Operation: Operation; @@ -241,5 +265,6 @@ export type EntityDef = { Remove: RemoveOperation; CreateSingle: CreateSingleOperation; CreateMulti: CreateMultipleOperation; + ParticularAction: ParticularAction; }; export {}; diff --git a/es/oak-app-domain/WpAccount/Storage.js b/es/oak-app-domain/WpAccount/Storage.js index 3c58bead..d5afc147 100644 --- a/es/oak-app-domain/WpAccount/Storage.js +++ b/es/oak-app-domain/WpAccount/Storage.js @@ -1,4 +1,4 @@ -import { genericActions as actions } from "oak-domain/lib/actions/action"; +import { actions } from "./Action"; export const desc = { attributes: { wechatPayId: { @@ -6,6 +6,14 @@ export const desc = { type: "ref", ref: "wechatPay" }, + taxlossRatio: { + notNull: true, + type: "decimal", + params: { + precision: 4, + scale: 2 + } + }, depositLossRatio: { type: "decimal", params: { @@ -61,6 +69,10 @@ export const desc = { notNull: true, type: "ref", ref: "system" + }, + enabled: { + notNull: true, + type: "boolean" } }, actionType: "crud", diff --git a/es/oak-app-domain/WpAccount/Style.js b/es/oak-app-domain/WpAccount/Style.js index 4d097832..4556aa3c 100644 --- a/es/oak-app-domain/WpAccount/Style.js +++ b/es/oak-app-domain/WpAccount/Style.js @@ -4,5 +4,12 @@ export const style = { yuan: '#FFFF00', jiao: '#00FF00' } + }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', } }; diff --git a/es/oak-app-domain/WpAccount/locales/zh_CN.json b/es/oak-app-domain/WpAccount/locales/zh_CN.json index d53c5338..f00e54cc 100644 --- a/es/oak-app-domain/WpAccount/locales/zh_CN.json +++ b/es/oak-app-domain/WpAccount/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "微信支付帐号", "attr": { "wechatPay": "微信支付", "depositLossRatio": "充值损耗百分比", "refundGapDays": "(支付后)允许退款的天数", "refundLossRatio": "退款损耗百分比", "refundLossFloor": "退款向下取整位数", "mchId": "商户号", "publicKeyFilePath": "公钥文件路径", "privateKeyFilePath": "私钥文件路径", "apiV3Key": "apiV3Key", "price": "余额", "system": "关联系统" }, "v": { "refundLossFloor": { "yuan": "元", "jiao": "角" } } } +{ "name": "微信支付帐号", "attr": { "wechatPay": "微信支付", "taxlossRatio": "商户号手续费(百分比)", "depositLossRatio": "充值损耗百分比", "refundGapDays": "(支付后)允许退款的天数", "refundLossRatio": "退款损耗百分比", "refundLossFloor": "退款向下取整位数", "mchId": "商户号", "publicKeyFilePath": "公钥文件路径", "privateKeyFilePath": "私钥文件路径", "apiV3Key": "apiV3Key", "price": "余额", "system": "关联系统", "opers": "操作记录", "enabled": "是否启用" }, "v": { "refundLossFloor": { "yuan": "元", "jiao": "角" } }, "action": { "pay": "支付", "refund": "退款", "deposit": "充值", "withdraw": "提现", "tax": "渠道费" } } diff --git a/es/oak-app-domain/WpProduct/Schema.d.ts b/es/oak-app-domain/WpProduct/Schema.d.ts index 3b1331b8..549f79f0 100644 --- a/es/oak-app-domain/WpProduct/Schema.d.ts +++ b/es/oak-app-domain/WpProduct/Schema.d.ts @@ -1,8 +1,9 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; -import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; +import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; import { GenericAction } from "oak-domain/lib/actions/action"; +import { Boolean } from "oak-domain/lib/types/DataType"; import * as WpAccount from "../WpAccount/Schema"; import * as Application from "../Application/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; @@ -12,12 +13,14 @@ export type OpSchema = EntityShape & { wpAccountId: ForeignKey<"wpAccount">; type: "native" | "mp" | "jsapi" | "h5" | "app"; applicationId: ForeignKey<"application">; + enabled: Boolean; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { wpAccountId: ForeignKey<"wpAccount">; type: "native" | "mp" | "jsapi" | "h5" | "app"; applicationId: ForeignKey<"application">; + enabled: Boolean; wpAccount: WpAccount.Schema; application: Application.Schema; modiEntity$entity?: Array; @@ -39,6 +42,7 @@ type AttrFilter = { type: Q_EnumValue<"native" | "mp" | "jsapi" | "h5" | "app">; applicationId: Q_StringValue; application: Application.Filter; + enabled: Q_BooleanValue; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata; pay$entity: Pay.Filter & SubQueryPredicateMetadata; @@ -56,6 +60,7 @@ export type Projection = { type?: number; applicationId?: number; application?: Application.Projection; + enabled?: number; modiEntity$entity?: ModiEntity.Selection & { $entity: "modiEntity"; }; @@ -102,6 +107,8 @@ export type SortAttr = { applicationId: number; } | { application: Application.SortAttr; +} | { + enabled: number; } | { [k: string]: any; } | OneOf>; diff --git a/es/oak-app-domain/WpProduct/Storage.js b/es/oak-app-domain/WpProduct/Storage.js index 628e0cd7..676e2e11 100644 --- a/es/oak-app-domain/WpProduct/Storage.js +++ b/es/oak-app-domain/WpProduct/Storage.js @@ -15,6 +15,10 @@ export const desc = { notNull: true, type: "ref", ref: "application" + }, + enabled: { + notNull: true, + type: "boolean" } }, actionType: "crud", diff --git a/es/oak-app-domain/WpProduct/locales/zh_CN.json b/es/oak-app-domain/WpProduct/locales/zh_CN.json index 9b16a440..9d9b0687 100644 --- a/es/oak-app-domain/WpProduct/locales/zh_CN.json +++ b/es/oak-app-domain/WpProduct/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "微信支付产品", "attr": { "wpAccount": "微信支付帐号", "type": "类型", "application": "关联应用", "pays": "支付" }, "v": { "type": { "native": "native(二维码)", "mp": "小程序", "jsapi": "jsApi", "h5": "h5(唤起微信)", "app": "App" } } } +{ "name": "微信支付产品", "attr": { "wpAccount": "微信支付帐号", "type": "类型", "application": "关联应用", "enabled": "有效中", "pays": "支付" }, "v": { "type": { "native": "native(二维码)", "mp": "小程序", "jsapi": "jsApi", "h5": "h5(唤起微信)", "app": "App" } } } diff --git a/es/oak-app-domain/_SubQuery.d.ts b/es/oak-app-domain/_SubQuery.d.ts index b9437344..f7d183d1 100644 --- a/es/oak-app-domain/_SubQuery.d.ts +++ b/es/oak-app-domain/_SubQuery.d.ts @@ -59,6 +59,7 @@ import * as OfflineAccount from "./OfflineAccount/Schema"; import * as Order from "./Order/Schema"; import * as Pay from "./Pay/Schema"; import * as Refund from "./Refund/Schema"; +import * as SysAccountOper from "./SysAccountOper/Schema"; import * as WechatPay from "./WechatPay/Schema"; import * as Withdraw from "./Withdraw/Schema"; import * as WithdrawAccount from "./WithdrawAccount/Schema"; @@ -441,6 +442,8 @@ export type SystemIdSubQuery = { entity: "account"; }) | (OfflineAccount.SystemIdSubQuery & { entity: "offlineAccount"; + }) | (WechatPay.SystemIdSubQuery & { + entity: "wechatPay"; }) | (WithdrawChannel.SystemIdSubQuery & { entity: "withdrawChannel"; }) | (WpAccount.SystemIdSubQuery & { @@ -557,6 +560,8 @@ export type DepositIdSubQuery = { export type OfflineAccountIdSubQuery = { [K in "$in" | "$nin"]?: (Pay.OfflineAccountIdSubQuery & { entity: "pay"; + }) | (SysAccountOper.OfflineAccountIdSubQuery & { + entity: "sysAccountOper"; }) | (OfflineAccount.OfflineAccountIdSubQuery & { entity: "offlineAccount"; }) | any; @@ -582,6 +587,11 @@ export type RefundIdSubQuery = { entity: "refund"; }) | any; }; +export type SysAccountOperIdSubQuery = { + [K in "$in" | "$nin"]?: (SysAccountOper.SysAccountOperIdSubQuery & { + entity: "sysAccountOper"; + }) | any; +}; export type WechatPayIdSubQuery = { [K in "$in" | "$nin"]?: (WpAccount.WechatPayIdSubQuery & { entity: "wpAccount"; @@ -635,6 +645,8 @@ export type WpAccountIdSubQuery = { entity: "modiEntity"; }) | (OperEntity.WpAccountIdSubQuery & { entity: "operEntity"; + }) | (SysAccountOper.WpAccountIdSubQuery & { + entity: "sysAccountOper"; }) | (WpAccount.WpAccountIdSubQuery & { entity: "wpAccount"; }) | any; diff --git a/es/ports/index.d.ts b/es/ports/index.d.ts index 4d46e336..f247bbaa 100644 --- a/es/ports/index.d.ts +++ b/es/ports/index.d.ts @@ -1,5 +1,5 @@ import { Importation, Exportation } from "oak-domain/lib/types/Port"; import { EntityDict } from "@oak-app-domain"; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; export declare const importations: Importation[]; export declare const exportations: Exportation[]; diff --git a/es/routines/start.d.ts b/es/routines/start.d.ts index b0c596bf..3ff8ada3 100644 --- a/es/routines/start.d.ts +++ b/es/routines/start.d.ts @@ -1,5 +1,5 @@ import { Routine } from 'oak-domain/lib/types/Timer'; import { EntityDict } from '@oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const startRoutines: Array>; export default startRoutines; diff --git a/es/timers/index.d.ts b/es/timers/index.d.ts index 0cc4714a..6928fd97 100644 --- a/es/timers/index.d.ts +++ b/es/timers/index.d.ts @@ -1,5 +1,5 @@ import { Timer } from 'oak-domain/lib/types/Timer'; import { EntityDict } from '@oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const timers: Array>; export default timers; diff --git a/es/triggers/account.d.ts b/es/triggers/account.d.ts index 045c2818..cf64eb08 100644 --- a/es/triggers/account.d.ts +++ b/es/triggers/account.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; import { EntityDict } from '../oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/account.js b/es/triggers/account.js index ccd3b956..bb9db3e9 100644 --- a/es/triggers/account.js +++ b/es/triggers/account.js @@ -1,5 +1,5 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; -import { DATA_SUBSCRIBER_KEYS } from '@project/config/constants'; +import { DATA_SUBSCRIBER_KEYS } from '../config/constants'; import assert from 'assert'; const triggers = [ { diff --git a/es/triggers/accountOper.d.ts b/es/triggers/accountOper.d.ts index a32b38d9..8277c576 100644 --- a/es/triggers/accountOper.d.ts +++ b/es/triggers/accountOper.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; import { EntityDict } from '../oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/accountOper.js b/es/triggers/accountOper.js index 8e78743c..0ab70880 100644 --- a/es/triggers/accountOper.js +++ b/es/triggers/accountOper.js @@ -1,6 +1,6 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; import assert from 'assert'; -import { DATA_SUBSCRIBER_KEYS } from '@project/config/constants'; +import { DATA_SUBSCRIBER_KEYS } from '../config/constants'; const triggers = [ { name: '当生成accountOper时,修改account中的值,并向订阅者推送', diff --git a/es/triggers/index.d.ts b/es/triggers/index.d.ts index f6964b48..aefa8c44 100644 --- a/es/triggers/index.d.ts +++ b/es/triggers/index.d.ts @@ -1,5 +1,5 @@ import { EntityDict } from '@oak-app-domain'; import { Trigger } from 'oak-domain/lib/types'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/pay.d.ts b/es/triggers/pay.d.ts index 7e42fd63..94edb903 100644 --- a/es/triggers/pay.d.ts +++ b/es/triggers/pay.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/pay.js b/es/triggers/pay.js index 2b775a64..f82f6a53 100644 --- a/es/triggers/pay.js +++ b/es/triggers/pay.js @@ -1,8 +1,8 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; import assert from 'assert'; -import { getPayClazz } from '@project/utils/payClazz'; -import { fullPayProjection } from '@project/utils/pay'; -import { DATA_SUBSCRIBER_KEYS } from '@project/config/constants'; +import { getPayClazz } from '../utils/payClazz'; +import { fullPayProjection } from '../utils/pay'; +import { DATA_SUBSCRIBER_KEYS } from '../config/constants'; async function changeOrderStateByPay(filter, context, option) { const orders = await context.select('order', { data: { @@ -286,7 +286,6 @@ const triggers = [ data: { id: 1, orderId: 1, - accountId: 1, price: 1, refunded: 1, deposit: { diff --git a/es/triggers/refund.d.ts b/es/triggers/refund.d.ts index 7501de5f..0797e533 100644 --- a/es/triggers/refund.d.ts +++ b/es/triggers/refund.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/refund.js b/es/triggers/refund.js index 9b10d1e2..0af8adfe 100644 --- a/es/triggers/refund.js +++ b/es/triggers/refund.js @@ -1,5 +1,5 @@ import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; -import { getPayClazz } from '@project/utils/payClazz'; +import { getPayClazz } from '../utils/payClazz'; import assert from 'assert'; /** * 当refund完成或失败时,如果关联有提现,去更新提现的状态 diff --git a/es/triggers/userSystem.d.ts b/es/triggers/userSystem.d.ts index 12394361..2bc7dd45 100644 --- a/es/triggers/userSystem.d.ts +++ b/es/triggers/userSystem.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/withdraw.d.ts b/es/triggers/withdraw.d.ts index 4b08ee1a..491cd75f 100644 --- a/es/triggers/withdraw.d.ts +++ b/es/triggers/withdraw.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; import { EntityDict } from '../oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/es/triggers/withdraw.js b/es/triggers/withdraw.js index 79caf6f2..a4fadef5 100644 --- a/es/triggers/withdraw.js +++ b/es/triggers/withdraw.js @@ -1,6 +1,6 @@ import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; import assert from 'assert'; -import { getAccountPayRefunds } from '@project/utils/pay'; +import { getAccountPayRefunds } from '../utils/pay'; const triggers = [ { name: '当withdraw创建时,如果是走退款渠道,则创建出相应的refunds,同时更改account中的数值', diff --git a/es/types/DependentExceptions.d.ts b/es/types/DependentExceptions.d.ts index 467b9899..af0a8772 100644 --- a/es/types/DependentExceptions.d.ts +++ b/es/types/DependentExceptions.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { OpRecord } from 'oak-domain/lib/types/Entity'; export default function makeException(data: { name: string; diff --git a/es/types/PayClazz.d.ts b/es/types/PayClazz.d.ts index 21e23c2d..260905a8 100644 --- a/es/types/PayClazz.d.ts +++ b/es/types/PayClazz.d.ts @@ -1,5 +1,5 @@ -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; type IState = EntityDict['pay']['OpSchema']['iState']; export default interface PayClazz { type: string; diff --git a/es/types/RuntimeCxt.d.ts b/es/types/RuntimeCxt.d.ts index 42ec9dfa..baeced54 100644 --- a/es/types/RuntimeCxt.d.ts +++ b/es/types/RuntimeCxt.d.ts @@ -1,9 +1,9 @@ -import { AspectDict } from "@project/aspects/AspectDict"; -import { FeatureDict } from "@project/features"; -import { EntityDict } from "@project/oak-app-domain"; +import { AspectDict } from "../aspects/AspectDict"; +import { FeatureDict } from "../features"; +import { EntityDict } from "../oak-app-domain"; import { BasicFeatures } from "oak-frontend-base"; -import { BackendRuntimeContext } from "@project/context/BackendRuntimeContext"; -import { FrontendRuntimeContext } from "@project/context/FrontendRuntimeContext"; +import { BackendRuntimeContext } from "../context/BackendRuntimeContext"; +import { FrontendRuntimeContext } from "../context/FrontendRuntimeContext"; import { FeatureDict as Ogb0FeatureDict, AspectDict as Ogb0AspectDict } from "oak-general-business"; export type BRC = BackendRuntimeContext; export type FRC = FrontendRuntimeContext; diff --git a/es/utils/application.d.ts b/es/utils/application.d.ts index 19d737a8..8a4fb424 100644 --- a/es/utils/application.d.ts +++ b/es/utils/application.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; export declare const applicationProjection: EntityDict['application']['Selection']['data']; export declare const mergedProjection: { [k: string]: any; diff --git a/es/utils/application.js b/es/utils/application.js index 4f4fc296..855892af 100644 --- a/es/utils/application.js +++ b/es/utils/application.js @@ -23,7 +23,9 @@ export const applicationProjection = { id: 1, channel: 1, name: 1, - desc: 1, + type: 1, + allowDeposit: 1, + allowPay: 1, } } } diff --git a/es/utils/pay.d.ts b/es/utils/pay.d.ts index c43e653b..91fba324 100644 --- a/es/utils/pay.d.ts +++ b/es/utils/pay.d.ts @@ -1,7 +1,7 @@ /// -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; -import BackendRuntimeContext from '@project/context/BackendRuntimeContext'; +import BackendRuntimeContext from '../context/BackendRuntimeContext'; import { IncomingHttpHeaders } from 'http'; export declare const fullPayProjection: EntityDict['pay']['Selection']['data']; export declare function payNotify(context: BackendRuntimeContext, body: any, payId: string, headers: IncomingHttpHeaders): Promise; diff --git a/es/utils/pay.js b/es/utils/pay.js index aaba50b4..ec4b788a 100644 --- a/es/utils/pay.js +++ b/es/utils/pay.js @@ -1,7 +1,7 @@ import { getPayClazz } from './payClazz'; import assert from 'assert'; import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; -import { RefundExceedMax } from '@project/types/Exception'; +import { RefundExceedMax } from '../types/Exception'; export const fullPayProjection = { id: 1, applicationId: 1, @@ -27,7 +27,6 @@ export const fullPayProjection = { title: 1, desc: 1, }, - accountId: 1, }; export async function payNotify(context, body, payId, headers) { const [pay] = await context.select('pay', { diff --git a/es/utils/payClazz/Account.d.ts b/es/utils/payClazz/Account.d.ts index e92fddf5..cb232c09 100644 --- a/es/utils/payClazz/Account.d.ts +++ b/es/utils/payClazz/Account.d.ts @@ -1,7 +1,7 @@ -import { OpSchema as Refund } from "@project/oak-app-domain/Refund/Schema"; +import { OpSchema as Refund } from "../../oak-app-domain/Refund/Schema"; import { Schema, OpSchema as Pay, UpdateOperationData as PayUpdateData } from "../../oak-app-domain/Pay/Schema"; import PayClazz from "../../types/PayClazz"; -import { BRC } from "@project/types/RuntimeCxt"; +import { BRC } from "../../types/RuntimeCxt"; export default class Account implements PayClazz { refund(refund: Refund): Promise; closeRefund(refund: Refund): Promise; diff --git a/es/utils/payClazz/Offline.d.ts b/es/utils/payClazz/Offline.d.ts index 9d09a6ff..7725eab0 100644 --- a/es/utils/payClazz/Offline.d.ts +++ b/es/utils/payClazz/Offline.d.ts @@ -1,4 +1,4 @@ -import { OpSchema, UpdateOperationData } from "@project/oak-app-domain/Refund/Schema"; +import { OpSchema, UpdateOperationData } from "../../oak-app-domain/Refund/Schema"; import { OpSchema as Pay, UpdateOperationData as PayUpdateData } from "../../oak-app-domain/Pay/Schema"; import PayClazz from "../../types/PayClazz"; import { BRC } from "../../types/RuntimeCxt"; diff --git a/es/utils/payClazz/WechatPay/WechatPay.d.ts b/es/utils/payClazz/WechatPay/WechatPay.d.ts index f9d75daa..47a1ad28 100644 --- a/es/utils/payClazz/WechatPay/WechatPay.d.ts +++ b/es/utils/payClazz/WechatPay/WechatPay.d.ts @@ -1,10 +1,10 @@ -import { OpSchema as OpPay, Schema as Pay, UpdateOperationData as PayUpdateData } from "@project/oak-app-domain/Pay/Schema"; -import PayClazz from "@project/types/PayClazz"; -import { BRC } from "@project/types/RuntimeCxt"; +import { OpSchema as OpPay, Schema as Pay, UpdateOperationData as PayUpdateData } from "../../../oak-app-domain/Pay/Schema"; +import PayClazz from "../../../types/PayClazz"; +import { BRC } from "../../../types/RuntimeCxt"; import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs'; -import { EntityDict } from "@project/oak-app-domain"; -import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData } from "@project/oak-app-domain/Refund/Schema"; -import { Schema as WpProduct } from '@project/oak-app-domain/WpProduct/Schema'; +import { EntityDict } from "../../../oak-app-domain"; +import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData } from "../../../oak-app-domain/Refund/Schema"; +import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema'; export default class WechatPay implements PayClazz { type: WpProduct['type']; wechatPay: WechatPaySDK; diff --git a/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts b/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts index d508a003..36177d2d 100644 --- a/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts +++ b/es/utils/payClazz/WechatPay/WechatPay.debug.d.ts @@ -1,9 +1,9 @@ -import { OpSchema as Refund, UpdateOperationData as RefundUpdateData } from "@project/oak-app-domain/Refund/Schema"; +import { OpSchema as Refund, UpdateOperationData as RefundUpdateData } from "../../../oak-app-domain/Refund/Schema"; import { EntityDict } from "../../../oak-app-domain"; import { OpSchema as Pay, UpdateOperationData as PayUpdateData } from "../../../oak-app-domain/Pay/Schema"; import PayClazz from "../../../types/PayClazz"; import { BRC } from "../../../types/RuntimeCxt"; -import { Schema as WpProduct } from '@project/oak-app-domain/WpProduct/Schema'; +import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema'; export declare function registerGetPayStateResult(payState: NonNullable): void; export default class WechatPay implements PayClazz { type: WpProduct['type']; diff --git a/es/utils/payClazz/WechatPay/WechatPay.js b/es/utils/payClazz/WechatPay/WechatPay.js index a14fd96b..2119fb3d 100644 --- a/es/utils/payClazz/WechatPay/WechatPay.js +++ b/es/utils/payClazz/WechatPay/WechatPay.js @@ -2,7 +2,7 @@ import fs from 'fs'; import dayJs from 'dayjs'; import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs'; import { compressTo32, decompressFrom32 } from 'oak-domain/lib/utils/uuid'; -import { ExternalPrePayException } from "@project/types/Exception"; +import { ExternalPrePayException } from "../../../types/Exception"; import assert from "assert"; import { omit } from "oak-domain/lib/utils/lodash"; const TRADE_STATE_MATRIX = { diff --git a/es/utils/payClazz/WechatPay/index.d.ts b/es/utils/payClazz/WechatPay/index.d.ts index ce1d041a..eeba2b4b 100644 --- a/es/utils/payClazz/WechatPay/index.d.ts +++ b/es/utils/payClazz/WechatPay/index.d.ts @@ -1,4 +1,4 @@ import WechatPay from './WechatPay'; import WechatPayDebug from './WechatPay.debug'; -declare const _default: typeof WechatPay | typeof WechatPayDebug; +declare const _default: typeof WechatPayDebug | typeof WechatPay; export default _default; diff --git a/es/utils/wpProduct.d.ts b/es/utils/wpProduct.d.ts new file mode 100644 index 00000000..52470d0d --- /dev/null +++ b/es/utils/wpProduct.d.ts @@ -0,0 +1,2 @@ +import { EntityDict } from '../oak-app-domain'; +export declare function getAppTypeFromProductType(type: EntityDict['wpProduct']['OpSchema']['type']): EntityDict['application']['OpSchema']['type'][]; diff --git a/es/utils/wpProduct.js b/es/utils/wpProduct.js new file mode 100644 index 00000000..faa2db60 --- /dev/null +++ b/es/utils/wpProduct.js @@ -0,0 +1,19 @@ +export function getAppTypeFromProductType(type) { + switch (type) { + case 'app': { + return ['native']; + } + case 'h5': { + return ['web']; + } + case 'jsapi': { + return ['wechatPublic']; + } + case 'mp': { + return ['wechatMp']; + } + case 'native': { + return ['web']; + } + } +} diff --git a/es/watchers/index.d.ts b/es/watchers/index.d.ts index fb03095f..255369e1 100644 --- a/es/watchers/index.d.ts +++ b/es/watchers/index.d.ts @@ -1,5 +1,5 @@ import { Watcher } from 'oak-domain/lib/types'; import { EntityDict } from '@oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const watchers: Watcher[]; export default watchers; diff --git a/es/watchers/order.d.ts b/es/watchers/order.d.ts index d6d336aa..ff1576b7 100644 --- a/es/watchers/order.d.ts +++ b/es/watchers/order.d.ts @@ -1,4 +1,4 @@ import { BBWatcher } from 'oak-domain/lib/types/Watcher'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const watchers: BBWatcher[]; export default watchers; diff --git a/es/watchers/pay.d.ts b/es/watchers/pay.d.ts index 2c542b85..005b08f3 100644 --- a/es/watchers/pay.d.ts +++ b/es/watchers/pay.d.ts @@ -1,5 +1,5 @@ import { Watcher } from 'oak-domain/lib/types/Watcher'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const watchers: Watcher[]; export default watchers; diff --git a/es/watchers/pay.js b/es/watchers/pay.js index 0dbd9ea0..1438f8c7 100644 --- a/es/watchers/pay.js +++ b/es/watchers/pay.js @@ -1,5 +1,5 @@ -import { fullPayProjection } from '@project/utils/pay'; -import { getPayClazz } from '@project/utils/payClazz'; +import { fullPayProjection } from '../utils/pay'; +import { getPayClazz } from '../utils/payClazz'; import assert from 'assert'; import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult'; diff --git a/es/watchers/refund.d.ts b/es/watchers/refund.d.ts index da6915fe..b8414baf 100644 --- a/es/watchers/refund.d.ts +++ b/es/watchers/refund.d.ts @@ -1,5 +1,5 @@ import { Watcher } from 'oak-domain/lib/types/Watcher'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const watchers: Watcher[]; export default watchers; diff --git a/es/watchers/refund.js b/es/watchers/refund.js index b6fdbc62..45f41a4a 100644 --- a/es/watchers/refund.js +++ b/es/watchers/refund.js @@ -1,4 +1,4 @@ -import { getPayClazz } from '@project/utils/payClazz'; +import { getPayClazz } from '../utils/payClazz'; import assert from 'assert'; import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult'; diff --git a/lib/aspects/AspectDict.d.ts b/lib/aspects/AspectDict.d.ts index c94493b9..4cd36e12 100644 --- a/lib/aspects/AspectDict.d.ts +++ b/lib/aspects/AspectDict.d.ts @@ -1,5 +1,5 @@ -import { BRC } from '@project/types/RuntimeCxt'; -import { EntityDict } from '@project/oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; export type AspectDict = { getAccountPayRefunds: (params: { accountId: string; diff --git a/lib/aspects/AspectDict.js b/lib/aspects/AspectDict.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/lib/aspects/AspectDict.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/checkers/account.js b/lib/checkers/account.js new file mode 100644 index 00000000..30b4b3db --- /dev/null +++ b/lib/checkers/account.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const checkers = []; +exports.default = checkers; diff --git a/lib/checkers/accountOper.js b/lib/checkers/accountOper.js new file mode 100644 index 00000000..42df606a --- /dev/null +++ b/lib/checkers/accountOper.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const assert_1 = tslib_1.__importDefault(require("assert")); +const types_1 = require("oak-domain/lib/types"); +const checkers = [ + { + entity: 'accountOper', + action: 'create', + type: 'row', + filter: { + account: { + ableState: 'enabled', + }, + }, + errMsg: 'account.update.accountDisabled', + }, + { + entity: 'accountOper', + action: 'create', + type: 'data', + checker(data, context) { + (0, assert_1.default)(!(data instanceof Array)); + const { type, totalPlus, availPlus, refundablePlus } = data; + if (typeof totalPlus !== 'number') { + throw new types_1.OakInputIllegalException('accountOper', ['totalPlus'], 'accountOper中的totalPlus不是数字'); + } + if (typeof availPlus !== 'number') { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper中的availPlus不是数字'); + } + switch (type) { + case 'consume': { + if (totalPlus >= 0 || availPlus > 0 || totalPlus > availPlus) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为consume时,其totalPlus/availPlus必须为0或负数,且totalPlus的绝对值要更大'); + } + break; + } + case 'deposit': { + if (totalPlus < 0 || availPlus < 0 || totalPlus !== availPlus || + typeof refundablePlus === 'number' && refundablePlus < 0) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为deposit时,其totalPlus/availPlus必须为正数且相等, refundable必须为空或者正数'); + } + break; + } + case 'loan': { + if (totalPlus !== 0 || availPlus >= 0) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为loan时,其totalPlus必须为0,且availPlus必须为负数'); + } + break; + } + case 'repay': { + if (totalPlus !== 0 || availPlus <= 0) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为repay时,其totalPlus必须为0,且availPlus必须为正数'); + } + break; + } + case 'withdraw': { + if (totalPlus >= 0 || availPlus >= 0 || totalPlus !== availPlus) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为withdraw时,其totalPlus和availPlus必须为不相等的负数'); + } + break; + } + case 'withdrawBack': { + if (totalPlus <= 0 || availPlus <= 0 || totalPlus !== availPlus) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为withdraw时,其totalPlus和availPlus必须为不相等的正数'); + } + break; + } + case 'loss': { + if (totalPlus >= 0 || availPlus > 0 || totalPlus !== availPlus) { + throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'accountOper为consume时,其totalPlus/availPlus必须为0或负数,且totalPlus的绝对值要更大'); + } + break; + } + case 'cutoffRefundable': { + if (totalPlus !== 0 || availPlus !== 0 || typeof refundablePlus !== 'number' || refundablePlus >= 0) { + throw new types_1.OakInputIllegalException('accountOper', ['refundablePlus'], 'accountOper为cutoffRefundable时,其totalPlus/availPlus必须为0,且refundablePlus必须为负数'); + } + break; + } + default: { + (0, assert_1.default)(false); + break; + } + } + } + } +]; +exports.default = checkers; diff --git a/lib/checkers/index.js b/lib/checkers/index.js new file mode 100644 index 00000000..6251a72b --- /dev/null +++ b/lib/checkers/index.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const accountOper_1 = tslib_1.__importDefault(require("./accountOper")); +const pay_1 = tslib_1.__importDefault(require("./pay")); +const order_1 = tslib_1.__importDefault(require("./order")); +const application_1 = tslib_1.__importDefault(require("./application")); +const offlineAccount_1 = tslib_1.__importDefault(require("./offlineAccount")); +const checkers = [ + ...accountOper_1.default, + ...pay_1.default, + ...order_1.default, + ...application_1.default, + ...offlineAccount_1.default, +]; +exports.default = checkers; diff --git a/lib/checkers/offlineAccount.d.ts b/lib/checkers/offlineAccount.d.ts new file mode 100644 index 00000000..54714d63 --- /dev/null +++ b/lib/checkers/offlineAccount.d.ts @@ -0,0 +1,5 @@ +import { Checker } from 'oak-domain/lib/types/Auth'; +import { EntityDict } from '../oak-app-domain'; +import { RuntimeCxt } from '../types/RuntimeCxt'; +declare const checkers: Checker[]; +export default checkers; diff --git a/lib/checkers/offlineAccount.js b/lib/checkers/offlineAccount.js new file mode 100644 index 00000000..7ee67526 --- /dev/null +++ b/lib/checkers/offlineAccount.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const assert_1 = tslib_1.__importDefault(require("assert")); +const types_1 = require("oak-domain/lib/types"); +const executor_1 = require("oak-domain/lib/utils/executor"); +function checkAttributes(data) { + const { type, channel, name, qrCode } = data; + switch (type) { + case 'bank': { + if (!channel || !name || !qrCode) { + throw new types_1.OakAttrNotNullException('offlineAccount', ['channel', 'name', 'qrCode'].filter(ele => !data[ele])); + } + break; + } + case 'shouqianba': + case 'wechat': + case 'alipay': { + if (!name && !qrCode) { + throw new types_1.OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull'); + } + break; + } + case 'others': { + if (!name && !qrCode) { + throw new types_1.OakAttrNotNullException('offlineAccount', ['name', 'qrCode']); + } + if (!channel) { + throw new types_1.OakAttrNotNullException('offlineAccount', ['channel']); + } + } + } +} +const checkers = [ + { + entity: 'offlineAccount', + action: 'create', + type: 'data', + checker(data) { + (0, assert_1.default)(!(data instanceof Array)); + checkAttributes(data); + } + }, + { + entity: 'offlineAccount', + action: 'update', + type: 'logicalData', + checker: (operation, context) => { + const { data, filter } = operation; + return (0, executor_1.pipeline)(() => context.select('offlineAccount', { + data: { + id: 1, + type: 1, + channel: 1, + name: 1, + qrCode: 1, + }, + filter + }, { dontCollect: true }), (accounts) => { + accounts.forEach((ele) => checkAttributes(Object.assign(ele, data))); + }); + } + } +]; +exports.default = checkers; diff --git a/lib/checkers/order.js b/lib/checkers/order.js new file mode 100644 index 00000000..34739dfc --- /dev/null +++ b/lib/checkers/order.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const checkers = [ + { + type: 'logical', + entity: 'order', + action: 'create', + checker: (operation, context) => { + const { data } = operation; + if (!data.creatorId) { + data.creatorId = context.getCurrentUserId(); + } + data.paid = 0; + data.refunded = 0; + return 1; + } + } +]; +exports.default = checkers; diff --git a/lib/checkers/pay.d.ts b/lib/checkers/pay.d.ts index 96ed6c49..c92e5353 100644 --- a/lib/checkers/pay.d.ts +++ b/lib/checkers/pay.d.ts @@ -1,5 +1,5 @@ import { Checker } from 'oak-domain/lib/types/Auth'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { RuntimeCxt } from '../types/RuntimeCxt'; declare const checkers: Checker[]; export default checkers; diff --git a/lib/checkers/refund.d.ts b/lib/checkers/refund.d.ts index 5621432e..b7d20df2 100644 --- a/lib/checkers/refund.d.ts +++ b/lib/checkers/refund.d.ts @@ -1,5 +1,5 @@ import { Checker } from 'oak-domain/lib/types/Auth'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { RuntimeCxt } from '../types/RuntimeCxt'; declare const checkers: Checker[]; export default checkers; diff --git a/lib/checkers/refund.js b/lib/checkers/refund.js new file mode 100644 index 00000000..4d25373e --- /dev/null +++ b/lib/checkers/refund.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const checkers = [ + { + // 退款所在的pay一定是可以退款状态,且其上不能有另一个正在退款的请求 + entity: 'refund', + type: 'row', + filter: { + pay: { + refundable: true, + refund$pay: { + '#sqp': 'not in', + iState: 'refunding', + } + }, + }, + action: 'create', + } +]; +exports.default = checkers; diff --git a/lib/configuration/attrUpdateMatrix.d.ts b/lib/configuration/attrUpdateMatrix.d.ts index 1f9d800f..e2fb199f 100644 --- a/lib/configuration/attrUpdateMatrix.d.ts +++ b/lib/configuration/attrUpdateMatrix.d.ts @@ -1,4 +1,4 @@ import { AttrUpdateMatrix } from 'oak-domain/lib/types/EntityDesc'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const attrUpdateMatrix: AttrUpdateMatrix; export default attrUpdateMatrix; diff --git a/lib/configuration/attrUpdateMatrix.js b/lib/configuration/attrUpdateMatrix.js index 9904f873..531a23ce 100644 --- a/lib/configuration/attrUpdateMatrix.js +++ b/lib/configuration/attrUpdateMatrix.js @@ -63,6 +63,70 @@ const attrUpdateMatrix = { meta: { actions: ['succeed', 'fail', 'succeedPartially'], }, - } + }, + offlineAccount: { + name: { + actions: ['update'], + filter: { + // 只有从来没用过的才能改 + sysAccountOper$entity: { + "#sqp": 'not in', + } + } + }, + channel: { + actions: ['update'], + filter: { + // 只有从来没用过的才能改 + sysAccountOper$entity: { + "#sqp": 'not in', + } + } + }, + qrCode: { + actions: ['update'], + }, + enabled: { + actions: ['update'], + }, + price: { + actions: ['pay', 'refund', 'deposit', 'withdraw', 'tax'], + } + }, + wpAccount: { + wechatPay: { + actions: ['update'], + }, + taxlossRatio: { + actions: ['update'], + }, + depositLossRatio: { + actions: ['update'], + }, + refundGapDays: { + actions: ['update'], + }, + refundLossRatio: { + actions: ['update'], + }, + refundLossFloor: { + actions: ['update'], + }, + publicKeyFilePath: { + actions: ['update'], + }, + privateKeyFilePath: { + actions: ['update'], + }, + apiV3Key: { + actions: ['update'], + }, + enabled: { + actions: ['update'], + }, + price: { + actions: ['pay', 'refund', 'deposit', 'withdraw', 'tax'], + } + }, }; exports.default = attrUpdateMatrix; diff --git a/lib/configuration/cache.d.ts b/lib/configuration/cache.d.ts index 9a57f1b0..0189e1d1 100644 --- a/lib/configuration/cache.d.ts +++ b/lib/configuration/cache.d.ts @@ -1,3 +1,3 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const cacheSavedEntities: (keyof EntityDict)[]; export default cacheSavedEntities; diff --git a/lib/configuration/cache.js b/lib/configuration/cache.js new file mode 100644 index 00000000..ef6a34c3 --- /dev/null +++ b/lib/configuration/cache.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cacheSavedEntities = []; +exports.default = cacheSavedEntities; diff --git a/lib/configuration/index.d.ts b/lib/configuration/index.d.ts index d92b8134..dc4a26a5 100644 --- a/lib/configuration/index.d.ts +++ b/lib/configuration/index.d.ts @@ -1,4 +1,4 @@ import { CommonConfiguration } from 'oak-domain/lib/types/Configuration'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const _default: CommonConfiguration; export default _default; diff --git a/lib/configuration/index.js b/lib/configuration/index.js index 02440adb..7f571a54 100644 --- a/lib/configuration/index.js +++ b/lib/configuration/index.js @@ -5,7 +5,7 @@ const tslib_1 = require("tslib"); * index中汇总了前端启动需要的引用配置 */ const attrUpdateMatrix_1 = tslib_1.__importDefault(require("./attrUpdateMatrix")); -const ActionDefDict_1 = require("@project/oak-app-domain/ActionDefDict"); +const ActionDefDict_1 = require("../oak-app-domain/ActionDefDict"); const relation_1 = require("./relation"); const cache_1 = tslib_1.__importDefault(require("./cache")); exports.default = { diff --git a/lib/configuration/relation.d.ts b/lib/configuration/relation.d.ts index 3230f46e..35709b70 100644 --- a/lib/configuration/relation.d.ts +++ b/lib/configuration/relation.d.ts @@ -1,5 +1,5 @@ import { AuthDeduceRelationMap, UpdateFreeDict } from 'oak-domain/lib/types/Entity'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; export declare const authDeduceRelationMap: AuthDeduceRelationMap; export declare const selectFreeEntities: string[]; export declare const updateFreeDict: UpdateFreeDict; diff --git a/lib/configuration/relation.js b/lib/configuration/relation.js new file mode 100644 index 00000000..e311fea6 --- /dev/null +++ b/lib/configuration/relation.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.updateFreeDict = exports.selectFreeEntities = exports.authDeduceRelationMap = void 0; +// 此对象所标识的entity的权限由其外键指向的父对象判定 +exports.authDeduceRelationMap = {}; +exports.selectFreeEntities = [ + 'offlineAccount', + 'wpProduct', +]; +exports.updateFreeDict = {}; +exports.default = { + authDeduceRelationMap: exports.authDeduceRelationMap, + selectFreeEntities: exports.selectFreeEntities, + updateFreeDict: exports.updateFreeDict, +}; diff --git a/lib/configuration/render.d.ts b/lib/configuration/render.d.ts index eccbd37b..06b97f82 100644 --- a/lib/configuration/render.d.ts +++ b/lib/configuration/render.d.ts @@ -1,4 +1,4 @@ import { RenderConfiguration } from 'oak-domain/lib/types/Configuration'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const _default: RenderConfiguration; export default _default; diff --git a/lib/configuration/render.js b/lib/configuration/render.js new file mode 100644 index 00000000..9c2a38ea --- /dev/null +++ b/lib/configuration/render.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const StyleDict_1 = require("../oak-app-domain/StyleDict"); +exports.default = { + styleDict: StyleDict_1.styleDict, +}; diff --git a/lib/context/BackendRuntimeContext.d.ts b/lib/context/BackendRuntimeContext.d.ts index 2e21e8c7..d2a9c518 100644 --- a/lib/context/BackendRuntimeContext.d.ts +++ b/lib/context/BackendRuntimeContext.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; import { RuntimeContext } from './RuntimeContext'; import { BackendRuntimeContext as DependentBackendRuntimeContext } from './DependentContext'; @@ -15,7 +15,7 @@ export declare class BackendRuntimeContext | undefined; + config?: number | import("oak-domain/lib/types").JsonProjection | undefined; style?: number | import("oak-domain/lib/types").JsonProjection | undefined; domainId?: number | undefined; domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined; diff --git a/lib/context/BackendRuntimeContext.js b/lib/context/BackendRuntimeContext.js index f1b03047..13c4297a 100644 --- a/lib/context/BackendRuntimeContext.js +++ b/lib/context/BackendRuntimeContext.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.BackendRuntimeContext = void 0; const DependentContext_1 = require("./DependentContext"); -const application_1 = require("@project/utils/application"); +const application_1 = require("../utils/application"); class BackendRuntimeContext extends DependentContext_1.BackendRuntimeContext { applicationProjection = application_1.mergedProjection; async toString() { diff --git a/lib/context/FrontendRuntimeContext.d.ts b/lib/context/FrontendRuntimeContext.d.ts index 84022845..469bf7c4 100644 --- a/lib/context/FrontendRuntimeContext.d.ts +++ b/lib/context/FrontendRuntimeContext.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from './DependentContext'; import { RuntimeContext } from './RuntimeContext'; diff --git a/lib/context/FrontendRuntimeContext.js b/lib/context/FrontendRuntimeContext.js new file mode 100644 index 00000000..7ac04723 --- /dev/null +++ b/lib/context/FrontendRuntimeContext.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FrontendRuntimeContext = void 0; +const DependentContext_1 = require("./DependentContext"); +class FrontendRuntimeContext extends DependentContext_1.FrontendRuntimeContext { + async toString() { + const data = await this.getSerializedData(); + return JSON.stringify(data); + } +} +exports.FrontendRuntimeContext = FrontendRuntimeContext; +exports.default = FrontendRuntimeContext; diff --git a/lib/data/actionAuth.d.ts b/lib/data/actionAuth.d.ts index 6d24ca70..41f922ec 100644 --- a/lib/data/actionAuth.d.ts +++ b/lib/data/actionAuth.d.ts @@ -1,3 +1,3 @@ -import { CreateOperationData as ActionAuth } from '@project/oak-app-domain/ActionAuth/Schema'; +import { CreateOperationData as ActionAuth } from '../oak-app-domain/ActionAuth/Schema'; declare const actionAuths: ActionAuth[]; export default actionAuths; diff --git a/lib/data/actionAuth.js b/lib/data/actionAuth.js new file mode 100644 index 00000000..c4ffabfe --- /dev/null +++ b/lib/data/actionAuth.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const actionAuths = [ + { + id: 'creator-order', + pathId: 'creator-order', + deActions: ['select', 'create'], + }, + { + id: 'creator-pay', + pathId: 'creator-pay', + deActions: ['select', 'create'] + }, + { + id: 'user-acc-pay', + pathId: 'user-acc-pay', + deActions: ['select', 'update', 'startPaying', 'startRefunding', 'close'] + }, + { + id: 'creator-refund', + pathId: 'creator-refund', + deActions: ['select', 'create'], + }, + { + id: 'user-acc-pay-refund', + pathId: 'user-acc-pay-refund', + deActions: ['select'] + }, + { + id: 'user-withdrawAccount', + pathId: 'user-withdrawAccount', + deActions: ['select', 'create', 'update', 'remove'], + }, + { + id: 'creator-withdraw', + pathId: 'creator-withdraw', + deActions: ['select', 'create'], + }, + { + id: 'user-account-withdraw', + pathId: 'user-account-withdraw', + deActions: ['select'], + } +]; +exports.default = actionAuths; diff --git a/lib/data/i18n.js b/lib/data/i18n.js index 4aaafb87..ea19503d 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -55,6 +55,20 @@ const i18ns = [ position: "src/components/accountOper/list", data: {} }, + { + id: "50388a328d027544c140578a7a614845", + namespace: "oak-pay-business-c-offlineAccount-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/offlineAccount/config", + data: { + "tips": "线下账户是需要system的相关工作人员手动同步收款和打款结果的账户", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, { id: "17cdc7adc4c7b439ae2298a7f9920855", namespace: "oak-pay-business-c-offlineAccount-upsert", @@ -62,16 +76,29 @@ const i18ns = [ module: "oak-pay-business", position: "src/components/offlineAccount/upsert", data: { - "tips": "线下交易账户是需要人工同步收款和打款行为的账户", - "label": { - "channel": { - "bank": "银行及所属支行" - } - }, "placeholder": { "channel": { - "bank": "银行-所属支行" + "bank": "银行/支行", + "others": "请输入途径名称" + }, + "name": { + "bank": "输入户主姓名", + "alipay": "输入支付宝帐号", + "wechat": "输入微信号", + "shouqianba": "输入收钱吧商户号", + "others": "输入该收款途径的唯一账号" + }, + "qrCode": { + "bank": "请输入银行账号", + "alipay": "请将二维码解析后的字符串填入", + "wechat": "请将二维码解析后的字符串填入", + "shouqianba": "请将二维码解析后的字符串填入", + "others": "请将二维码解析后的字符串填入" } + }, + "help": { + "allowDeposit": "是否允许用户在系统中主动向此账号发起充值", + "allowPay": "是否允许用户在系统中主动向此账号发起支付" } } }, @@ -266,6 +293,20 @@ const i18ns = [ } } }, + { + id: "79255be8c093dfef9765b3f367cab553", + namespace: "oak-pay-business-c-wechatPay-upsert", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wechatPay/upsert", + data: { + "placeholder": { + "lossRatio": "填百分比(0.6就代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint" + } + } + }, { id: "6a1df36d072d367121b49dfc665b4100", namespace: "oak-pay-business-c-withdraw-create", @@ -401,6 +442,54 @@ const i18ns = [ } } }, + { + id: "7273f5a9fdb45407416554325a1abb1e", + namespace: "oak-pay-business-c-wpAccount-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpAccount/config", + data: { + "tips": "微信支付账户是用来配置微信支付的账户相关信息", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, + { + id: "33691d391e052cccf005d0f0da84e20e", + namespace: "oak-pay-business-c-wpAccount-upsert", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpAccount/upsert", + data: { + "placeholder": { + "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", + "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", + "taxlossRatio": "微信支付收取的手续费,一般为0.6(代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint", + "apiV3Key": "需要登录商户后台获取", + "refundGapDays": "超过这个天数后无法退款", + "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", + "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" + }, + "wechatPayIsShared": "以上配置是全局的,请谨慎修改" + } + }, + { + id: "634284beff0e0bdf84fb23cdeea9107d", + namespace: "oak-pay-business-c-wpProduct-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpProduct/config", + data: { + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, { id: "2127948cb52e116e3ceccd93db8f319c", namespace: "oak-pay-business-l-common", @@ -472,6 +561,38 @@ const i18ns = [ } } }, + { + id: "8ff2d28d93f47ceaa08aab6211449db8", + namespace: "oak-pay-business-l-offlineAccount", + language: "zh-CN", + module: "oak-pay-business", + position: "locales/offlineAccount", + data: { + "label": { + "channel": { + "bank": "银行及所属支行", + "others": "途径名" + }, + "name": { + "bank": "户主姓名", + "alipay": "支付宝账号", + "wechat": "微信号", + "shouqianba": "收钱吧商户号", + "others": "相应帐号" + }, + "qrCode": { + "bank": "银行账号", + "alipay": "收款二维码", + "wechat": "收款二维码", + "shouqianba": "收款二维码", + "others": "收款二维码" + } + }, + "error": { + "nameQrCodeBothNull": "账号名和二维码不能同时为空" + } + } + }, { id: "e8c0a965783373d9117f9447ebbbad8d", namespace: "oak-pay-business-l-payChannel", diff --git a/lib/data/index.js b/lib/data/index.js new file mode 100644 index 00000000..a5a2693a --- /dev/null +++ b/lib/data/index.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const i18n_1 = tslib_1.__importDefault(require("./i18n")); +const path_1 = tslib_1.__importDefault(require("./path")); +const actionAuth_1 = tslib_1.__importDefault(require("./actionAuth")); +exports.default = { + i18n: i18n_1.default, + path: path_1.default, + actionAuth: actionAuth_1.default, +}; diff --git a/lib/data/path.d.ts b/lib/data/path.d.ts index a5c1abca..f1acfd9e 100644 --- a/lib/data/path.d.ts +++ b/lib/data/path.d.ts @@ -1,3 +1,3 @@ -import { CreateOperationData as Path } from '@project/oak-app-domain/Path/Schema'; +import { CreateOperationData as Path } from '../oak-app-domain/Path/Schema'; declare const paths: Path[]; export default paths; diff --git a/lib/data/path.js b/lib/data/path.js new file mode 100644 index 00000000..c4ac7252 --- /dev/null +++ b/lib/data/path.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const paths = [ + { + id: 'creator-order', + sourceEntity: 'user', + destEntity: 'order', + value: 'creator', + recursive: false, + }, + { + id: 'user-acc-pay', + sourceEntity: 'user', + destEntity: 'pay', + value: 'account.user', + recursive: false, + }, + { + id: 'creator-order-pay', + sourceEntity: 'user', + destEntity: 'pay', + value: 'order.creator', + recursive: false, + }, + { + id: 'creator-pay', + sourceEntity: 'user', + destEntity: 'pay', + value: 'creator', + recursive: false, + }, + { + id: 'creator-refund', + sourceEntity: 'user', + destEntity: 'refund', + value: 'creator', + recursive: false, + }, + { + id: 'user-acc-pay-refund', + sourceEntity: 'user', + destEntity: 'refund', + value: 'pay.account.user', + recursive: false, + }, + { + id: 'creator-order-pay-refund', + sourceEntity: 'user', + destEntity: 'refund', + value: 'pay.order.creator', + recursive: false, + }, + { + id: 'user-withdrawAccount', + sourceEntity: 'user', + destEntity: 'withdrawAccount', + value: 'user', + recursive: false, + }, + { + id: 'creator-withdraw', + sourceEntity: 'user', + destEntity: 'withdraw', + value: 'creator', + recursive: false, + }, + { + id: 'user-account-withdraw', + sourceEntity: 'user', + destEntity: 'withdraw', + value: 'account.user', + recursive: false, + } +]; +exports.default = paths; diff --git a/lib/entities/OfflineAccount.d.ts b/lib/entities/OfflineAccount.d.ts index f8527159..419b9a4c 100644 --- a/lib/entities/OfflineAccount.d.ts +++ b/lib/entities/OfflineAccount.d.ts @@ -1,8 +1,9 @@ -import { String, Text, Boolean } from 'oak-domain/lib/types/DataType'; +import { String, Text, Price, Boolean } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as System } from 'oak-general-business/lib/entities/System'; import { Schema as Pay } from './Pay'; +import { Schema as SysAccountOper } from './SysAccountOper'; export interface Schema extends EntityShape { type: 'bank' | 'alipay' | 'wechat' | 'shouqianba' | 'others'; channel?: String<32>; @@ -11,8 +12,12 @@ export interface Schema extends EntityShape { allowDeposit: Boolean; allowPay: Boolean; system: System; + price: Price; pays: Pay[]; + opers: SysAccountOper[]; + enabled: Boolean; } -export declare const entityDesc: EntityDesc; diff --git a/lib/entities/OfflineAccount.js b/lib/entities/OfflineAccount.js index b6f1364e..25ef8d05 100644 --- a/lib/entities/OfflineAccount.js +++ b/lib/entities/OfflineAccount.js @@ -5,7 +5,7 @@ exports.entityDesc = void 0; exports.entityDesc = { locales: { zh_CN: { - name: '离线账号管理', + name: '线下账户', attr: { type: '类型', channel: '通道', @@ -14,7 +14,10 @@ exports.entityDesc = { allowDeposit: '允许主动充值', allowPay: '允许主动支付', system: '所属系统', + price: '余额', pays: '支付', + opers: '操作记录', + enabled: '是否启用', }, v: { type: { @@ -25,17 +28,31 @@ exports.entityDesc = { others: '其它', }, }, + action: { + pay: '支付', + refund: '退款', + deposit: '充值', + withdraw: '提现', + tax: '渠道费', + } }, }, style: { color: { type: { bank: '#E74C3C', - alipay: '#3498DB', - wechat: '#27AE60', - shouqianba: '#F1C40F', + alipay: '#1678ff', + wechat: '#04BE02', + shouqianba: '#ffc106', others: '#34495E', }, }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', + } }, }; diff --git a/lib/entities/SysAccountOper.d.ts b/lib/entities/SysAccountOper.d.ts new file mode 100644 index 00000000..8d98b7c8 --- /dev/null +++ b/lib/entities/SysAccountOper.d.ts @@ -0,0 +1,12 @@ +import { String, Price } from 'oak-domain/lib/types/DataType'; +import { EntityShape } from 'oak-domain/lib/types/Entity'; +import { EntityDesc } from 'oak-domain/lib/types'; +export interface Schema extends EntityShape { + delta: Price; + type: 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; + entity: String<32>; + entityId: String<64>; +} +export declare const entityDesc: EntityDesc; diff --git a/lib/entities/SysAccountOper.js b/lib/entities/SysAccountOper.js new file mode 100644 index 00000000..06bfd774 --- /dev/null +++ b/lib/entities/SysAccountOper.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.entityDesc = void 0; +; +exports.entityDesc = { + locales: { + zh_CN: { + name: '系统账户操作', + attr: { + type: '类型', + delta: '余额变化', + entity: '关联对象', + entityId: '关联对象Id', + }, + v: { + type: { + deposit: '充值', + withdraw: '提现', + pay: '支付', + refund: '退款', + tax: '渠道手续费' + }, + }, + }, + }, + style: { + color: { + type: { + deposit: '#3498DB', + withdraw: '#F7DC6F', + pay: '#82E0AA', + tax: '#2E4053', + refund: '#2E4053', + } + } + }, + configuration: { + actionType: 'appendOnly', + } +}; diff --git a/lib/entities/WechatPay.d.ts b/lib/entities/WechatPay.d.ts index 8851471b..0beb08ce 100644 --- a/lib/entities/WechatPay.d.ts +++ b/lib/entities/WechatPay.d.ts @@ -1,9 +1,10 @@ -import { String, Decimal } from 'oak-domain/lib/types/DataType'; +import { String } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; +import { Schema as System } from 'oak-general-business/lib/entities/System'; export interface Schema extends EntityShape { payNotifyUrl: String<128>; refundNotifyUrl: String<128>; - lossRatio: Decimal<4, 2>; + system: System; } export declare const entityDesc: EntityDesc; diff --git a/lib/entities/WechatPay.js b/lib/entities/WechatPay.js index aa0830ab..47b03556 100644 --- a/lib/entities/WechatPay.js +++ b/lib/entities/WechatPay.js @@ -9,7 +9,7 @@ exports.entityDesc = { attr: { payNotifyUrl: '支付通知回调', refundNotifyUrl: '退款通知回调', - lossRatio: '支付损耗比例' + system: '关联系统' }, }, }, diff --git a/lib/entities/WpAccount.d.ts b/lib/entities/WpAccount.d.ts index 93f267a8..2851ab37 100644 --- a/lib/entities/WpAccount.d.ts +++ b/lib/entities/WpAccount.d.ts @@ -1,10 +1,12 @@ -import { String, Text, Price, Int, Decimal } from 'oak-domain/lib/types/DataType'; +import { String, Text, Price, Boolean, Int, Decimal } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as WechatPay } from './WechatPay'; import { Schema as System } from 'oak-general-business/lib/entities/System'; +import { Schema as SysAccountOper } from './SysAccountOper'; export interface Schema extends EntityShape { wechatPay: WechatPay; + taxlossRatio: Decimal<4, 2>; depositLossRatio?: Decimal<4, 2>; refundGapDays?: Int<4>; refundLossRatio?: Decimal<4, 2>; @@ -15,7 +17,10 @@ export interface Schema extends EntityShape { apiV3Key: String<32>; price: Price; system: System; + opers: SysAccountOper[]; + enabled: Boolean; } -export declare const entityDesc: EntityDesc; }>; diff --git a/lib/entities/WpAccount.js b/lib/entities/WpAccount.js index a759650c..4f6aaf9b 100644 --- a/lib/entities/WpAccount.js +++ b/lib/entities/WpAccount.js @@ -8,6 +8,7 @@ exports.entityDesc = { name: '微信支付帐号', attr: { wechatPay: '微信支付', + taxlossRatio: '商户号手续费(百分比)', depositLossRatio: '充值损耗百分比', refundGapDays: '(支付后)允许退款的天数', refundLossRatio: '退款损耗百分比', @@ -17,13 +18,22 @@ exports.entityDesc = { privateKeyFilePath: '私钥文件路径', apiV3Key: 'apiV3Key', price: '余额', - system: '关联系统' + system: '关联系统', + opers: '操作记录', + enabled: '是否启用', }, v: { refundLossFloor: { yuan: '元', jiao: '角' }, + }, + action: { + pay: '支付', + refund: '退款', + deposit: '充值', + withdraw: '提现', + tax: '渠道费', } }, }, @@ -33,6 +43,13 @@ exports.entityDesc = { yuan: '#FFFF00', jiao: '#00FF00' } + }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', } } }; diff --git a/lib/entities/WpProduct.d.ts b/lib/entities/WpProduct.d.ts index b3f2a6ac..4ecd87b3 100644 --- a/lib/entities/WpProduct.d.ts +++ b/lib/entities/WpProduct.d.ts @@ -1,3 +1,4 @@ +import { Boolean } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc } from 'oak-domain/lib/types'; import { Schema as WpAccount } from './WpAccount'; @@ -7,6 +8,7 @@ export interface Schema extends EntityShape { wpAccount: WpAccount; type: 'native' | 'mp' | 'jsapi' | 'h5' | 'app'; application: Application; + enabled: Boolean; pays: Pay[]; } export declare const entityDesc: EntityDesc['application']); diff --git a/lib/features/Pay.js b/lib/features/Pay.js index 681025a8..981502a2 100644 --- a/lib/features/Pay.js +++ b/lib/features/Pay.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const oak_frontend_base_1 = require("oak-frontend-base"); -// import { getDepositRatio } from "@project/utils/pay"; +// import { getDepositRatio } from "../utils/pay"; class Pay extends oak_frontend_base_1.Feature { application; constructor(application) { diff --git a/lib/features/index.d.ts b/lib/features/index.d.ts index a57b00a4..6f8bd326 100644 --- a/lib/features/index.d.ts +++ b/lib/features/index.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { AccessConfiguration } from 'oak-domain/lib/types/Configuration'; import { BasicFeatures } from 'oak-frontend-base'; import { FeatureDict as Ogb0FeatureDict } from "oak-general-business"; diff --git a/lib/features/index.js b/lib/features/index.js index f71cb4e9..56adbb69 100644 --- a/lib/features/index.js +++ b/lib/features/index.js @@ -5,7 +5,7 @@ const tslib_1 = require("tslib"); const lodash_1 = require("oak-domain/lib/utils/lodash"); const features_1 = require("oak-general-business/es/features"); const Pay_1 = tslib_1.__importDefault(require("./Pay")); -const application_1 = require("@project/utils/application"); +const application_1 = require("../utils/application"); function create(features) { const pay = new Pay_1.default(features.application); return { diff --git a/lib/hooks/useFeatures.d.ts b/lib/hooks/useFeatures.d.ts index 5e78bfa8..783fdd89 100644 --- a/lib/hooks/useFeatures.d.ts +++ b/lib/hooks/useFeatures.d.ts @@ -1,2 +1,2 @@ -import { AFD } from '@project/types/RuntimeCxt'; +import { AFD } from '../types/RuntimeCxt'; export default function useFeatures(): AFD; diff --git a/lib/hooks/useFeatures.js b/lib/hooks/useFeatures.js new file mode 100644 index 00000000..a6365fc1 --- /dev/null +++ b/lib/hooks/useFeatures.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const web_1 = require("oak-frontend-base/es/platforms/web"); +// react 独有 +// 这里因为开发时要引用src,而AFD定义中引用lib,所以有编译的warning. by Xc +function useFeatures() { + // @ts-ignore + return (0, web_1.useFeatures)(); +} +exports.default = useFeatures; +; diff --git a/lib/locales/offlineAccount/zh-CN.json b/lib/locales/offlineAccount/zh-CN.json new file mode 100644 index 00000000..4bf98003 --- /dev/null +++ b/lib/locales/offlineAccount/zh-CN.json @@ -0,0 +1,25 @@ +{ + "label": { + "channel": { + "bank": "银行及所属支行", + "others": "途径名" + }, + "name": { + "bank": "户主姓名", + "alipay": "支付宝账号", + "wechat": "微信号", + "shouqianba": "收钱吧商户号", + "others": "相应帐号" + }, + "qrCode": { + "bank": "银行账号", + "alipay": "收款二维码", + "wechat": "收款二维码", + "shouqianba": "收款二维码", + "others": "收款二维码" + } + }, + "error": { + "nameQrCodeBothNull": "账号名和二维码不能同时为空" + } +} diff --git a/lib/oak-app-domain/ActionDefDict.d.ts b/lib/oak-app-domain/ActionDefDict.d.ts index 5892bd9b..bb83c723 100644 --- a/lib/oak-app-domain/ActionDefDict.d.ts +++ b/lib/oak-app-domain/ActionDefDict.d.ts @@ -42,6 +42,7 @@ export declare const actionDefDict: { deposit: { iState: import("oak-domain/lib/types").ActionDef; }; + offlineAccount: {}; order: { iState: import("oak-domain/lib/types").ActionDef; }; @@ -58,4 +59,5 @@ export declare const actionDefDict: { withdraw: { iState: import("oak-domain/lib/types").ActionDef; }; + wpAccount: {}; }; diff --git a/lib/oak-app-domain/ActionDefDict.js b/lib/oak-app-domain/ActionDefDict.js index ba65bc8d..e1cf303d 100644 --- a/lib/oak-app-domain/ActionDefDict.js +++ b/lib/oak-app-domain/ActionDefDict.js @@ -17,11 +17,13 @@ const Action_13 = require("./WechatMenu/Action"); const Action_14 = require("./WechatPublicTag/Action"); const Action_15 = require("./Account/Action"); const Action_16 = require("./Deposit/Action"); -const Action_17 = require("./Order/Action"); -const Action_18 = require("./Pay/Action"); -const Action_19 = require("./Refund/Action"); -const Action_20 = require("./User/Action"); -const Action_21 = require("./Withdraw/Action"); +const Action_17 = require("./OfflineAccount/Action"); +const Action_18 = require("./Order/Action"); +const Action_19 = require("./Pay/Action"); +const Action_20 = require("./Refund/Action"); +const Action_21 = require("./User/Action"); +const Action_22 = require("./Withdraw/Action"); +const Action_23 = require("./WpAccount/Action"); exports.actionDefDict = { modi: Action_1.actionDefDict, captcha: Action_2.actionDefDict, @@ -39,9 +41,11 @@ exports.actionDefDict = { wechatPublicTag: Action_14.actionDefDict, account: Action_15.actionDefDict, deposit: Action_16.actionDefDict, - order: Action_17.actionDefDict, - pay: Action_18.actionDefDict, - refund: Action_19.actionDefDict, - user: Action_20.actionDefDict, - withdraw: Action_21.actionDefDict + offlineAccount: Action_17.actionDefDict, + order: Action_18.actionDefDict, + pay: Action_19.actionDefDict, + refund: Action_20.actionDefDict, + user: Action_21.actionDefDict, + withdraw: Action_22.actionDefDict, + wpAccount: Action_23.actionDefDict }; diff --git a/lib/oak-app-domain/EntityDict.d.ts b/lib/oak-app-domain/EntityDict.d.ts index 1a00feb0..1e718b66 100644 --- a/lib/oak-app-domain/EntityDict.d.ts +++ b/lib/oak-app-domain/EntityDict.d.ts @@ -59,6 +59,7 @@ import { EntityDef as OfflineAccount } from "./OfflineAccount/Schema"; import { EntityDef as Order } from "./Order/Schema"; import { EntityDef as Pay } from "./Pay/Schema"; import { EntityDef as Refund } from "./Refund/Schema"; +import { EntityDef as SysAccountOper } from "./SysAccountOper/Schema"; import { EntityDef as WechatPay } from "./WechatPay/Schema"; import { EntityDef as Withdraw } from "./Withdraw/Schema"; import { EntityDef as WithdrawAccount } from "./WithdrawAccount/Schema"; @@ -127,6 +128,7 @@ export type EntityDict = { order: Order; pay: Pay; refund: Refund; + sysAccountOper: SysAccountOper; wechatPay: WechatPay; withdraw: Withdraw; withdrawAccount: WithdrawAccount; diff --git a/lib/oak-app-domain/OfflineAccount/Action.d.ts b/lib/oak-app-domain/OfflineAccount/Action.d.ts new file mode 100644 index 00000000..bbec0c80 --- /dev/null +++ b/lib/oak-app-domain/OfflineAccount/Action.d.ts @@ -0,0 +1,5 @@ +import { GenericAction } from "oak-domain/lib/actions/action"; +export type ParticularAction = 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; +export declare const actions: string[]; +export type Action = GenericAction | ParticularAction | string; +export declare const actionDefDict: {}; diff --git a/lib/oak-app-domain/OfflineAccount/Action.js b/lib/oak-app-domain/OfflineAccount/Action.js new file mode 100644 index 00000000..ea05fdb0 --- /dev/null +++ b/lib/oak-app-domain/OfflineAccount/Action.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.actionDefDict = exports.actions = void 0; +exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "pay", "refund", "deposit", "withdraw", "tax"]; +exports.actionDefDict = {}; diff --git a/lib/oak-app-domain/OfflineAccount/Schema.d.ts b/lib/oak-app-domain/OfflineAccount/Schema.d.ts index 17556d9f..75d59edc 100644 --- a/lib/oak-app-domain/OfflineAccount/Schema.d.ts +++ b/lib/oak-app-domain/OfflineAccount/Schema.d.ts @@ -2,10 +2,11 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; -import { GenericAction } from "oak-domain/lib/actions/action"; -import { String, Text, Boolean } from "oak-domain/lib/types/DataType"; +import { Action, ParticularAction } from "./Action"; +import { String, Text, Boolean, Price } from "oak-domain/lib/types/DataType"; import * as System from "../System/Schema"; import * as Pay from "../Pay/Schema"; +import * as SysAccountOper from "../SysAccountOper/Schema"; export type OpSchema = EntityShape & { type: "bank" | "alipay" | "wechat" | "shouqianba" | "others"; channel?: String<32> | null; @@ -14,6 +15,8 @@ export type OpSchema = EntityShape & { allowDeposit: Boolean; allowPay: Boolean; systemId: ForeignKey<"system">; + price: Price; + enabled: Boolean; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { @@ -24,9 +27,13 @@ export type Schema = EntityShape & { allowDeposit: Boolean; allowPay: Boolean; systemId: ForeignKey<"system">; + price: Price; + enabled: Boolean; system: System.Schema; pay$entity?: Array; pay$entity$$aggr?: AggregationResult; + sysAccountOper$entity?: Array; + sysAccountOper$entity$$aggr?: AggregationResult; } & { [A in ExpressionKey]?: any; }; @@ -43,7 +50,10 @@ type AttrFilter = { allowPay: Q_BooleanValue; systemId: Q_StringValue; system: System.Filter; + price: Q_NumberValue; + enabled: Q_BooleanValue; pay$entity: Pay.Filter & SubQueryPredicateMetadata; + sysAccountOper$entity: SysAccountOper.Filter & SubQueryPredicateMetadata; }; export type Filter = MakeFilter>; export type Projection = { @@ -61,12 +71,20 @@ export type Projection = { allowPay?: number; systemId?: number; system?: System.Projection; + price?: number; + enabled?: number; pay$entity?: Pay.Selection & { $entity: "pay"; }; pay$entity$$aggr?: Pay.Aggregation & { $entity: "pay"; }; + sysAccountOper$entity?: SysAccountOper.Selection & { + $entity: "sysAccountOper"; + }; + sysAccountOper$entity$$aggr?: SysAccountOper.Aggregation & { + $entity: "sysAccountOper"; + }; } & Partial>; type OfflineAccountIdProjection = OneOf<{ id: number; @@ -98,6 +116,10 @@ export type SortAttr = { systemId: number; } | { system: System.SortAttr; +} | { + price: number; +} | { + enabled: number; } | { [k: string]: any; } | OneOf>; @@ -120,6 +142,7 @@ export type CreateOperationData = FormCreateData> & ( systemId: ForeignKey<"system">; })) & { pay$entity?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; @@ -139,8 +162,9 @@ export type UpdateOperationData = FormUpdateData> & ( })) & { [k: string]: any; pay$entity?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; export type RemoveOperationData = {} & (({ system?: System.UpdateOperation | System.RemoveOperation; })); @@ -151,7 +175,7 @@ export type OfflineAccountIdSubQuery = Selection; export type EntityDef = { Schema: Schema; OpSchema: OpSchema; - Action: OakMakeAction | string; + Action: OakMakeAction | string; Selection: Selection; Aggregation: Aggregation; Operation: Operation; @@ -160,5 +184,6 @@ export type EntityDef = { Remove: RemoveOperation; CreateSingle: CreateSingleOperation; CreateMulti: CreateMultipleOperation; + ParticularAction: ParticularAction; }; export {}; diff --git a/lib/oak-app-domain/OfflineAccount/Storage.js b/lib/oak-app-domain/OfflineAccount/Storage.js index b85df1ce..700f7131 100644 --- a/lib/oak-app-domain/OfflineAccount/Storage.js +++ b/lib/oak-app-domain/OfflineAccount/Storage.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.desc = void 0; -const action_1 = require("oak-domain/lib/actions/action"); +const Action_1 = require("./Action"); exports.desc = { attributes: { type: { @@ -36,8 +36,16 @@ exports.desc = { notNull: true, type: "ref", ref: "system" + }, + price: { + notNull: true, + type: "money" + }, + enabled: { + notNull: true, + type: "boolean" } }, actionType: "crud", - actions: action_1.genericActions + actions: Action_1.actions }; diff --git a/lib/oak-app-domain/OfflineAccount/Style.js b/lib/oak-app-domain/OfflineAccount/Style.js index 3ed6ba42..e36788e5 100644 --- a/lib/oak-app-domain/OfflineAccount/Style.js +++ b/lib/oak-app-domain/OfflineAccount/Style.js @@ -5,10 +5,17 @@ exports.style = { color: { type: { bank: '#E74C3C', - alipay: '#3498DB', - wechat: '#27AE60', - shouqianba: '#F1C40F', + alipay: '#1678ff', + wechat: '#04BE02', + shouqianba: '#ffc106', others: '#34495E', }, }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', + } }; diff --git a/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json b/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json index 97d66119..0171aec1 100644 --- a/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json +++ b/lib/oak-app-domain/OfflineAccount/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "离线账号管理", "attr": { "type": "类型", "channel": "通道", "name": "用户/帐号", "qrCode": "收款二维码", "allowDeposit": "允许主动充值", "allowPay": "允许主动支付", "system": "所属系统", "pays": "支付" }, "v": { "type": { "bank": "银行", "alipay": "支付宝", "wechat": "微信", "shouqianba": "收钱吧", "others": "其它" } } } +{ "name": "线下账户", "attr": { "type": "类型", "channel": "通道", "name": "用户/帐号", "qrCode": "收款二维码", "allowDeposit": "允许主动充值", "allowPay": "允许主动支付", "system": "所属系统", "price": "余额", "pays": "支付", "opers": "操作记录", "enabled": "是否启用" }, "v": { "type": { "bank": "银行", "alipay": "支付宝", "wechat": "微信", "shouqianba": "收钱吧", "others": "其它" } }, "action": { "pay": "支付", "refund": "退款", "deposit": "充值", "withdraw": "提现", "tax": "渠道费" } } diff --git a/lib/oak-app-domain/Storage.js b/lib/oak-app-domain/Storage.js index 3aafee1f..7029bad4 100644 --- a/lib/oak-app-domain/Storage.js +++ b/lib/oak-app-domain/Storage.js @@ -62,12 +62,13 @@ const Storage_58 = require("./OfflineAccount/Storage"); const Storage_59 = require("./Order/Storage"); const Storage_60 = require("./Pay/Storage"); const Storage_61 = require("./Refund/Storage"); -const Storage_62 = require("./WechatPay/Storage"); -const Storage_63 = require("./Withdraw/Storage"); -const Storage_64 = require("./WithdrawAccount/Storage"); -const Storage_65 = require("./WithdrawChannel/Storage"); -const Storage_66 = require("./WpAccount/Storage"); -const Storage_67 = require("./WpProduct/Storage"); +const Storage_62 = require("./SysAccountOper/Storage"); +const Storage_63 = require("./WechatPay/Storage"); +const Storage_64 = require("./Withdraw/Storage"); +const Storage_65 = require("./WithdrawAccount/Storage"); +const Storage_66 = require("./WithdrawChannel/Storage"); +const Storage_67 = require("./WpAccount/Storage"); +const Storage_68 = require("./WpProduct/Storage"); exports.storageSchema = { actionAuth: Storage_1.desc, i18n: Storage_2.desc, @@ -130,10 +131,11 @@ exports.storageSchema = { order: Storage_59.desc, pay: Storage_60.desc, refund: Storage_61.desc, - wechatPay: Storage_62.desc, - withdraw: Storage_63.desc, - withdrawAccount: Storage_64.desc, - withdrawChannel: Storage_65.desc, - wpAccount: Storage_66.desc, - wpProduct: Storage_67.desc + sysAccountOper: Storage_62.desc, + wechatPay: Storage_63.desc, + withdraw: Storage_64.desc, + withdrawAccount: Storage_65.desc, + withdrawChannel: Storage_66.desc, + wpAccount: Storage_67.desc, + wpProduct: Storage_68.desc }; diff --git a/lib/oak-app-domain/StyleDict.js b/lib/oak-app-domain/StyleDict.js index 58407907..db3ca233 100644 --- a/lib/oak-app-domain/StyleDict.js +++ b/lib/oak-app-domain/StyleDict.js @@ -30,10 +30,11 @@ const Style_26 = require("./OfflineAccount/Style"); const Style_27 = require("./Order/Style"); const Style_28 = require("./Pay/Style"); const Style_29 = require("./Refund/Style"); -const Style_30 = require("./User/Style"); -const Style_31 = require("./Withdraw/Style"); -const Style_32 = require("./WpAccount/Style"); -const Style_33 = require("./WpProduct/Style"); +const Style_30 = require("./SysAccountOper/Style"); +const Style_31 = require("./User/Style"); +const Style_32 = require("./Withdraw/Style"); +const Style_33 = require("./WpAccount/Style"); +const Style_34 = require("./WpProduct/Style"); exports.styleDict = { modi: Style_1.style, application: Style_2.style, @@ -64,8 +65,9 @@ exports.styleDict = { order: Style_27.style, pay: Style_28.style, refund: Style_29.style, - user: Style_30.style, - withdraw: Style_31.style, - wpAccount: Style_32.style, - wpProduct: Style_33.style + sysAccountOper: Style_30.style, + user: Style_31.style, + withdraw: Style_32.style, + wpAccount: Style_33.style, + wpProduct: Style_34.style }; diff --git a/lib/oak-app-domain/SysAccountOper/Schema.d.ts b/lib/oak-app-domain/SysAccountOper/Schema.d.ts new file mode 100644 index 00000000..e25fb97c --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/Schema.d.ts @@ -0,0 +1,167 @@ +import { ForeignKey } from "oak-domain/lib/types/DataType"; +import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand"; +import { OneOf } from "oak-domain/lib/types/Polyfill"; +import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity"; +import { AppendOnlyAction } from "oak-domain/lib/actions/action"; +import { Price, String } from "oak-domain/lib/types/DataType"; +import * as OfflineAccount from "../OfflineAccount/Schema"; +import * as WpAccount from "../WpAccount/Schema"; +export type OpSchema = EntityShape & { + delta: Price; + type: "pay" | "refund" | "deposit" | "withdraw" | "tax"; + entity: "offlineAccount" | "wpAccount" | string; + entityId: String<64>; +}; +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { + delta: Price; + type: "pay" | "refund" | "deposit" | "withdraw" | "tax"; + entity: "offlineAccount" | "wpAccount" | string; + entityId: String<64>; + offlineAccount?: OfflineAccount.Schema; + wpAccount?: WpAccount.Schema; +} & { + [A in ExpressionKey]?: any; +}; +type AttrFilter = { + id: Q_StringValue; + $$createAt$$: Q_DateValue; + $$seq$$: Q_NumberValue; + $$updateAt$$: Q_DateValue; + delta: Q_NumberValue; + type: Q_EnumValue<"pay" | "refund" | "deposit" | "withdraw" | "tax">; + entity: Q_EnumValue<"offlineAccount" | "wpAccount" | string>; + entityId: Q_StringValue; + offlineAccount: OfflineAccount.Filter; + wpAccount: WpAccount.Filter; +}; +export type Filter = MakeFilter>; +export type Projection = { + "#id"?: NodeId; + [k: string]: any; + id?: number; + $$createAt$$?: number; + $$updateAt$$?: number; + $$seq$$?: number; + delta?: number; + type?: number; + entity?: number; + entityId?: number; + offlineAccount?: OfflineAccount.Projection; + wpAccount?: WpAccount.Projection; +} & Partial>; +type SysAccountOperIdProjection = OneOf<{ + id: number; +}>; +type OfflineAccountIdProjection = OneOf<{ + entityId: number; +}>; +type WpAccountIdProjection = OneOf<{ + entityId: number; +}>; +export type SortAttr = { + id: number; +} | { + $$createAt$$: number; +} | { + $$seq$$: number; +} | { + $$updateAt$$: number; +} | { + delta: number; +} | { + type: number; +} | { + entity: number; +} | { + entityId: number; +} | { + offlineAccount: OfflineAccount.SortAttr; +} | { + wpAccount: WpAccount.SortAttr; +} | { + [k: string]: any; +} | OneOf>; +export type SortNode = { + $attr: SortAttr; + $direction?: "asc" | "desc"; +}; +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= SelectOperation

; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ + entity?: never; + entityId?: never; + offlineAccount: OfflineAccount.CreateSingleOperation; +} | { + entity: "offlineAccount"; + entityId: ForeignKey<"OfflineAccount">; + offlineAccount?: OfflineAccount.UpdateOperation; +} | { + entity: "offlineAccount"; + entityId: ForeignKey<"OfflineAccount">; + offlineAccount?: never; +} | { + entity?: never; + entityId?: never; + wpAccount: WpAccount.CreateSingleOperation; +} | { + entity: "wpAccount"; + entityId: ForeignKey<"WpAccount">; + wpAccount?: WpAccount.UpdateOperation; +} | { + entity: "wpAccount"; + entityId: ForeignKey<"WpAccount">; + wpAccount?: never; +} | { + entity?: string; + entityId?: string; + [K: string]: any; +}); +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & ({ + offlineAccount?: OfflineAccount.CreateSingleOperation | OfflineAccount.UpdateOperation | OfflineAccount.RemoveOperation; + entityId?: never; + entity?: never; +} | { + wpAccount?: WpAccount.CreateSingleOperation | WpAccount.UpdateOperation | WpAccount.RemoveOperation; + entityId?: never; + entity?: never; +} | { + entity?: ("offlineAccount" | "wpAccount" | string) | null; + entityId?: ForeignKey<"OfflineAccount" | "WpAccount"> | null; + offlineAccount?: never; + wpAccount?: never; +}) & { + [k: string]: any; +}; +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & ({ + offlineAccount?: OfflineAccount.UpdateOperation | OfflineAccount.RemoveOperation; +} | { + wpAccount?: WpAccount.UpdateOperation | WpAccount.RemoveOperation; +} | { + [k: string]: any; +}); +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type OfflineAccountIdSubQuery = Selection; +export type WpAccountIdSubQuery = Selection; +export type SysAccountOperIdSubQuery = Selection; +export type EntityDef = { + Schema: Schema; + OpSchema: OpSchema; + Action: OakMakeAction | string; + Selection: Selection; + Aggregation: Aggregation; + Operation: Operation; + Create: CreateOperation; + Update: UpdateOperation; + Remove: RemoveOperation; + CreateSingle: CreateSingleOperation; + CreateMulti: CreateMultipleOperation; +}; +export {}; diff --git a/lib/oak-app-domain/SysAccountOper/Schema.js b/lib/oak-app-domain/SysAccountOper/Schema.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/Schema.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/oak-app-domain/SysAccountOper/Storage.d.ts b/lib/oak-app-domain/SysAccountOper/Storage.d.ts new file mode 100644 index 00000000..a3f0fbbb --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/Storage.d.ts @@ -0,0 +1,3 @@ +import { StorageDesc } from "oak-domain/lib/types/Storage"; +import { OpSchema } from "./Schema"; +export declare const desc: StorageDesc; diff --git a/lib/oak-app-domain/SysAccountOper/Storage.js b/lib/oak-app-domain/SysAccountOper/Storage.js new file mode 100644 index 00000000..e637318c --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/Storage.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.desc = void 0; +const action_1 = require("oak-domain/lib/actions/action"); +exports.desc = { + attributes: { + delta: { + notNull: true, + type: "money" + }, + type: { + notNull: true, + type: "enum", + enumeration: ["pay", "refund", "deposit", "withdraw", "tax"] + }, + entity: { + notNull: true, + type: "varchar", + params: { + length: 32 + }, + ref: ["offlineAccount", "wpAccount"] + }, + entityId: { + notNull: true, + type: "varchar", + params: { + length: 64 + } + } + }, + actionType: "appendOnly", + actions: action_1.appendOnlyActions +}; diff --git a/lib/oak-app-domain/SysAccountOper/Style.d.ts b/lib/oak-app-domain/SysAccountOper/Style.d.ts new file mode 100644 index 00000000..a0bf8206 --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/Style.d.ts @@ -0,0 +1,3 @@ +import { EntityDef } from "./Schema"; +import { StyleDef } from "oak-domain/lib/types/Style"; +export declare const style: StyleDef; diff --git a/lib/oak-app-domain/SysAccountOper/Style.js b/lib/oak-app-domain/SysAccountOper/Style.js new file mode 100644 index 00000000..35c14dfe --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/Style.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.style = void 0; +exports.style = { + color: { + type: { + deposit: '#3498DB', + withdraw: '#F7DC6F', + pay: '#82E0AA', + tax: '#2E4053', + refund: '#2E4053', + } + } +}; diff --git a/lib/oak-app-domain/SysAccountOper/locales/zh_CN.json b/lib/oak-app-domain/SysAccountOper/locales/zh_CN.json new file mode 100644 index 00000000..ca749e03 --- /dev/null +++ b/lib/oak-app-domain/SysAccountOper/locales/zh_CN.json @@ -0,0 +1 @@ +{ "name": "系统账户操作", "attr": { "type": "类型", "delta": "余额变化", "entity": "关联对象", "entityId": "关联对象Id" }, "v": { "type": { "deposit": "充值", "withdraw": "提现", "pay": "支付", "refund": "退款", "tax": "渠道手续费" } } } diff --git a/lib/oak-app-domain/System/Schema.d.ts b/lib/oak-app-domain/System/Schema.d.ts index 0123a52b..d4d1be2a 100644 --- a/lib/oak-app-domain/System/Schema.d.ts +++ b/lib/oak-app-domain/System/Schema.d.ts @@ -14,6 +14,7 @@ import * as SmsTemplate from "../SmsTemplate/Schema"; import * as UserSystem from "../UserSystem/Schema"; import * as Account from "../Account/Schema"; import * as OfflineAccount from "../OfflineAccount/Schema"; +import * as WechatPay from "../WechatPay/Schema"; import * as WithdrawChannel from "../WithdrawChannel/Schema"; import * as WpAccount from "../WpAccount/Schema"; export type OpSchema = EntityShape & { @@ -53,6 +54,8 @@ export type Schema = EntityShape & { account$system$$aggr?: AggregationResult; offlineAccount$system?: Array; offlineAccount$system$$aggr?: AggregationResult; + wechatPay$system?: Array; + wechatPay$system$$aggr?: AggregationResult; withdrawChannel$system?: Array; withdrawChannel$system$$aggr?: AggregationResult; wpAccount$system?: Array; @@ -82,6 +85,7 @@ type AttrFilter = { userSystem$system: UserSystem.Filter & SubQueryPredicateMetadata; account$system: Account.Filter & SubQueryPredicateMetadata; offlineAccount$system: OfflineAccount.Filter & SubQueryPredicateMetadata; + wechatPay$system: WechatPay.Filter & SubQueryPredicateMetadata; withdrawChannel$system: WithdrawChannel.Filter & SubQueryPredicateMetadata; wpAccount$system: WpAccount.Filter & SubQueryPredicateMetadata; }; @@ -145,6 +149,12 @@ export type Projection = { offlineAccount$system$$aggr?: OfflineAccount.Aggregation & { $entity: "offlineAccount"; }; + wechatPay$system?: WechatPay.Selection & { + $entity: "wechatPay"; + }; + wechatPay$system$$aggr?: WechatPay.Aggregation & { + $entity: "wechatPay"; + }; withdrawChannel$system?: WithdrawChannel.Selection & { $entity: "withdrawChannel"; }; @@ -224,6 +234,7 @@ export type CreateOperationData = FormCreateData, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; account$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; offlineAccount$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; + wechatPay$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; withdrawChannel$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; wpAccount$system?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; }; @@ -251,6 +262,7 @@ export type UpdateOperationData = FormUpdateData> & userSystem$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; account$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; offlineAccount$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; + wechatPay$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; withdrawChannel$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; wpAccount$system?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; }; diff --git a/lib/oak-app-domain/WechatPay/Schema.d.ts b/lib/oak-app-domain/WechatPay/Schema.d.ts index 23f88053..b5fe2c74 100644 --- a/lib/oak-app-domain/WechatPay/Schema.d.ts +++ b/lib/oak-app-domain/WechatPay/Schema.d.ts @@ -1,21 +1,24 @@ +import { ForeignKey } from "oak-domain/lib/types/DataType"; import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; import { GenericAction } from "oak-domain/lib/actions/action"; -import { String, Decimal } from "oak-domain/lib/types/DataType"; +import { String } from "oak-domain/lib/types/DataType"; +import * as System from "../System/Schema"; import * as WpAccount from "../WpAccount/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; export type OpSchema = EntityShape & { payNotifyUrl: String<128>; refundNotifyUrl: String<128>; - lossRatio: Decimal<4, 2>; + systemId: ForeignKey<"system">; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { payNotifyUrl: String<128>; refundNotifyUrl: String<128>; - lossRatio: Decimal<4, 2>; + systemId: ForeignKey<"system">; + system: System.Schema; wpAccount$wechatPay?: Array; wpAccount$wechatPay$$aggr?: AggregationResult; modiEntity$entity?: Array; @@ -32,7 +35,8 @@ type AttrFilter = { $$updateAt$$: Q_DateValue; payNotifyUrl: Q_StringValue; refundNotifyUrl: Q_StringValue; - lossRatio: Q_NumberValue; + systemId: Q_StringValue; + system: System.Filter; wpAccount$wechatPay: WpAccount.Filter & SubQueryPredicateMetadata; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata; @@ -47,7 +51,8 @@ export type Projection = { $$seq$$?: number; payNotifyUrl?: number; refundNotifyUrl?: number; - lossRatio?: number; + systemId?: number; + system?: System.Projection; wpAccount$wechatPay?: WpAccount.Selection & { $entity: "wpAccount"; }; @@ -70,6 +75,9 @@ export type Projection = { type WechatPayIdProjection = OneOf<{ id: number; }>; +type SystemIdProjection = OneOf<{ + systemId: number; +}>; export type SortAttr = { id: number; } | { @@ -83,7 +91,9 @@ export type SortAttr = { } | { refundNotifyUrl: number; } | { - lossRatio: number; + systemId: number; +} | { + system: System.SortAttr; } | { [k: string]: any; } | OneOf>; @@ -95,7 +105,16 @@ export type Sorter = SortNode[]; export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; export type Selection

= SelectOperation

; export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData & { +export type CreateOperationData = FormCreateData> & (({ + systemId?: never; + system: System.CreateSingleOperation; +} | { + systemId: ForeignKey<"system">; + system?: System.UpdateOperation; +} | { + system?: never; + systemId: ForeignKey<"system">; +})) & { wpAccount$wechatPay?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; @@ -103,16 +122,31 @@ export type CreateOperationData = FormCreateData & { export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export type UpdateOperationData = FormUpdateData> & (({ + system?: System.CreateSingleOperation; + systemId?: never; +} | { + system?: System.UpdateOperation; + systemId?: never; +} | { + system?: System.RemoveOperation; + systemId?: never; +} | { + system?: never; + systemId?: ForeignKey<"system">; +})) & { [k: string]: any; wpAccount$wechatPay?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; +export type RemoveOperationData = {} & (({ + system?: System.UpdateOperation | System.RemoveOperation; +})); export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type SystemIdSubQuery = Selection; export type WechatPayIdSubQuery = Selection; export type EntityDef = { Schema: Schema; diff --git a/lib/oak-app-domain/WechatPay/Storage.js b/lib/oak-app-domain/WechatPay/Storage.js index 0a2dba84..312aca46 100644 --- a/lib/oak-app-domain/WechatPay/Storage.js +++ b/lib/oak-app-domain/WechatPay/Storage.js @@ -18,13 +18,10 @@ exports.desc = { length: 128 } }, - lossRatio: { + systemId: { notNull: true, - type: "decimal", - params: { - precision: 4, - scale: 2 - } + type: "ref", + ref: "system" } }, actionType: "crud", diff --git a/lib/oak-app-domain/WechatPay/locales/zh_CN.json b/lib/oak-app-domain/WechatPay/locales/zh_CN.json index 099fde3c..bea0f6cf 100644 --- a/lib/oak-app-domain/WechatPay/locales/zh_CN.json +++ b/lib/oak-app-domain/WechatPay/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "微信支付", "attr": { "payNotifyUrl": "支付通知回调", "refundNotifyUrl": "退款通知回调", "lossRatio": "支付损耗比例" } } +{ "name": "微信支付", "attr": { "payNotifyUrl": "支付通知回调", "refundNotifyUrl": "退款通知回调", "system": "关联系统" } } diff --git a/lib/oak-app-domain/WpAccount/Action.d.ts b/lib/oak-app-domain/WpAccount/Action.d.ts new file mode 100644 index 00000000..bbec0c80 --- /dev/null +++ b/lib/oak-app-domain/WpAccount/Action.d.ts @@ -0,0 +1,5 @@ +import { GenericAction } from "oak-domain/lib/actions/action"; +export type ParticularAction = 'pay' | 'refund' | 'deposit' | 'withdraw' | 'tax'; +export declare const actions: string[]; +export type Action = GenericAction | ParticularAction | string; +export declare const actionDefDict: {}; diff --git a/lib/oak-app-domain/WpAccount/Action.js b/lib/oak-app-domain/WpAccount/Action.js new file mode 100644 index 00000000..ea05fdb0 --- /dev/null +++ b/lib/oak-app-domain/WpAccount/Action.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.actionDefDict = exports.actions = void 0; +exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "pay", "refund", "deposit", "withdraw", "tax"]; +exports.actionDefDict = {}; diff --git a/lib/oak-app-domain/WpAccount/Schema.d.ts b/lib/oak-app-domain/WpAccount/Schema.d.ts index e9b46788..022503af 100644 --- a/lib/oak-app-domain/WpAccount/Schema.d.ts +++ b/lib/oak-app-domain/WpAccount/Schema.d.ts @@ -1,16 +1,18 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; -import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; +import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; -import { GenericAction } from "oak-domain/lib/actions/action"; -import { Decimal, Int, String, Text, Price } from "oak-domain/lib/types/DataType"; +import { Action, ParticularAction } from "./Action"; +import { Decimal, Int, String, Text, Price, Boolean } from "oak-domain/lib/types/DataType"; import * as WechatPay from "../WechatPay/Schema"; import * as System from "../System/Schema"; import * as WpProduct from "../WpProduct/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; +import * as SysAccountOper from "../SysAccountOper/Schema"; export type OpSchema = EntityShape & { wechatPayId: ForeignKey<"wechatPay">; + taxlossRatio: Decimal<4, 2>; depositLossRatio?: Decimal<4, 2> | null; refundGapDays?: Int<4> | null; refundLossRatio?: Decimal<4, 2> | null; @@ -21,10 +23,12 @@ export type OpSchema = EntityShape & { apiV3Key: String<32>; price: Price; systemId: ForeignKey<"system">; + enabled: Boolean; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { wechatPayId: ForeignKey<"wechatPay">; + taxlossRatio: Decimal<4, 2>; depositLossRatio?: Decimal<4, 2> | null; refundGapDays?: Int<4> | null; refundLossRatio?: Decimal<4, 2> | null; @@ -35,6 +39,7 @@ export type Schema = EntityShape & { apiV3Key: String<32>; price: Price; systemId: ForeignKey<"system">; + enabled: Boolean; wechatPay: WechatPay.Schema; system: System.Schema; wpProduct$wpAccount?: Array; @@ -43,6 +48,8 @@ export type Schema = EntityShape & { modiEntity$entity$$aggr?: AggregationResult; operEntity$entity?: Array; operEntity$entity$$aggr?: AggregationResult; + sysAccountOper$entity?: Array; + sysAccountOper$entity$$aggr?: AggregationResult; } & { [A in ExpressionKey]?: any; }; @@ -53,6 +60,7 @@ type AttrFilter = { $$updateAt$$: Q_DateValue; wechatPayId: Q_StringValue; wechatPay: WechatPay.Filter; + taxlossRatio: Q_NumberValue; depositLossRatio: Q_NumberValue; refundGapDays: Q_NumberValue; refundLossRatio: Q_NumberValue; @@ -64,9 +72,11 @@ type AttrFilter = { price: Q_NumberValue; systemId: Q_StringValue; system: System.Filter; + enabled: Q_BooleanValue; wpProduct$wpAccount: WpProduct.Filter & SubQueryPredicateMetadata; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata; + sysAccountOper$entity: SysAccountOper.Filter & SubQueryPredicateMetadata; }; export type Filter = MakeFilter>; export type Projection = { @@ -78,6 +88,7 @@ export type Projection = { $$seq$$?: number; wechatPayId?: number; wechatPay?: WechatPay.Projection; + taxlossRatio?: number; depositLossRatio?: number; refundGapDays?: number; refundLossRatio?: number; @@ -89,6 +100,7 @@ export type Projection = { price?: number; systemId?: number; system?: System.Projection; + enabled?: number; wpProduct$wpAccount?: WpProduct.Selection & { $entity: "wpProduct"; }; @@ -107,6 +119,12 @@ export type Projection = { operEntity$entity$$aggr?: OperEntity.Aggregation & { $entity: "operEntity"; }; + sysAccountOper$entity?: SysAccountOper.Selection & { + $entity: "sysAccountOper"; + }; + sysAccountOper$entity$$aggr?: SysAccountOper.Aggregation & { + $entity: "sysAccountOper"; + }; } & Partial>; type WpAccountIdProjection = OneOf<{ id: number; @@ -129,6 +147,8 @@ export type SortAttr = { wechatPayId: number; } | { wechatPay: WechatPay.SortAttr; +} | { + taxlossRatio: number; } | { depositLossRatio: number; } | { @@ -151,6 +171,8 @@ export type SortAttr = { systemId: number; } | { system: System.SortAttr; +} | { + enabled: number; } | { [k: string]: any; } | OneOf>; @@ -184,6 +206,7 @@ export type CreateOperationData = FormCreateData, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; @@ -217,8 +240,9 @@ export type UpdateOperationData = FormUpdateData, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; + sysAccountOper$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; export type RemoveOperationData = {} & (({ wechatPay?: WechatPay.UpdateOperation | WechatPay.RemoveOperation; }) & ({ @@ -232,7 +256,7 @@ export type WpAccountIdSubQuery = Selection; export type EntityDef = { Schema: Schema; OpSchema: OpSchema; - Action: OakMakeAction | string; + Action: OakMakeAction | string; Selection: Selection; Aggregation: Aggregation; Operation: Operation; @@ -241,5 +265,6 @@ export type EntityDef = { Remove: RemoveOperation; CreateSingle: CreateSingleOperation; CreateMulti: CreateMultipleOperation; + ParticularAction: ParticularAction; }; export {}; diff --git a/lib/oak-app-domain/WpAccount/Storage.js b/lib/oak-app-domain/WpAccount/Storage.js index cdcc2610..ad67adef 100644 --- a/lib/oak-app-domain/WpAccount/Storage.js +++ b/lib/oak-app-domain/WpAccount/Storage.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.desc = void 0; -const action_1 = require("oak-domain/lib/actions/action"); +const Action_1 = require("./Action"); exports.desc = { attributes: { wechatPayId: { @@ -9,6 +9,14 @@ exports.desc = { type: "ref", ref: "wechatPay" }, + taxlossRatio: { + notNull: true, + type: "decimal", + params: { + precision: 4, + scale: 2 + } + }, depositLossRatio: { type: "decimal", params: { @@ -64,8 +72,12 @@ exports.desc = { notNull: true, type: "ref", ref: "system" + }, + enabled: { + notNull: true, + type: "boolean" } }, actionType: "crud", - actions: action_1.genericActions + actions: Action_1.actions }; diff --git a/lib/oak-app-domain/WpAccount/Style.js b/lib/oak-app-domain/WpAccount/Style.js index a8ccc160..901a2d27 100644 --- a/lib/oak-app-domain/WpAccount/Style.js +++ b/lib/oak-app-domain/WpAccount/Style.js @@ -7,5 +7,12 @@ exports.style = { yuan: '#FFFF00', jiao: '#00FF00' } + }, + icon: { + pay: '', + refund: '', + deposit: '', + withdraw: '', + tax: '', } }; diff --git a/lib/oak-app-domain/WpAccount/locales/zh_CN.json b/lib/oak-app-domain/WpAccount/locales/zh_CN.json index d53c5338..f00e54cc 100644 --- a/lib/oak-app-domain/WpAccount/locales/zh_CN.json +++ b/lib/oak-app-domain/WpAccount/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "微信支付帐号", "attr": { "wechatPay": "微信支付", "depositLossRatio": "充值损耗百分比", "refundGapDays": "(支付后)允许退款的天数", "refundLossRatio": "退款损耗百分比", "refundLossFloor": "退款向下取整位数", "mchId": "商户号", "publicKeyFilePath": "公钥文件路径", "privateKeyFilePath": "私钥文件路径", "apiV3Key": "apiV3Key", "price": "余额", "system": "关联系统" }, "v": { "refundLossFloor": { "yuan": "元", "jiao": "角" } } } +{ "name": "微信支付帐号", "attr": { "wechatPay": "微信支付", "taxlossRatio": "商户号手续费(百分比)", "depositLossRatio": "充值损耗百分比", "refundGapDays": "(支付后)允许退款的天数", "refundLossRatio": "退款损耗百分比", "refundLossFloor": "退款向下取整位数", "mchId": "商户号", "publicKeyFilePath": "公钥文件路径", "privateKeyFilePath": "私钥文件路径", "apiV3Key": "apiV3Key", "price": "余额", "system": "关联系统", "opers": "操作记录", "enabled": "是否启用" }, "v": { "refundLossFloor": { "yuan": "元", "jiao": "角" } }, "action": { "pay": "支付", "refund": "退款", "deposit": "充值", "withdraw": "提现", "tax": "渠道费" } } diff --git a/lib/oak-app-domain/WpProduct/Schema.d.ts b/lib/oak-app-domain/WpProduct/Schema.d.ts index 3b1331b8..549f79f0 100644 --- a/lib/oak-app-domain/WpProduct/Schema.d.ts +++ b/lib/oak-app-domain/WpProduct/Schema.d.ts @@ -1,8 +1,9 @@ import { ForeignKey } from "oak-domain/lib/types/DataType"; -import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; +import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand"; import { OneOf } from "oak-domain/lib/types/Polyfill"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity"; import { GenericAction } from "oak-domain/lib/actions/action"; +import { Boolean } from "oak-domain/lib/types/DataType"; import * as WpAccount from "../WpAccount/Schema"; import * as Application from "../Application/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; @@ -12,12 +13,14 @@ export type OpSchema = EntityShape & { wpAccountId: ForeignKey<"wpAccount">; type: "native" | "mp" | "jsapi" | "h5" | "app"; applicationId: ForeignKey<"application">; + enabled: Boolean; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { wpAccountId: ForeignKey<"wpAccount">; type: "native" | "mp" | "jsapi" | "h5" | "app"; applicationId: ForeignKey<"application">; + enabled: Boolean; wpAccount: WpAccount.Schema; application: Application.Schema; modiEntity$entity?: Array; @@ -39,6 +42,7 @@ type AttrFilter = { type: Q_EnumValue<"native" | "mp" | "jsapi" | "h5" | "app">; applicationId: Q_StringValue; application: Application.Filter; + enabled: Q_BooleanValue; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata; pay$entity: Pay.Filter & SubQueryPredicateMetadata; @@ -56,6 +60,7 @@ export type Projection = { type?: number; applicationId?: number; application?: Application.Projection; + enabled?: number; modiEntity$entity?: ModiEntity.Selection & { $entity: "modiEntity"; }; @@ -102,6 +107,8 @@ export type SortAttr = { applicationId: number; } | { application: Application.SortAttr; +} | { + enabled: number; } | { [k: string]: any; } | OneOf>; diff --git a/lib/oak-app-domain/WpProduct/Storage.js b/lib/oak-app-domain/WpProduct/Storage.js index 8e237fa2..99b272bf 100644 --- a/lib/oak-app-domain/WpProduct/Storage.js +++ b/lib/oak-app-domain/WpProduct/Storage.js @@ -18,6 +18,10 @@ exports.desc = { notNull: true, type: "ref", ref: "application" + }, + enabled: { + notNull: true, + type: "boolean" } }, actionType: "crud", diff --git a/lib/oak-app-domain/WpProduct/locales/zh_CN.json b/lib/oak-app-domain/WpProduct/locales/zh_CN.json index 9b16a440..9d9b0687 100644 --- a/lib/oak-app-domain/WpProduct/locales/zh_CN.json +++ b/lib/oak-app-domain/WpProduct/locales/zh_CN.json @@ -1 +1 @@ -{ "name": "微信支付产品", "attr": { "wpAccount": "微信支付帐号", "type": "类型", "application": "关联应用", "pays": "支付" }, "v": { "type": { "native": "native(二维码)", "mp": "小程序", "jsapi": "jsApi", "h5": "h5(唤起微信)", "app": "App" } } } +{ "name": "微信支付产品", "attr": { "wpAccount": "微信支付帐号", "type": "类型", "application": "关联应用", "enabled": "有效中", "pays": "支付" }, "v": { "type": { "native": "native(二维码)", "mp": "小程序", "jsapi": "jsApi", "h5": "h5(唤起微信)", "app": "App" } } } diff --git a/lib/oak-app-domain/_SubQuery.d.ts b/lib/oak-app-domain/_SubQuery.d.ts index b9437344..f7d183d1 100644 --- a/lib/oak-app-domain/_SubQuery.d.ts +++ b/lib/oak-app-domain/_SubQuery.d.ts @@ -59,6 +59,7 @@ import * as OfflineAccount from "./OfflineAccount/Schema"; import * as Order from "./Order/Schema"; import * as Pay from "./Pay/Schema"; import * as Refund from "./Refund/Schema"; +import * as SysAccountOper from "./SysAccountOper/Schema"; import * as WechatPay from "./WechatPay/Schema"; import * as Withdraw from "./Withdraw/Schema"; import * as WithdrawAccount from "./WithdrawAccount/Schema"; @@ -441,6 +442,8 @@ export type SystemIdSubQuery = { entity: "account"; }) | (OfflineAccount.SystemIdSubQuery & { entity: "offlineAccount"; + }) | (WechatPay.SystemIdSubQuery & { + entity: "wechatPay"; }) | (WithdrawChannel.SystemIdSubQuery & { entity: "withdrawChannel"; }) | (WpAccount.SystemIdSubQuery & { @@ -557,6 +560,8 @@ export type DepositIdSubQuery = { export type OfflineAccountIdSubQuery = { [K in "$in" | "$nin"]?: (Pay.OfflineAccountIdSubQuery & { entity: "pay"; + }) | (SysAccountOper.OfflineAccountIdSubQuery & { + entity: "sysAccountOper"; }) | (OfflineAccount.OfflineAccountIdSubQuery & { entity: "offlineAccount"; }) | any; @@ -582,6 +587,11 @@ export type RefundIdSubQuery = { entity: "refund"; }) | any; }; +export type SysAccountOperIdSubQuery = { + [K in "$in" | "$nin"]?: (SysAccountOper.SysAccountOperIdSubQuery & { + entity: "sysAccountOper"; + }) | any; +}; export type WechatPayIdSubQuery = { [K in "$in" | "$nin"]?: (WpAccount.WechatPayIdSubQuery & { entity: "wpAccount"; @@ -635,6 +645,8 @@ export type WpAccountIdSubQuery = { entity: "modiEntity"; }) | (OperEntity.WpAccountIdSubQuery & { entity: "operEntity"; + }) | (SysAccountOper.WpAccountIdSubQuery & { + entity: "sysAccountOper"; }) | (WpAccount.WpAccountIdSubQuery & { entity: "wpAccount"; }) | any; diff --git a/lib/ports/index.d.ts b/lib/ports/index.d.ts index 4d46e336..f247bbaa 100644 --- a/lib/ports/index.d.ts +++ b/lib/ports/index.d.ts @@ -1,5 +1,5 @@ import { Importation, Exportation } from "oak-domain/lib/types/Port"; import { EntityDict } from "@oak-app-domain"; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; export declare const importations: Importation[]; export declare const exportations: Exportation[]; diff --git a/lib/ports/index.js b/lib/ports/index.js new file mode 100644 index 00000000..c322cac4 --- /dev/null +++ b/lib/ports/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.exportations = exports.importations = void 0; +exports.importations = []; +exports.exportations = []; diff --git a/lib/routines/start.d.ts b/lib/routines/start.d.ts index b0c596bf..3ff8ada3 100644 --- a/lib/routines/start.d.ts +++ b/lib/routines/start.d.ts @@ -1,5 +1,5 @@ import { Routine } from 'oak-domain/lib/types/Timer'; import { EntityDict } from '@oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const startRoutines: Array>; export default startRoutines; diff --git a/lib/routines/start.js b/lib/routines/start.js new file mode 100644 index 00000000..5a4245d7 --- /dev/null +++ b/lib/routines/start.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const startRoutines = [ + { + name: '示例性routine', + entity: 'extraFile', + filter: { + uploadState: 'uploading', + }, + projection: { + id: 1, + uploadMeta: 1, + uploadState: 1, + entity: 1, + entityId: 1, + objectId: 1, + }, + fn: async (context, data) => { + console.log('示例性routine执行,请在src/routine/start.ts中关闭'); + return context.opResult; + }, + }, +]; +exports.default = startRoutines; diff --git a/lib/timers/index.d.ts b/lib/timers/index.d.ts index 0cc4714a..6928fd97 100644 --- a/lib/timers/index.d.ts +++ b/lib/timers/index.d.ts @@ -1,5 +1,5 @@ import { Timer } from 'oak-domain/lib/types/Timer'; import { EntityDict } from '@oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const timers: Array>; export default timers; diff --git a/lib/timers/index.js b/lib/timers/index.js new file mode 100644 index 00000000..4ec0a758 --- /dev/null +++ b/lib/timers/index.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const timers = [ + { + name: '示例timer', + cron: '30 * * * * *', + entity: 'extraFile', + filter: { + uploadState: 'uploading', + }, + projection: { + id: 1, + uploadMeta: 1, + uploadState: 1, + entity: 1, + entityId: 1, + objectId: 1, + }, + fn: async (context, data) => { + console.log('这是示例timer程序,每30秒执行一次,请在src/timer/index中关闭'); + return context.opResult; + }, + }, +]; +exports.default = timers; diff --git a/lib/triggers/account.d.ts b/lib/triggers/account.d.ts index 045c2818..cf64eb08 100644 --- a/lib/triggers/account.d.ts +++ b/lib/triggers/account.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; import { EntityDict } from '../oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/account.js b/lib/triggers/account.js index 2a22af86..c2295d3a 100644 --- a/lib/triggers/account.js +++ b/lib/triggers/account.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const uuid_1 = require("oak-domain/lib/utils/uuid"); -const constants_1 = require("@project/config/constants"); +const constants_1 = require("../config/constants"); const assert_1 = tslib_1.__importDefault(require("assert")); const triggers = [ { diff --git a/lib/triggers/accountOper.d.ts b/lib/triggers/accountOper.d.ts index a32b38d9..8277c576 100644 --- a/lib/triggers/accountOper.d.ts +++ b/lib/triggers/accountOper.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; import { EntityDict } from '../oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/accountOper.js b/lib/triggers/accountOper.js index aab4cc9a..f73cefa4 100644 --- a/lib/triggers/accountOper.js +++ b/lib/triggers/accountOper.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const uuid_1 = require("oak-domain/lib/utils/uuid"); const assert_1 = tslib_1.__importDefault(require("assert")); -const constants_1 = require("@project/config/constants"); +const constants_1 = require("../config/constants"); const triggers = [ { name: '当生成accountOper时,修改account中的值,并向订阅者推送', diff --git a/lib/triggers/index.d.ts b/lib/triggers/index.d.ts index f6964b48..aefa8c44 100644 --- a/lib/triggers/index.d.ts +++ b/lib/triggers/index.d.ts @@ -1,5 +1,5 @@ import { EntityDict } from '@oak-app-domain'; import { Trigger } from 'oak-domain/lib/types'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/index.js b/lib/triggers/index.js new file mode 100644 index 00000000..fb9ca2db --- /dev/null +++ b/lib/triggers/index.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const accountOper_1 = tslib_1.__importDefault(require("./accountOper")); +const pay_1 = tslib_1.__importDefault(require("./pay")); +const userSystem_1 = tslib_1.__importDefault(require("./userSystem")); +const account_1 = tslib_1.__importDefault(require("./account")); +const refund_1 = tslib_1.__importDefault(require("./refund")); +const withdraw_1 = tslib_1.__importDefault(require("./withdraw")); +const triggers = [ + ...accountOper_1.default, + ...pay_1.default, + ...userSystem_1.default, + ...account_1.default, + ...refund_1.default, + ...withdraw_1.default, +]; +exports.default = triggers; diff --git a/lib/triggers/order.js b/lib/triggers/order.js new file mode 100644 index 00000000..7d56125c --- /dev/null +++ b/lib/triggers/order.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const triggers = []; diff --git a/lib/triggers/pay.d.ts b/lib/triggers/pay.d.ts index 7e42fd63..94edb903 100644 --- a/lib/triggers/pay.d.ts +++ b/lib/triggers/pay.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/pay.js b/lib/triggers/pay.js index 2246b8b5..64969930 100644 --- a/lib/triggers/pay.js +++ b/lib/triggers/pay.js @@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const uuid_1 = require("oak-domain/lib/utils/uuid"); const assert_1 = tslib_1.__importDefault(require("assert")); -const payClazz_1 = require("@project/utils/payClazz"); -const pay_1 = require("@project/utils/pay"); -const constants_1 = require("@project/config/constants"); +const payClazz_1 = require("../utils/payClazz"); +const pay_1 = require("../utils/pay"); +const constants_1 = require("../config/constants"); async function changeOrderStateByPay(filter, context, option) { const orders = await context.select('order', { data: { @@ -289,7 +289,6 @@ const triggers = [ data: { id: 1, orderId: 1, - accountId: 1, price: 1, refunded: 1, deposit: { diff --git a/lib/triggers/refund.d.ts b/lib/triggers/refund.d.ts index 7501de5f..0797e533 100644 --- a/lib/triggers/refund.d.ts +++ b/lib/triggers/refund.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/refund.js b/lib/triggers/refund.js index 85a9af03..23c83ce7 100644 --- a/lib/triggers/refund.js +++ b/lib/triggers/refund.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const uuid_1 = require("oak-domain/lib/utils/uuid"); -const payClazz_1 = require("@project/utils/payClazz"); +const payClazz_1 = require("../utils/payClazz"); const assert_1 = tslib_1.__importDefault(require("assert")); /** * 当refund完成或失败时,如果关联有提现,去更新提现的状态 diff --git a/lib/triggers/userSystem.d.ts b/lib/triggers/userSystem.d.ts index 12394361..2bc7dd45 100644 --- a/lib/triggers/userSystem.d.ts +++ b/lib/triggers/userSystem.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/userSystem.js b/lib/triggers/userSystem.js new file mode 100644 index 00000000..70d7d5a0 --- /dev/null +++ b/lib/triggers/userSystem.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const uuid_1 = require("oak-domain/lib/utils/uuid"); +const triggers = [ + { + name: '当生成userSystem时,生成在这个system下的帐号', + entity: 'userSystem', + action: 'create', + when: 'before', + fn: async ({ operation }, context, option) => { + const { data } = operation; + const { userId, systemId } = data; + await context.operate('account', { + id: await (0, uuid_1.generateNewIdAsync)(), + action: 'create', + data: { + id: await (0, uuid_1.generateNewIdAsync)(), + entity: 'user', + entityId: userId, + systemId, + total: 0, + avail: 0, + refundable: 0, + }, + }, {}); + return 1; + }, + }, +]; +exports.default = triggers; diff --git a/lib/triggers/withdraw.d.ts b/lib/triggers/withdraw.d.ts index 4b08ee1a..491cd75f 100644 --- a/lib/triggers/withdraw.d.ts +++ b/lib/triggers/withdraw.d.ts @@ -1,5 +1,5 @@ import { Trigger } from 'oak-domain/lib/types/Trigger'; import { EntityDict } from '../oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const triggers: Trigger[]; export default triggers; diff --git a/lib/triggers/withdraw.js b/lib/triggers/withdraw.js index 3a80ea86..36eb4016 100644 --- a/lib/triggers/withdraw.js +++ b/lib/triggers/withdraw.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const uuid_1 = require("oak-domain/lib/utils/uuid"); const assert_1 = tslib_1.__importDefault(require("assert")); -const pay_1 = require("@project/utils/pay"); +const pay_1 = require("../utils/pay"); const triggers = [ { name: '当withdraw创建时,如果是走退款渠道,则创建出相应的refunds,同时更改account中的数值', diff --git a/lib/types/DependentExceptions.d.ts b/lib/types/DependentExceptions.d.ts index 467b9899..af0a8772 100644 --- a/lib/types/DependentExceptions.d.ts +++ b/lib/types/DependentExceptions.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { OpRecord } from 'oak-domain/lib/types/Entity'; export default function makeException(data: { name: string; diff --git a/lib/types/DependentExceptions.js b/lib/types/DependentExceptions.js new file mode 100644 index 00000000..1acc7784 --- /dev/null +++ b/lib/types/DependentExceptions.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const Exception_1 = require("oak-domain/lib/types/Exception"); +const oak_general_business_1 = require("oak-general-business"); +function makeException(data) { + const e = (0, Exception_1.makeException)(data) || (0, oak_general_business_1.makeException)(data); + return e; +} +exports.default = makeException; diff --git a/lib/types/Exception.js b/lib/types/Exception.js new file mode 100644 index 00000000..8dd28001 --- /dev/null +++ b/lib/types/Exception.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeException = exports.RefundExceedMax = exports.ExternalPrePayException = void 0; +const tslib_1 = require("tslib"); +const types_1 = require("oak-domain/lib/types"); +const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions")); +class ExternalPrePayException extends types_1.OakException { + reason; + constructor(reason, message) { + super(message || '调用外部支付预下单接口失败'); + this.reason = reason; + } + getSerialData() { + const data = super.getSerialData(); + return { + ...data, + reason: this.reason, + }; + } +} +exports.ExternalPrePayException = ExternalPrePayException; +class RefundExceedMax extends types_1.OakException { + constructor(message) { + super(message || '可退款的总额不足'); + } +} +exports.RefundExceedMax = RefundExceedMax; +function makeException(msg) { + const data = typeof msg === 'string' ? JSON.parse(msg) : msg; + let exception = (0, DependentExceptions_1.default)(data); + if (exception) { + return exception; + } + const { name, message } = data; + switch (name) { + case 'ExternalPrePayException': { + exception = new ExternalPrePayException(data.reason, message); + break; + } + case 'RefundExceedMax': { + exception = new RefundExceedMax(message); + break; + } + default: { + break; + } + } + if (exception) { + exception.setOpRecords(data.opRecords); + } + return exception; +} +exports.makeException = makeException; diff --git a/lib/types/PayClazz.d.ts b/lib/types/PayClazz.d.ts index 21e23c2d..260905a8 100644 --- a/lib/types/PayClazz.d.ts +++ b/lib/types/PayClazz.d.ts @@ -1,5 +1,5 @@ -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; type IState = EntityDict['pay']['OpSchema']['iState']; export default interface PayClazz { type: string; diff --git a/lib/types/RuntimeCxt.d.ts b/lib/types/RuntimeCxt.d.ts index 42ec9dfa..baeced54 100644 --- a/lib/types/RuntimeCxt.d.ts +++ b/lib/types/RuntimeCxt.d.ts @@ -1,9 +1,9 @@ -import { AspectDict } from "@project/aspects/AspectDict"; -import { FeatureDict } from "@project/features"; -import { EntityDict } from "@project/oak-app-domain"; +import { AspectDict } from "../aspects/AspectDict"; +import { FeatureDict } from "../features"; +import { EntityDict } from "../oak-app-domain"; import { BasicFeatures } from "oak-frontend-base"; -import { BackendRuntimeContext } from "@project/context/BackendRuntimeContext"; -import { FrontendRuntimeContext } from "@project/context/FrontendRuntimeContext"; +import { BackendRuntimeContext } from "../context/BackendRuntimeContext"; +import { FrontendRuntimeContext } from "../context/FrontendRuntimeContext"; import { FeatureDict as Ogb0FeatureDict, AspectDict as Ogb0AspectDict } from "oak-general-business"; export type BRC = BackendRuntimeContext; export type FRC = FrontendRuntimeContext; diff --git a/lib/utils/application.d.ts b/lib/utils/application.d.ts index d7e689fc..8a4fb424 100644 --- a/lib/utils/application.d.ts +++ b/lib/utils/application.d.ts @@ -1,4 +1,4 @@ -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; export declare const applicationProjection: EntityDict['application']['Selection']['data']; export declare const mergedProjection: { [k: string]: any; @@ -12,7 +12,7 @@ export declare const mergedProjection: { type?: number | undefined; systemId?: number | undefined; system?: import("../oak-app-domain/System/Schema").Projection | undefined; - config?: number | import("oak-domain/lib/types").JsonProjection | undefined; + config?: number | import("oak-domain/lib/types").JsonProjection | undefined; style?: number | import("oak-domain/lib/types").JsonProjection | undefined; domainId?: number | undefined; domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined; diff --git a/lib/utils/application.js b/lib/utils/application.js index e97ef9b1..5dd6bdf2 100644 --- a/lib/utils/application.js +++ b/lib/utils/application.js @@ -26,7 +26,9 @@ exports.applicationProjection = { id: 1, channel: 1, name: 1, - desc: 1, + type: 1, + allowDeposit: 1, + allowPay: 1, } } } diff --git a/lib/utils/pay.d.ts b/lib/utils/pay.d.ts index c43e653b..91fba324 100644 --- a/lib/utils/pay.d.ts +++ b/lib/utils/pay.d.ts @@ -1,7 +1,7 @@ /// -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity'; -import BackendRuntimeContext from '@project/context/BackendRuntimeContext'; +import BackendRuntimeContext from '../context/BackendRuntimeContext'; import { IncomingHttpHeaders } from 'http'; export declare const fullPayProjection: EntityDict['pay']['Selection']['data']; export declare function payNotify(context: BackendRuntimeContext, body: any, payId: string, headers: IncomingHttpHeaders): Promise; diff --git a/lib/utils/pay.js b/lib/utils/pay.js index aac6883a..7386a9e5 100644 --- a/lib/utils/pay.js +++ b/lib/utils/pay.js @@ -5,7 +5,7 @@ const tslib_1 = require("tslib"); const payClazz_1 = require("./payClazz"); const assert_1 = tslib_1.__importDefault(require("assert")); const uuid_1 = require("oak-domain/lib/utils/uuid"); -const Exception_1 = require("@project/types/Exception"); +const Exception_1 = require("../types/Exception"); exports.fullPayProjection = { id: 1, applicationId: 1, @@ -31,7 +31,6 @@ exports.fullPayProjection = { title: 1, desc: 1, }, - accountId: 1, }; async function payNotify(context, body, payId, headers) { const [pay] = await context.select('pay', { diff --git a/lib/utils/payClazz/Account.d.ts b/lib/utils/payClazz/Account.d.ts index e92fddf5..cb232c09 100644 --- a/lib/utils/payClazz/Account.d.ts +++ b/lib/utils/payClazz/Account.d.ts @@ -1,7 +1,7 @@ -import { OpSchema as Refund } from "@project/oak-app-domain/Refund/Schema"; +import { OpSchema as Refund } from "../../oak-app-domain/Refund/Schema"; import { Schema, OpSchema as Pay, UpdateOperationData as PayUpdateData } from "../../oak-app-domain/Pay/Schema"; import PayClazz from "../../types/PayClazz"; -import { BRC } from "@project/types/RuntimeCxt"; +import { BRC } from "../../types/RuntimeCxt"; export default class Account implements PayClazz { refund(refund: Refund): Promise; closeRefund(refund: Refund): Promise; diff --git a/lib/utils/payClazz/Offline.d.ts b/lib/utils/payClazz/Offline.d.ts index 9d09a6ff..7725eab0 100644 --- a/lib/utils/payClazz/Offline.d.ts +++ b/lib/utils/payClazz/Offline.d.ts @@ -1,4 +1,4 @@ -import { OpSchema, UpdateOperationData } from "@project/oak-app-domain/Refund/Schema"; +import { OpSchema, UpdateOperationData } from "../../oak-app-domain/Refund/Schema"; import { OpSchema as Pay, UpdateOperationData as PayUpdateData } from "../../oak-app-domain/Pay/Schema"; import PayClazz from "../../types/PayClazz"; import { BRC } from "../../types/RuntimeCxt"; diff --git a/lib/utils/payClazz/WechatPay/WechatPay.d.ts b/lib/utils/payClazz/WechatPay/WechatPay.d.ts index f9d75daa..47a1ad28 100644 --- a/lib/utils/payClazz/WechatPay/WechatPay.d.ts +++ b/lib/utils/payClazz/WechatPay/WechatPay.d.ts @@ -1,10 +1,10 @@ -import { OpSchema as OpPay, Schema as Pay, UpdateOperationData as PayUpdateData } from "@project/oak-app-domain/Pay/Schema"; -import PayClazz from "@project/types/PayClazz"; -import { BRC } from "@project/types/RuntimeCxt"; +import { OpSchema as OpPay, Schema as Pay, UpdateOperationData as PayUpdateData } from "../../../oak-app-domain/Pay/Schema"; +import PayClazz from "../../../types/PayClazz"; +import { BRC } from "../../../types/RuntimeCxt"; import { WechatPay as WechatPaySDK } from 'wechat-pay-nodejs'; -import { EntityDict } from "@project/oak-app-domain"; -import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData } from "@project/oak-app-domain/Refund/Schema"; -import { Schema as WpProduct } from '@project/oak-app-domain/WpProduct/Schema'; +import { EntityDict } from "../../../oak-app-domain"; +import { OpSchema as OpRefund, UpdateOperationData as RefundUpdateData } from "../../../oak-app-domain/Refund/Schema"; +import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema'; export default class WechatPay implements PayClazz { type: WpProduct['type']; wechatPay: WechatPaySDK; diff --git a/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts b/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts index d508a003..36177d2d 100644 --- a/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts +++ b/lib/utils/payClazz/WechatPay/WechatPay.debug.d.ts @@ -1,9 +1,9 @@ -import { OpSchema as Refund, UpdateOperationData as RefundUpdateData } from "@project/oak-app-domain/Refund/Schema"; +import { OpSchema as Refund, UpdateOperationData as RefundUpdateData } from "../../../oak-app-domain/Refund/Schema"; import { EntityDict } from "../../../oak-app-domain"; import { OpSchema as Pay, UpdateOperationData as PayUpdateData } from "../../../oak-app-domain/Pay/Schema"; import PayClazz from "../../../types/PayClazz"; import { BRC } from "../../../types/RuntimeCxt"; -import { Schema as WpProduct } from '@project/oak-app-domain/WpProduct/Schema'; +import { Schema as WpProduct } from '../../../oak-app-domain/WpProduct/Schema'; export declare function registerGetPayStateResult(payState: NonNullable): void; export default class WechatPay implements PayClazz { type: WpProduct['type']; diff --git a/lib/utils/payClazz/WechatPay/WechatPay.js b/lib/utils/payClazz/WechatPay/WechatPay.js index 6639d662..f1267d55 100644 --- a/lib/utils/payClazz/WechatPay/WechatPay.js +++ b/lib/utils/payClazz/WechatPay/WechatPay.js @@ -5,7 +5,7 @@ const fs_1 = tslib_1.__importDefault(require("fs")); const dayjs_1 = tslib_1.__importDefault(require("dayjs")); const wechat_pay_nodejs_1 = require("wechat-pay-nodejs"); const uuid_1 = require("oak-domain/lib/utils/uuid"); -const Exception_1 = require("@project/types/Exception"); +const Exception_1 = require("../../../types/Exception"); const assert_1 = tslib_1.__importDefault(require("assert")); const lodash_1 = require("oak-domain/lib/utils/lodash"); const TRADE_STATE_MATRIX = { diff --git a/lib/utils/payClazz/WechatPay/index.d.ts b/lib/utils/payClazz/WechatPay/index.d.ts index ce1d041a..eeba2b4b 100644 --- a/lib/utils/payClazz/WechatPay/index.d.ts +++ b/lib/utils/payClazz/WechatPay/index.d.ts @@ -1,4 +1,4 @@ import WechatPay from './WechatPay'; import WechatPayDebug from './WechatPay.debug'; -declare const _default: typeof WechatPay | typeof WechatPayDebug; +declare const _default: typeof WechatPayDebug | typeof WechatPay; export default _default; diff --git a/lib/utils/wpProduct.d.ts b/lib/utils/wpProduct.d.ts new file mode 100644 index 00000000..52470d0d --- /dev/null +++ b/lib/utils/wpProduct.d.ts @@ -0,0 +1,2 @@ +import { EntityDict } from '../oak-app-domain'; +export declare function getAppTypeFromProductType(type: EntityDict['wpProduct']['OpSchema']['type']): EntityDict['application']['OpSchema']['type'][]; diff --git a/lib/utils/wpProduct.js b/lib/utils/wpProduct.js new file mode 100644 index 00000000..0dee3d2c --- /dev/null +++ b/lib/utils/wpProduct.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getAppTypeFromProductType = void 0; +function getAppTypeFromProductType(type) { + switch (type) { + case 'app': { + return ['native']; + } + case 'h5': { + return ['web']; + } + case 'jsapi': { + return ['wechatPublic']; + } + case 'mp': { + return ['wechatMp']; + } + case 'native': { + return ['web']; + } + } +} +exports.getAppTypeFromProductType = getAppTypeFromProductType; diff --git a/lib/watchers/index.d.ts b/lib/watchers/index.d.ts index fb03095f..255369e1 100644 --- a/lib/watchers/index.d.ts +++ b/lib/watchers/index.d.ts @@ -1,5 +1,5 @@ import { Watcher } from 'oak-domain/lib/types'; import { EntityDict } from '@oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { BRC } from '../types/RuntimeCxt'; declare const watchers: Watcher[]; export default watchers; diff --git a/lib/watchers/index.js b/lib/watchers/index.js new file mode 100644 index 00000000..daf8c02f --- /dev/null +++ b/lib/watchers/index.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +const order_1 = tslib_1.__importDefault(require("./order")); +const pay_1 = tslib_1.__importDefault(require("./pay")); +const refund_1 = tslib_1.__importDefault(require("./refund")); +const watchers = [ + ...order_1.default, + ...pay_1.default, + ...refund_1.default, +]; +exports.default = watchers; diff --git a/lib/watchers/order.d.ts b/lib/watchers/order.d.ts index d6d336aa..ff1576b7 100644 --- a/lib/watchers/order.d.ts +++ b/lib/watchers/order.d.ts @@ -1,4 +1,4 @@ import { BBWatcher } from 'oak-domain/lib/types/Watcher'; -import { EntityDict } from '@project/oak-app-domain'; +import { EntityDict } from '../oak-app-domain'; declare const watchers: BBWatcher[]; export default watchers; diff --git a/lib/watchers/order.js b/lib/watchers/order.js new file mode 100644 index 00000000..7384ff90 --- /dev/null +++ b/lib/watchers/order.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const watchers = [ + { + name: '使过期的order结束', + entity: 'order', + filter: () => { + const now = Date.now(); + return { + iState: 'unpaid', + timeoutAt: { + $lte: now, + }, + }; + }, + action: 'timeout', + actionData: {}, + } +]; +exports.default = watchers; diff --git a/lib/watchers/pay.d.ts b/lib/watchers/pay.d.ts index 2c542b85..005b08f3 100644 --- a/lib/watchers/pay.d.ts +++ b/lib/watchers/pay.d.ts @@ -1,5 +1,5 @@ import { Watcher } from 'oak-domain/lib/types/Watcher'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const watchers: Watcher[]; export default watchers; diff --git a/lib/watchers/pay.js b/lib/watchers/pay.js index 7fb4da17..4779e02c 100644 --- a/lib/watchers/pay.js +++ b/lib/watchers/pay.js @@ -1,8 +1,8 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); -const pay_1 = require("@project/utils/pay"); -const payClazz_1 = require("@project/utils/payClazz"); +const pay_1 = require("../utils/pay"); +const payClazz_1 = require("../utils/payClazz"); const assert_1 = tslib_1.__importDefault(require("assert")); const uuid_1 = require("oak-domain/lib/utils/uuid"); const operationResult_1 = require("oak-domain/lib/utils/operationResult"); diff --git a/lib/watchers/refund.d.ts b/lib/watchers/refund.d.ts index da6915fe..b8414baf 100644 --- a/lib/watchers/refund.d.ts +++ b/lib/watchers/refund.d.ts @@ -1,5 +1,5 @@ import { Watcher } from 'oak-domain/lib/types/Watcher'; -import { EntityDict } from '@project/oak-app-domain'; -import { BRC } from '@project/types/RuntimeCxt'; +import { EntityDict } from '../oak-app-domain'; +import { BRC } from '../types/RuntimeCxt'; declare const watchers: Watcher[]; export default watchers; diff --git a/lib/watchers/refund.js b/lib/watchers/refund.js index cfd72c27..80a450f4 100644 --- a/lib/watchers/refund.js +++ b/lib/watchers/refund.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); -const payClazz_1 = require("@project/utils/payClazz"); +const payClazz_1 = require("../utils/payClazz"); const assert_1 = tslib_1.__importDefault(require("assert")); const uuid_1 = require("oak-domain/lib/utils/uuid"); const operationResult_1 = require("oak-domain/lib/utils/operationResult"); diff --git a/src/checkers/index.ts b/src/checkers/index.ts index 678380cf..b522962b 100644 --- a/src/checkers/index.ts +++ b/src/checkers/index.ts @@ -6,6 +6,7 @@ import payCheckers from './pay'; import orderCheckers from './order'; import applicationCheckers from './application'; import offlineAccountCheckers from './offlineAccount'; +import wpProductCheckers from './wpProduct'; const checkers = [ ...aoCheckers, @@ -13,6 +14,7 @@ const checkers = [ ...orderCheckers, ...applicationCheckers, ...offlineAccountCheckers, + ...wpProductCheckers, ] as Checker[]; export default checkers; diff --git a/src/checkers/wpProduct.ts b/src/checkers/wpProduct.ts new file mode 100644 index 00000000..14723b31 --- /dev/null +++ b/src/checkers/wpProduct.ts @@ -0,0 +1,70 @@ +import { Checker } from 'oak-domain/lib/types/Auth'; +import { EntityDict } from '../oak-app-domain'; +import { RuntimeCxt } from '../types/RuntimeCxt'; +import { pipeline } from 'oak-domain/lib/utils/executor'; +import assert from 'assert'; + +const checkers: Checker[] = [ + { + entity: 'wpProduct', + action: 'create', + type: 'row', + filter(operation) { + const { data } = operation as EntityDict['wpProduct']['CreateSingle']; + if (data) { + const { type, enabled } = data; + + if (enabled) { + return { + application: { + wpProduct$application: { + "#sqp": 'not in', + enabled: true, + type, + } + } + }; + } + } + return {}; + }, + errMsg: '同一应用上不能存在同样类型的支付产品', + }, + { + entity: 'wpProduct', + action: 'update', + type: 'row', + filter(operation, context) { + const { data, filter } = operation as EntityDict['wpProduct']['Update']; + if (data && data.enabled) { + assert(filter!.id && typeof filter!.id === 'string'); + return pipeline( + () => context.select('wpProduct', { + data: { + id: 1, + type: 1, + applicationId: 1, + }, + }, { dontCollect: true }), + (wpProducts: EntityDict['wpProduct']['OpSchema'][]) => { + const [ wpProduct ] = wpProducts; + const { type } = wpProduct; + return { + application: { + wpProduct$application: { + "#sqp": 'not in', + enabled: true, + type, + }, + }, + }; + } + ); + } + return {}; + }, + errMsg: '同一应用上不能存在同样类型的支付产品', + } +]; + +export default checkers; diff --git a/src/components/offlineAccount/config/index.ts b/src/components/offlineAccount/config/index.ts index deefae28..04bdd721 100644 --- a/src/components/offlineAccount/config/index.ts +++ b/src/components/offlineAccount/config/index.ts @@ -10,6 +10,8 @@ export default OakComponent({ allowDeposit: 1, allowPay: 1, systemId: 1, + price: 1, + enabled: 1, }, properties: { systemId: '', diff --git a/src/components/offlineAccount/config/locales/zh-CN.json b/src/components/offlineAccount/config/locales/zh-CN.json index 81daa452..72ecf46b 100644 --- a/src/components/offlineAccount/config/locales/zh-CN.json +++ b/src/components/offlineAccount/config/locales/zh-CN.json @@ -1,5 +1,7 @@ { "tips": "线下账户是需要system的相关工作人员手动同步收款和打款结果的账户", "notnull": "属性\"%{value}\"不能为空", - "noData": "没有数据" + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" } \ No newline at end of file diff --git a/src/components/offlineAccount/config/web.pc.tsx b/src/components/offlineAccount/config/web.pc.tsx index 1afd951f..e8dd4146 100644 --- a/src/components/offlineAccount/config/web.pc.tsx +++ b/src/components/offlineAccount/config/web.pc.tsx @@ -17,12 +17,12 @@ function OfflineAccount(props: { onQrCodeClick: () => void; }) { const { account, t, onUpdate, onRemove, onQrCodeClick } = props; - const { type, channel, name, qrCode, allowDeposit, allowPay, color } = account; + const { type, channel, name, qrCode, allowDeposit, allowPay, color, enabled, price } = account; const legalActions = account['#oakLegalActions']; return ( {legalActions.includes('update') &&

diff --git a/src/components/wechatPay/upsert/index.json b/src/components/wechatPay/upsert/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/wechatPay/upsert/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/wechatPay/upsert/index.ts b/src/components/wechatPay/upsert/index.ts new file mode 100644 index 00000000..7ca951ee --- /dev/null +++ b/src/components/wechatPay/upsert/index.ts @@ -0,0 +1,46 @@ +import { composeServerUrl } from "oak-general-business/es/utils/domain"; + +export default OakComponent({ + entity: 'wechatPay', + projection: { + id: 1, + refundNotifyUrl: 1, + payNotifyUrl: 1, + system: { + id: 1, + domain$system: { + $entity: 'domain', + data: { + id: 1, + protocol: 1, + url: 1, + apiPath: 1, + port: 1, + }, + }, + } + }, + isList: false, + formData({ data }) { + const domain = data && data.system?.domain$system?.[0]; + const serverUrl = domain && composeServerUrl(domain); + + return { + wechatPay: data, + serverUrl, + }; + }, + properties: { + systemId: '', + }, + lifetimes: { + ready() { + const { systemId } = this.props; + if (this.isCreation()) { + this.update({ + systemId, + }); + } + } + } +}) \ No newline at end of file diff --git a/src/components/wechatPay/upsert/locales/zh-CN.json b/src/components/wechatPay/upsert/locales/zh-CN.json new file mode 100644 index 00000000..722e97c1 --- /dev/null +++ b/src/components/wechatPay/upsert/locales/zh-CN.json @@ -0,0 +1,8 @@ +{ + + "placeholder": { + "lossRatio": "填百分比(0.6就代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint" + } +} \ No newline at end of file diff --git a/src/components/wechatPay/upsert/web.pc.module.less b/src/components/wechatPay/upsert/web.pc.module.less new file mode 100644 index 00000000..f15c3739 --- /dev/null +++ b/src/components/wechatPay/upsert/web.pc.module.less @@ -0,0 +1,3 @@ +.container { + height: 100%; +} \ No newline at end of file diff --git a/src/components/wechatPay/upsert/web.pc.tsx b/src/components/wechatPay/upsert/web.pc.tsx new file mode 100644 index 00000000..ae444822 --- /dev/null +++ b/src/components/wechatPay/upsert/web.pc.tsx @@ -0,0 +1,49 @@ +import React, { useState } from 'react'; +import { Alert, Form, Switch, InputNumber, Input, Select, Radio } from 'antd'; +import { PlusCircleOutlined } from '@ant-design/icons'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +import Styles from './web.pc.module.less'; +import { OakAttrNotNullException, OakException } from 'oak-domain/lib/types'; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; + +export default function render(props: WebComponentProps); + serverUrl: string; +}>) { + const { wechatPay, serverUrl } = props.data; + const { t, update } = props.methods; + + if (wechatPay) { + return ( + <> + + { + const payNotifyUrl = currentTarget.value; + update({ payNotifyUrl }); + }} + /> + + + { + const refundNotifyUrl = currentTarget.value; + update({ refundNotifyUrl }); + }} + /> + + + ); + } + + return null; +} \ No newline at end of file diff --git a/src/components/wpAccount/config/index.json b/src/components/wpAccount/config/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/wpAccount/config/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/wpAccount/config/index.ts b/src/components/wpAccount/config/index.ts new file mode 100644 index 00000000..6c83e1d0 --- /dev/null +++ b/src/components/wpAccount/config/index.ts @@ -0,0 +1,18 @@ +export default OakComponent({ + entity: 'wpAccount', + isList: true, + projection: { + id: 1, + price: 1, + mchId: 1, + refundGapDays: 1, + enabled: 1, + }, + formData({ data, legalActions }) { + return { + accounts: data, + canCreate: legalActions?.includes('create'), + }; + }, + actions: ['create', 'update', 'remove'], +}) \ No newline at end of file diff --git a/src/components/wpAccount/config/locales/zh-CN.json b/src/components/wpAccount/config/locales/zh-CN.json new file mode 100644 index 00000000..da581a09 --- /dev/null +++ b/src/components/wpAccount/config/locales/zh-CN.json @@ -0,0 +1,7 @@ +{ + "tips": "微信支付账户是用来配置微信支付的账户相关信息", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" +} \ No newline at end of file diff --git a/src/components/wpAccount/config/web.pc.module.less b/src/components/wpAccount/config/web.pc.module.less new file mode 100644 index 00000000..cf7d1871 --- /dev/null +++ b/src/components/wpAccount/config/web.pc.module.less @@ -0,0 +1,55 @@ +.container { + min-height: 80vh; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + flex-wrap: wrap; + + .list { + flex: 1; + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: flex-start; + + .item { + border: 0.1px solid silver; + border-radius: 8px; + margin: 18px; + padding: 18px; + + .qrCode:hover { + cursor: pointer; + } + } + } + + .btnBar { + display: flex; + justify-content: flex-end; + padding: 12px; + } +} + +.container2 { + min-height: 80vh; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + + .body { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + .add:hover { + color: var(--oak-color-primary); + } + } +} \ No newline at end of file diff --git a/src/components/wpAccount/config/web.pc.tsx b/src/components/wpAccount/config/web.pc.tsx new file mode 100644 index 00000000..8d9f3874 --- /dev/null +++ b/src/components/wpAccount/config/web.pc.tsx @@ -0,0 +1,206 @@ +import React, { useState } from 'react'; +import { Button, Modal, Alert, Descriptions, Tabs } from 'antd'; +import { PlusCircleOutlined } from '@ant-design/icons'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +import { Detail } from '../../../components/AbstractComponents'; +import Styles from './web.pc.module.less'; +import Upsert from '../upsert'; +import WpProductConfig from '../../wpProduct/config'; +import { OakAttrNotNullException, OakException } from 'oak-domain/lib/types'; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; + +function WpAccount(props: { + account: RowWithActions, + oakFullpath: string; + systemId: string; + t: (k: string, param?: any) => string; + onUpdate: () => void; + onRemove: () => void; + addItem: (data: any, path?: string) => void; +}) { + const { account, t, onUpdate, onRemove, oakFullpath, systemId, addItem } = props; + const { refundGapDays, mchId, enabled, price } = account; + const legalActions = account['#oakLegalActions']; + + const [activeKey, setActiveKey] = useState("1"); + return ( + { + setActiveKey(activeKey) + }} + tabBarExtraContent={ + activeKey === "1" && <> + {legalActions.includes('update') && } + {legalActions.includes('remove') && } + + } + style={{ width: 380, height: 520 }} + items={[ + { + key: '1', + label: t('common::action.detail'), + children: ( + + {mchId} + {price} + {refundGapDays} + {t(`common::${enabled}`)} + + ) + }, + { + key: '2', + label: t('wpProduct:name'), + children: ( + + ) + } + ]} + /> + ); +} + +export default function render(props: WebComponentProps & {})[]; + systemId: string; + canCreate?: boolean; +}>) { + const { accounts, oakFullpath, oakExecutable, canCreate, systemId } = props.data; + const { t, addItem, execute, clean } = props.methods; + + + const getNotNullMessage = (entity: string, attr: keyof EntityDict[keyof EntityDict]['OpSchema']) => { + return t('notnull', { value: t(`${entity}:attr.${attr}`) }); + }; + const errMsg = oakExecutable instanceof OakException && ( + oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity() as string, oakExecutable.getAttributes()[0] as keyof EntityDict[keyof EntityDict]['OpSchema']) : t(oakExecutable.message) + ); + const [upsertId, setUpsertId] = useState(''); + const U = ( + { + clean(); + setUpsertId(''); + }} + closeIcon={null} + onOk={async () => { + await execute(); + setUpsertId(''); + }} + okButtonProps={{ + disabled: oakExecutable !== true, + }} + okText={t('common::confirm')} + cancelText={(t('common::action.cancel'))} + > +
+ { + errMsg && + } + +
+
+ ); + if (accounts && accounts?.length) { + return ( +
+ {U} +
+ { + accounts.filter(ele => ele.$$createAt$$ as number > 1).map( + (ele, idx) =>
+ { + Modal.confirm({ + title: t('confirmDelete'), + content: t('areYouSure'), + onOk: async () => execute(undefined, undefined, undefined, [ + { + entity: 'wpAccount', + operation: { + id: await generateNewIdAsync(), + action: 'remove', + data: {}, + filter: { + id: ele.id!, + }, + } + } + ]), + }) + }} + onUpdate={() => setUpsertId(ele.id!)} + /> +
+ ) + } +
+
+ {canCreate && } +
+
+ ); + } + return ( +
+ + {U} +
+ {canCreate ? { + const id = addItem({ systemId }); + setUpsertId(id); + }} + /> : t('noData')} +
+
+ ); +} \ No newline at end of file diff --git a/src/components/wpAccount/upsert/index.json b/src/components/wpAccount/upsert/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/wpAccount/upsert/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/wpAccount/upsert/index.ts b/src/components/wpAccount/upsert/index.ts new file mode 100644 index 00000000..326dd10e --- /dev/null +++ b/src/components/wpAccount/upsert/index.ts @@ -0,0 +1,70 @@ +export default OakComponent({ + entity: 'wpAccount', + isList: false, + projection: { + id: 1, + price: 1, + mchId: 1, + refundGapDays: 1, + enabled: 1, + wechatPay: { + id: 1, + payNotifyUrl: 1, + refundNotifyUrl: 1, + }, + taxlossRatio: 1, + publicKeyFilePath: 1, + privateKeyFilePath: 1, + refundLossFloor: 1, + refundLossRatio: 1, + apiV3Key: 1, + systemId: 1, + }, + formData({ data, features }) { + const { systemId } = this.props; + const [wechatPay] = features.cache.get('wechatPay', { + data: { + id: 1, + refundNotifyUrl: 1, + payNotifyUrl: 1, + }, + filter: { + systemId, + } + }) + return { + wpAccount: data, + wechatPay, + }; + }, + properties: { + systemId: '', + }, + lifetimes: { + async ready() { + if (this.isCreation()) { + this.update({ + price: 0, + enabled: true, + taxlossRatio: 0.6, + }); + const { systemId } = this.props; + const { data: [ wechatPay ]} = await this.features.cache.refresh('wechatPay', { + data: { + id: 1, + refundNotifyUrl: 1, + payNotifyUrl: 1, + }, + filter: { + systemId, + } + }); + if (wechatPay) { + this.update({ + wechatPayId: wechatPay.id!, + }); + } + } + } + } +}); diff --git a/src/components/wpAccount/upsert/locales/zh-CN.json b/src/components/wpAccount/upsert/locales/zh-CN.json new file mode 100644 index 00000000..d84705a6 --- /dev/null +++ b/src/components/wpAccount/upsert/locales/zh-CN.json @@ -0,0 +1,14 @@ +{ + "placeholder": { + "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", + "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", + "taxlossRatio": "微信支付收取的手续费,一般为0.6(代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint", + "apiV3Key": "需要登录商户后台获取", + "refundGapDays": "超过这个天数后无法退款", + "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", + "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" + }, + "wechatPayIsShared": "以上配置是全局的,请谨慎修改" +} \ No newline at end of file diff --git a/src/components/wpAccount/upsert/web.pc.module.less b/src/components/wpAccount/upsert/web.pc.module.less new file mode 100644 index 00000000..cc7167b1 --- /dev/null +++ b/src/components/wpAccount/upsert/web.pc.module.less @@ -0,0 +1,4 @@ + +.tips { + color: var(--oak-color-warning); +} \ No newline at end of file diff --git a/src/components/wpAccount/upsert/web.pc.tsx b/src/components/wpAccount/upsert/web.pc.tsx new file mode 100644 index 00000000..89e2d748 --- /dev/null +++ b/src/components/wpAccount/upsert/web.pc.tsx @@ -0,0 +1,160 @@ +import React, { useState } from 'react'; +import { Alert, Form, Switch, InputNumber, Input, Select, Radio, Button, Divider } from 'antd'; +import { PlusCircleOutlined } from '@ant-design/icons'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +import Styles from './web.pc.module.less'; +import WechatPayUpsert from '../../wechatPay/upsert'; + +export default function render(props: WebComponentProps & {}); + wechatPay?: EntityDict['wechatPay']['OpSchema']; + systemId: string; +}>) { + const { wpAccount, wechatPay, oakFullpath, systemId } = props.data; + const { t, update } = props.methods; + + if (wpAccount) { + return ( +
+ {(!wechatPay || wechatPay.$$createAt$$ === 1) && } + {wpAccount.wechatPayId && } + +
+ {t('wechatPayIsShared')} +
+
+ + + { + const mchId = currentTarget.value; + update({ mchId }); + }} + /> + + + { + const privateKeyFilePath = currentTarget.value; + update({ privateKeyFilePath }); + }} + /> + + + { + const publicKeyFilePath = currentTarget.value; + update({ publicKeyFilePath }); + }} + /> + + + { + const apiV3Key = currentTarget.value; + update({ apiV3Key }); + }} + /> + + + { + const taxlossRatio = value as number; + update({ taxlossRatio }); + }} + /> + + + { + const refundGapDays = value as number; + update({ refundGapDays }); + }} + /> + + + { + const refundLossRatio = value as number; + update({ refundLossRatio }); + }} + /> + + + { + const { value } = target; + const refundLossFloor = value; + update({ refundLossFloor }); + }} value={wpAccount.refundLossFloor}> + + + + + + { + update({ enabled }); + }} + /> + + + ); + } + return null; +} \ No newline at end of file diff --git a/src/components/wpProduct/config/index.json b/src/components/wpProduct/config/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/wpProduct/config/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/wpProduct/config/index.ts b/src/components/wpProduct/config/index.ts new file mode 100644 index 00000000..98dca01a --- /dev/null +++ b/src/components/wpProduct/config/index.ts @@ -0,0 +1,52 @@ +export default OakComponent({ + entity: 'wpProduct', + isList: true, + projection: { + id: 1, + type: 1, + wpAccountId: 1, + applicationId: 1, + enabled: 1, + application: { + id: 1, + type: 1, + name: 1, + }, + }, + filters: [ + { + filter() { + const { wpAccountId } = this.props; + return { + wpAccountId, + }; + } + } + ], + properties: { + systemId: '', + wpAccountId: '', + }, + formData({ data, legalActions }) { + return { + wpProducts: data, + canCreate: legalActions?.includes('create'), + }; + }, + actions: ['create', 'update', 'remove'], + lifetimes: { + ready() { + const { systemId } = this.props; + this.features.cache.refresh('application', { + data: { + id: 1, + name: 1, + type: 1, + }, + filter: { + systemId, + }, + }); + } + } +}) \ No newline at end of file diff --git a/src/components/wpProduct/config/locales/zh-CN.json b/src/components/wpProduct/config/locales/zh-CN.json new file mode 100644 index 00000000..b704af81 --- /dev/null +++ b/src/components/wpProduct/config/locales/zh-CN.json @@ -0,0 +1,7 @@ +{ + "tips": "同一应用中,同种类型的支付产品只能有一个生效", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" +} \ No newline at end of file diff --git a/src/components/wpProduct/config/web.pc.module.less b/src/components/wpProduct/config/web.pc.module.less new file mode 100644 index 00000000..4ff5d07e --- /dev/null +++ b/src/components/wpProduct/config/web.pc.module.less @@ -0,0 +1,62 @@ +.container { + min-height: 460px; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + flex-wrap: wrap; + + .list { + flex: 1; + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: flex-start; + + .item { + border: 0.1px solid silver; + border-radius: 8px; + margin: 18px; + padding: 18px; + + .qrCode:hover { + cursor: pointer; + } + } + } + + .btnBar { + display: flex; + justify-content: flex-end; + padding: 12px; + margin-bottom: 8px; + border-bottom: 0.1px solid silver; + + .tips { + color: var(--oak-color-warning); + flex: 1; + } + } +} + +.container2 { + min-height: 460px; + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + + .body { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + + .add:hover { + color: var(--oak-color-primary); + } + } +} \ No newline at end of file diff --git a/src/components/wpProduct/config/web.pc.tsx b/src/components/wpProduct/config/web.pc.tsx new file mode 100644 index 00000000..ff6f338e --- /dev/null +++ b/src/components/wpProduct/config/web.pc.tsx @@ -0,0 +1,166 @@ +import React, { useState } from 'react'; +import { Button, Modal, Alert, Descriptions, List, Card, Switch, Divider } from 'antd'; +import { PlusCircleOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +import { Detail } from '../../../components/AbstractComponents'; +import Styles from './web.pc.module.less'; +import Upsert from '../upsert'; +import { OakAttrNotNullException, OakException } from 'oak-domain/lib/types'; +import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid'; + +export default function render(props: WebComponentProps & {})[]; + systemId: string; + canCreate?: boolean; + wpAccountId: string; +}>) { + const { wpAccountId, wpProducts, oakFullpath, oakExecutable, canCreate, systemId } = props.data; + const { t, addItem, execute, clean } = props.methods; + + const getNotNullMessage = (entity: string, attr: keyof EntityDict[keyof EntityDict]['OpSchema']) => { + return t('notnull', { value: t(`${entity}:attr.${attr}`) }); + }; + const errMsg = oakExecutable instanceof OakException && ( + oakExecutable instanceof OakAttrNotNullException ? getNotNullMessage(oakExecutable.getEntity() as string, oakExecutable.getAttributes()[0] as keyof EntityDict[keyof EntityDict]['OpSchema']) : t(oakExecutable.message) + ); + const [upsertId, setUpsertId] = useState(''); + + const U = ( + { + clean(); + setUpsertId(''); + }} + closeIcon={null} + onOk={async () => { + await execute(); + setUpsertId(''); + }} + okButtonProps={{ + disabled: oakExecutable !== true, + }} + okText={t('common::confirm')} + cancelText={(t('common::action.cancel'))} + > +
+ { + errMsg && + } + +
+
+ ); + if (wpProducts && wpProducts.length) { + return ( +
+
+
+ {t('tips')} +
+ +
+ {U} + ( + { + Modal.confirm({ + title: t('confirmDelete'), + content: t('areYouSure'), + onOk: async () => execute(undefined, undefined, undefined, [ + { + entity: 'wpProduct', + operation: { + id: await generateNewIdAsync(), + action: 'remove', + data: {}, + filter: { + id: product.id!, + }, + } + } + ]), + }); + }} + > + {t('common::action.remove')} + + ] : []} + > + : } + title={{t(`wpProduct:v.type.${product.type}`)}} + description={{product.application?.name}} + /> + { + await execute(undefined, undefined, undefined, [ + { + entity: 'wpProduct', + operation: { + id: await generateNewIdAsync(), + action: 'update', + data: { + enabled, + }, + filter: { + id: product.id!, + } + } + } + ]); + }} + /> + + )} + /> +
+ ); + } + + return ( +
+ + {U} +
+ {canCreate ? { + const id = addItem({}); + setUpsertId(id); + }} + /> : t('noData')} +
+
+ ); +} \ No newline at end of file diff --git a/src/components/wpProduct/upsert/index.json b/src/components/wpProduct/upsert/index.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/src/components/wpProduct/upsert/index.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/components/wpProduct/upsert/index.ts b/src/components/wpProduct/upsert/index.ts new file mode 100644 index 00000000..371838b3 --- /dev/null +++ b/src/components/wpProduct/upsert/index.ts @@ -0,0 +1,57 @@ +import { getAppTypeFromProductType } from "../../../utils/wpProduct"; + +export default OakComponent({ + entity: 'wpProduct', + isList: false, + projection: { + id: 1, + type: 1, + wpAccountId: 1, + applicationId: 1, + enabled: 1, + application: { + id: 1, + type: 1, + name: 1, + }, + }, + properties: { + systemId: '', + wpAccountId: '', + }, + formData({ data, features }) { + const { systemId } = this.props; + const applications = data?.type && features.cache.get('application', { + data: { + id: 1, + name: 1, + type: 1, + }, + filter: { + systemId, + wpProduct$application: { + "#sqp": 'not in', + enabled: true, + }, + type: { + $in: getAppTypeFromProductType(data.type!), + } + } + }) + return { + applications, + wpProduct: data, + }; + }, + lifetimes: { + ready() { + if (this.isCreation()) { + const { wpAccountId } = this.props; + this.update({ + wpAccountId, + enabled: true, + }); + } + } + } +}) \ No newline at end of file diff --git a/src/components/wpProduct/upsert/web.pc.tsx b/src/components/wpProduct/upsert/web.pc.tsx new file mode 100644 index 00000000..353efa27 --- /dev/null +++ b/src/components/wpProduct/upsert/web.pc.tsx @@ -0,0 +1,68 @@ +import React, { useState } from 'react'; +import { Alert, Form, Switch, InputNumber, Input, Select, Radio, Button, Divider } from 'antd'; +import { PlusCircleOutlined } from '@ant-design/icons'; +import { EntityDict } from "../../../oak-app-domain"; +import { RowWithActions, WebComponentProps } from "oak-frontend-base"; +import Styles from './web.pc.module.less'; +import WechatPayUpsert from '../../wechatPay/upsert'; + + +export default function render(props: WebComponentProps & {}); + applications?: EntityDict['application']['OpSchema'][]; + systemId: string; +}>) { + const { wpProduct, applications, oakFullpath, systemId } = props.data; + const { t, update } = props.methods; + + if (wpProduct) { + return ( +
+ + ({ + label: ele.name, + value: ele.id, + }) + )} + onSelect={(value) => update({ applicationId: value })} + /> + + )} + + { + update({ enabled }); + }} + /> + +
+ ) + } + + return null; +} \ No newline at end of file diff --git a/src/configuration/attrUpdateMatrix.ts b/src/configuration/attrUpdateMatrix.ts index ca45af58..064776d2 100644 --- a/src/configuration/attrUpdateMatrix.ts +++ b/src/configuration/attrUpdateMatrix.ts @@ -66,7 +66,71 @@ const attrUpdateMatrix: AttrUpdateMatrix = { meta: { actions: ['succeed', 'fail', 'succeedPartially'], }, - } + }, + offlineAccount: { + name: { + actions: ['update'], + filter: { + // 只有从来没用过的才能改 + sysAccountOper$entity: { + "#sqp": 'not in', + } + } + }, + channel: { + actions: ['update'], + filter: { + // 只有从来没用过的才能改 + sysAccountOper$entity: { + "#sqp": 'not in', + } + } + }, + qrCode: { + actions: ['update'], + }, + enabled: { + actions: ['update'], + }, + price: { + actions: ['pay' , 'refund', 'deposit', 'withdraw', 'tax'], + } + }, + wpAccount: { + wechatPay: { + actions: ['update'], + }, + taxlossRatio: { + actions: ['update'], + }, + depositLossRatio: { + actions: ['update'], + }, + refundGapDays: { + actions: ['update'], + }, + refundLossRatio: { + actions: ['update'], + }, + refundLossFloor: { + actions: ['update'], + }, + publicKeyFilePath: { + actions: ['update'], + }, + privateKeyFilePath: { + actions: ['update'], + }, + apiV3Key: { + actions: ['update'], + }, + enabled: { + actions: ['update'], + }, + price: { + actions: ['pay' , 'refund', 'deposit', 'withdraw', 'tax'], + } + }, }; export default attrUpdateMatrix; \ No newline at end of file diff --git a/src/data/i18n.ts b/src/data/i18n.ts index 3cdda2b1..d0f04883 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -63,7 +63,10 @@ const i18ns: I18n[] = [ position: "src/components/offlineAccount/config", data: { "tips": "线下账户是需要system的相关工作人员手动同步收款和打款结果的账户", - "notnull": "属性\"%{value}\"不能为空" + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" } }, { @@ -290,6 +293,20 @@ const i18ns: I18n[] = [ } } }, + { + id: "79255be8c093dfef9765b3f367cab553", + namespace: "oak-pay-business-c-wechatPay-upsert", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wechatPay/upsert", + data: { + "placeholder": { + "lossRatio": "填百分比(0.6就代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint" + } + } + }, { id: "6a1df36d072d367121b49dfc665b4100", namespace: "oak-pay-business-c-withdraw-create", @@ -425,6 +442,55 @@ const i18ns: I18n[] = [ } } }, + { + id: "7273f5a9fdb45407416554325a1abb1e", + namespace: "oak-pay-business-c-wpAccount-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpAccount/config", + data: { + "tips": "微信支付账户是用来配置微信支付的账户相关信息", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, + { + id: "33691d391e052cccf005d0f0da84e20e", + namespace: "oak-pay-business-c-wpAccount-upsert", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpAccount/upsert", + data: { + "placeholder": { + "privateKeyFilePath": "服务器上存放apiclient_key.pem的路径,注意访问权限", + "publicKeyFilePath": "服务器上存放apiclient_cert.pem的路径,注意访问权限", + "taxlossRatio": "微信支付收取的手续费,一般为0.6(代表千分之六)", + "payNotifyUrl": "endpoint", + "refundNotifyUrl": "endpoint", + "apiV3Key": "需要登录商户后台获取", + "refundGapDays": "超过这个天数后无法退款", + "refundLossRatio": "退款时将按这个百分比扣除损耗(0.6就代表千分之六)", + "refundLossFloor": "退款时按位向下取整(如按元取整,则忽略角位和分位)" + }, + "wechatPayIsShared": "以上配置是全局的,请谨慎修改" + } + }, + { + id: "634284beff0e0bdf84fb23cdeea9107d", + namespace: "oak-pay-business-c-wpProduct-config", + language: "zh-CN", + module: "oak-pay-business", + position: "src/components/wpProduct/config", + data: { + "tips": "同一应用中,同种类型的支付产品同时只能有一个生效", + "notnull": "属性\"%{value}\"不能为空", + "noData": "没有数据", + "confirmDelete": "确定删除", + "areYouSure": "确认删除本数据吗?" + } + }, { id: "2127948cb52e116e3ceccd93db8f319c", namespace: "oak-pay-business-l-common", diff --git a/src/entities/OfflineAccount.ts b/src/entities/OfflineAccount.ts index c9cd3674..0c659d8f 100644 --- a/src/entities/OfflineAccount.ts +++ b/src/entities/OfflineAccount.ts @@ -11,6 +11,7 @@ import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc, ActionDef } from 'oak-domain/lib/types'; import { Schema as System } from 'oak-general-business/lib/entities/System'; import { Schema as Pay } from './Pay'; +import { Schema as SysAccountOper } from './SysAccountOper'; export interface Schema extends EntityShape { type: 'bank' | 'alipay' | 'wechat' | 'shouqianba' | 'others', @@ -20,10 +21,15 @@ export interface Schema extends EntityShape { allowDeposit: Boolean; allowPay: Boolean; system: System; + price: Price; pays: Pay[]; + opers: SysAccountOper[]; + enabled: Boolean; }; -export const entityDesc: EntityDesc = { locales: { @@ -37,7 +43,10 @@ export const entityDesc: EntityDesc; + entityId: String<64>; +}; + +export const entityDesc: EntityDesc = { + locales: { + zh_CN: { + name: '系统账户操作', + attr: { + type: '类型', + delta: '余额变化', + entity: '关联对象', + entityId: '关联对象Id', + }, + v: { + type: { + deposit: '充值', + withdraw: '提现', + pay: '支付', + refund: '退款', + tax: '渠道手续费' + }, + }, + }, + }, + style: { + color: { + type: { + deposit: '#3498DB', + withdraw: '#F7DC6F', + pay: '#82E0AA', + tax: '#2E4053', + refund: '#2E4053', + } + } + }, + configuration: { + actionType: 'appendOnly', + } +} \ No newline at end of file diff --git a/src/entities/WechatPay.ts b/src/entities/WechatPay.ts index eae14cc0..d5d2cf3a 100644 --- a/src/entities/WechatPay.ts +++ b/src/entities/WechatPay.ts @@ -9,11 +9,12 @@ import { } from 'oak-domain/lib/types/DataType'; import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc, ActionDef } from 'oak-domain/lib/types'; +import { Schema as System } from 'oak-general-business/lib/entities/System'; export interface Schema extends EntityShape { payNotifyUrl: String<128>; // 支付通知回调接口 refundNotifyUrl: String<128>; // 退款通知回调接口 - lossRatio: Decimal<4, 2>; // 支付损耗比例,百分数 + system: System; }; export const entityDesc: EntityDesc = { @@ -23,7 +24,7 @@ export const entityDesc: EntityDesc = { attr: { payNotifyUrl: '支付通知回调', refundNotifyUrl: '退款通知回调', - lossRatio: '支付损耗比例' + system: '关联系统' }, }, }, diff --git a/src/entities/WpAccount.ts b/src/entities/WpAccount.ts index 46167b59..47772e4e 100644 --- a/src/entities/WpAccount.ts +++ b/src/entities/WpAccount.ts @@ -11,9 +11,11 @@ import { EntityShape } from 'oak-domain/lib/types/Entity'; import { EntityDesc, ActionDef } from 'oak-domain/lib/types'; import { Schema as WechatPay } from './WechatPay'; import { Schema as System } from 'oak-general-business/lib/entities/System'; +import { Schema as SysAccountOper } from './SysAccountOper'; export interface Schema extends EntityShape { wechatPay: WechatPay; + taxlossRatio: Decimal<4, 2>; // 支付损耗比例,百分数 depositLossRatio?: Decimal<4, 2>; refundGapDays?: Int<4>; // (支付后)允许退款的天数 refundLossRatio?: Decimal<4, 2>; // 退款损耗比例 @@ -24,9 +26,13 @@ export interface Schema extends EntityShape { apiV3Key: String<32>; price: Price; system: System; + opers: SysAccountOper[]; + enabled: Boolean; }; -export const entityDesc: EntityDesc; }> = { locales: { @@ -34,6 +40,7 @@ export const entityDesc: EntityDesc