settlePlan 增加 结算时间、关闭时间 字段
This commit is contained in:
parent
a536132e2c
commit
4389f8d5a2
|
|
@ -6,6 +6,8 @@ export interface Schema extends EntityShape {
|
|||
when?: Datetime;
|
||||
order: Order;
|
||||
price: Price;
|
||||
settledAt?: Datetime;
|
||||
closedAt?: Datetime;
|
||||
}
|
||||
type IState = 'unsettled' | 'settled' | 'closed';
|
||||
type IAction = 'settle' | 'close';
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ export const entityDesc = {
|
|||
order: '订单',
|
||||
price: '结算金额',
|
||||
iState: '结算计划状态',
|
||||
settledAt: '结算时间',
|
||||
closedAt: '关闭时间'
|
||||
},
|
||||
action: {
|
||||
settle: '结算',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ export const desc = {
|
|||
notNull: true,
|
||||
type: "money"
|
||||
},
|
||||
settledAt: {
|
||||
type: "datetime"
|
||||
},
|
||||
closedAt: {
|
||||
type: "datetime"
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["unsettled", "settled", "closed"]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ export type OpSchema = EntityShape & {
|
|||
when?: Datetime | null;
|
||||
orderId: ForeignKey<"order">;
|
||||
price: Price;
|
||||
settledAt?: Datetime | null;
|
||||
closedAt?: Datetime | null;
|
||||
iState?: IState | null;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
|
|
@ -20,6 +22,8 @@ export type OpFilter = {
|
|||
when: Q_DateValue;
|
||||
orderId: Q_StringValue;
|
||||
price: Q_NumberValue;
|
||||
settledAt: Q_DateValue;
|
||||
closedAt: Q_DateValue;
|
||||
iState: Q_EnumValue<IState>;
|
||||
} & ExprOp<OpAttr | string>;
|
||||
export type OpProjection = {
|
||||
|
|
@ -32,6 +36,8 @@ export type OpProjection = {
|
|||
when?: number;
|
||||
orderId?: number;
|
||||
price?: number;
|
||||
settledAt?: number;
|
||||
closedAt?: number;
|
||||
iState?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
export type OpSortAttr = Partial<{
|
||||
|
|
@ -42,6 +48,8 @@ export type OpSortAttr = Partial<{
|
|||
when: number;
|
||||
orderId: number;
|
||||
price: number;
|
||||
settledAt: number;
|
||||
closedAt: number;
|
||||
iState: number;
|
||||
[k: string]: any;
|
||||
} | ExprOp<OpAttr | string>>;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
"when": "结算时间",
|
||||
"order": "订单",
|
||||
"price": "结算金额",
|
||||
"iState": "结算计划状态"
|
||||
"iState": "结算计划状态",
|
||||
"settledAt": "结算时间",
|
||||
"closedAt": "关闭时间"
|
||||
},
|
||||
"action": {
|
||||
"settle": "结算",
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const triggers = [
|
|||
asRoot: true,
|
||||
priority: 99,
|
||||
fn: async ({ operation }, context, option) => {
|
||||
const { filter } = operation;
|
||||
const { filter, data } = operation;
|
||||
const settlePlans = await context.select('settlePlan', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -119,6 +119,15 @@ const triggers = [
|
|||
}, option);
|
||||
}
|
||||
}
|
||||
//为settlePlan赋上settledAt
|
||||
if (data instanceof Array) {
|
||||
for (const d of data) {
|
||||
d.settledAt = now;
|
||||
}
|
||||
}
|
||||
else {
|
||||
data.settledAt = now;
|
||||
}
|
||||
return settlePlans.length;
|
||||
},
|
||||
},
|
||||
|
|
@ -176,7 +185,7 @@ const triggers = [
|
|||
asRoot: true,
|
||||
priority: 99,
|
||||
fn: async ({ operation }, context, option) => {
|
||||
const { filter } = operation;
|
||||
const { filter, data } = operation;
|
||||
const settlePlans = await context.select('settlePlan', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -215,6 +224,15 @@ const triggers = [
|
|||
}
|
||||
}, option);
|
||||
}
|
||||
//为settlePlan赋上closedAt
|
||||
if (data instanceof Array) {
|
||||
for (const d of data) {
|
||||
d.closedAt = now;
|
||||
}
|
||||
}
|
||||
else {
|
||||
data.closedAt = now;
|
||||
}
|
||||
return settlePlans.length;
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ export interface Schema extends EntityShape {
|
|||
when?: Datetime;
|
||||
order: Order;
|
||||
price: Price;
|
||||
settledAt?: Datetime;
|
||||
closedAt?: Datetime;
|
||||
}
|
||||
type IState = 'unsettled' | 'settled' | 'closed';
|
||||
type IAction = 'settle' | 'close';
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ exports.entityDesc = {
|
|||
order: '订单',
|
||||
price: '结算金额',
|
||||
iState: '结算计划状态',
|
||||
settledAt: '结算时间',
|
||||
closedAt: '关闭时间'
|
||||
},
|
||||
action: {
|
||||
settle: '结算',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ exports.desc = {
|
|||
notNull: true,
|
||||
type: "money"
|
||||
},
|
||||
settledAt: {
|
||||
type: "datetime"
|
||||
},
|
||||
closedAt: {
|
||||
type: "datetime"
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["unsettled", "settled", "closed"]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ export type OpSchema = EntityShape & {
|
|||
when?: Datetime | null;
|
||||
orderId: ForeignKey<"order">;
|
||||
price: Price;
|
||||
settledAt?: Datetime | null;
|
||||
closedAt?: Datetime | null;
|
||||
iState?: IState | null;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
|
|
@ -20,6 +22,8 @@ export type OpFilter = {
|
|||
when: Q_DateValue;
|
||||
orderId: Q_StringValue;
|
||||
price: Q_NumberValue;
|
||||
settledAt: Q_DateValue;
|
||||
closedAt: Q_DateValue;
|
||||
iState: Q_EnumValue<IState>;
|
||||
} & ExprOp<OpAttr | string>;
|
||||
export type OpProjection = {
|
||||
|
|
@ -32,6 +36,8 @@ export type OpProjection = {
|
|||
when?: number;
|
||||
orderId?: number;
|
||||
price?: number;
|
||||
settledAt?: number;
|
||||
closedAt?: number;
|
||||
iState?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
export type OpSortAttr = Partial<{
|
||||
|
|
@ -42,6 +48,8 @@ export type OpSortAttr = Partial<{
|
|||
when: number;
|
||||
orderId: number;
|
||||
price: number;
|
||||
settledAt: number;
|
||||
closedAt: number;
|
||||
iState: number;
|
||||
[k: string]: any;
|
||||
} | ExprOp<OpAttr | string>>;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
"when": "结算时间",
|
||||
"order": "订单",
|
||||
"price": "结算金额",
|
||||
"iState": "结算计划状态"
|
||||
"iState": "结算计划状态",
|
||||
"settledAt": "结算时间",
|
||||
"closedAt": "关闭时间"
|
||||
},
|
||||
"action": {
|
||||
"settle": "结算",
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ const triggers = [
|
|||
asRoot: true,
|
||||
priority: 99,
|
||||
fn: async ({ operation }, context, option) => {
|
||||
const { filter } = operation;
|
||||
const { filter, data } = operation;
|
||||
const settlePlans = await context.select('settlePlan', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -122,6 +122,15 @@ const triggers = [
|
|||
}, option);
|
||||
}
|
||||
}
|
||||
//为settlePlan赋上settledAt
|
||||
if (data instanceof Array) {
|
||||
for (const d of data) {
|
||||
d.settledAt = now;
|
||||
}
|
||||
}
|
||||
else {
|
||||
data.settledAt = now;
|
||||
}
|
||||
return settlePlans.length;
|
||||
},
|
||||
},
|
||||
|
|
@ -179,7 +188,7 @@ const triggers = [
|
|||
asRoot: true,
|
||||
priority: 99,
|
||||
fn: async ({ operation }, context, option) => {
|
||||
const { filter } = operation;
|
||||
const { filter, data } = operation;
|
||||
const settlePlans = await context.select('settlePlan', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -218,6 +227,15 @@ const triggers = [
|
|||
}
|
||||
}, option);
|
||||
}
|
||||
//为settlePlan赋上closedAt
|
||||
if (data instanceof Array) {
|
||||
for (const d of data) {
|
||||
d.closedAt = now;
|
||||
}
|
||||
}
|
||||
else {
|
||||
data.closedAt = now;
|
||||
}
|
||||
return settlePlans.length;
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ export interface Schema extends EntityShape {
|
|||
when?: Datetime;
|
||||
order: Order;
|
||||
price: Price;
|
||||
settledAt?: Datetime;
|
||||
closedAt?: Datetime;
|
||||
};
|
||||
|
||||
type IState = 'unsettled' | 'settled' | 'closed';
|
||||
|
|
@ -36,6 +38,8 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
order: '订单',
|
||||
price: '结算金额',
|
||||
iState: '结算计划状态',
|
||||
settledAt: '结算时间',
|
||||
closedAt: '关闭时间'
|
||||
},
|
||||
action: {
|
||||
settle: '结算',
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ const triggers: Trigger<EntityDict, 'settlePlan', BRC>[] = [
|
|||
asRoot: true,
|
||||
priority: 99,
|
||||
fn: async ({ operation }, context, option) => {
|
||||
const { filter } = operation;
|
||||
const { filter, data } = operation;
|
||||
const settlePlans = await context.select('settlePlan', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -126,6 +126,14 @@ const triggers: Trigger<EntityDict, 'settlePlan', BRC>[] = [
|
|||
}, option);
|
||||
}
|
||||
}
|
||||
//为settlePlan赋上settledAt
|
||||
if (data instanceof Array) {
|
||||
for (const d of data) {
|
||||
d.settledAt = now;
|
||||
}
|
||||
} else {
|
||||
data.settledAt = now;
|
||||
}
|
||||
return settlePlans.length;
|
||||
},
|
||||
},
|
||||
|
|
@ -185,7 +193,7 @@ const triggers: Trigger<EntityDict, 'settlePlan', BRC>[] = [
|
|||
asRoot: true,
|
||||
priority: 99,
|
||||
fn: async ({ operation }, context, option) => {
|
||||
const { filter } = operation;
|
||||
const { filter, data } = operation;
|
||||
const settlePlans = await context.select('settlePlan', {
|
||||
data: {
|
||||
id: 1,
|
||||
|
|
@ -224,6 +232,14 @@ const triggers: Trigger<EntityDict, 'settlePlan', BRC>[] = [
|
|||
}
|
||||
}, option);
|
||||
}
|
||||
//为settlePlan赋上closedAt
|
||||
if (data instanceof Array) {
|
||||
for (const d of data) {
|
||||
d.closedAt = now;
|
||||
}
|
||||
} else {
|
||||
data.closedAt = now;
|
||||
}
|
||||
return settlePlans.length;
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
-- settlePlan --
|
||||
ALTER TABLE `settlePlan` ADD COLUMN `settledAt` bigint NULL DEFAULT NULL;
|
||||
ALTER TABLE `settlePlan` ADD COLUMN `closedAt` bigint NULL DEFAULT NULL;
|
||||
Loading…
Reference in New Issue