gm-mcp 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/services/lending.service.d.ts +9 -4
- package/dist/services/lending.service.js +4 -3
- package/dist/services/types/index.d.ts +1 -0
- package/dist/services/types/index.js +1 -0
- package/dist/services/types/lending.type.d.ts +3 -0
- package/dist/services/types/response.d.ts +10 -0
- package/dist/services/types/response.js +2 -0
- package/dist/tools/statistic-x3.js +5 -5
- package/package.json +2 -2
- package/src/index.ts +3 -3
- package/src/services/lending.service.ts +6 -6
- package/src/services/types/index.ts +1 -0
- package/src/services/types/lending.type.ts +4 -0
- package/src/services/types/response.ts +10 -0
- package/src/tools/statistic-x3.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -36,8 +36,8 @@ exports.server.tool("statistic_salary_x3_yesterday", "Get statistic salary x3 ye
|
|
|
36
36
|
exports.server.tool("statistic_salary_x3_this_week", "Get statistic salary x3 this week", {}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
return (0, tools_1.statisticX3WeekTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK });
|
|
38
38
|
}));
|
|
39
|
-
exports.server.tool("statistic_salary_x3_month", `Get statistic salary x3 with month
|
|
40
|
-
month: zod_1.default.string().describe("Month to statistic"),
|
|
39
|
+
exports.server.tool("statistic_salary_x3_month", `Get statistic salary x3 with month`, {
|
|
40
|
+
month: zod_1.default.string().describe("Month to statistic, month must be represented with format MM/yyyy"),
|
|
41
41
|
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
return (0, tools_1.statisticX3MonthTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK, month: args.month });
|
|
43
43
|
}));
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { GimoLending } from "./types";
|
|
1
|
+
import { ApiResponseBase, GimoLending } from "./types";
|
|
2
2
|
export declare function listApplication(p: GimoLending.FilterApplication): Promise<{
|
|
3
3
|
content: GimoLending.Application[];
|
|
4
4
|
size: number;
|
|
5
5
|
total_elements: number;
|
|
6
6
|
total_pages: number;
|
|
7
7
|
}>;
|
|
8
|
-
export declare function statisticLoan(p: GimoLending.FilterLoan): Promise<
|
|
8
|
+
export declare function statisticLoan(p: GimoLending.FilterLoan): Promise<{
|
|
9
|
+
loan_instance_list_statistics: GimoLending.LoanStatistic;
|
|
10
|
+
loan_instance_list_data: ApiResponseBase<GimoLending.Loan>;
|
|
11
|
+
}>;
|
|
9
12
|
export declare function statisticX3(p: GimoLending.FilterApplication): Promise<{
|
|
10
13
|
total: number;
|
|
11
14
|
total_appraisal: number;
|
|
@@ -14,6 +17,8 @@ export declare function statisticX3(p: GimoLending.FilterApplication): Promise<{
|
|
|
14
17
|
total_rejected: number;
|
|
15
18
|
total_signed: number;
|
|
16
19
|
total_closed: number;
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
loan_statistic: {
|
|
21
|
+
loan_instance_list_statistics: GimoLending.LoanStatistic;
|
|
22
|
+
loan_instance_list_data: ApiResponseBase<GimoLending.Loan>;
|
|
23
|
+
};
|
|
19
24
|
}>;
|
|
@@ -54,7 +54,7 @@ function statisticLoan(p) {
|
|
|
54
54
|
},
|
|
55
55
|
params: Object.assign(Object.assign({}, p), { sort: "created_at,DESC" }),
|
|
56
56
|
})
|
|
57
|
-
.then((res) => res.data.result
|
|
57
|
+
.then((res) => res.data.result);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
function statisticX3(p) {
|
|
@@ -76,7 +76,9 @@ function statisticX3(p) {
|
|
|
76
76
|
const total_rejected = applications.filter((item) => item.status === types_1.GimoLending.LendingApplicationStatus.REJECTED).length;
|
|
77
77
|
const total_signed = applications.filter((item) => item.status === types_1.GimoLending.LendingApplicationStatus.SIGNED).length;
|
|
78
78
|
const total_closed = applications.filter((item) => item.status === types_1.GimoLending.LendingApplicationStatus.CLOSED).length;
|
|
79
|
-
const total_dibursed = applications.filter(
|
|
79
|
+
// const total_dibursed = applications.filter(
|
|
80
|
+
// (item) => item.disbursement_status === GimoLending.LoanDisbursementStatus.DISBURSED
|
|
81
|
+
// ).length;
|
|
80
82
|
return {
|
|
81
83
|
total: total_elements,
|
|
82
84
|
total_appraisal,
|
|
@@ -85,7 +87,6 @@ function statisticX3(p) {
|
|
|
85
87
|
total_rejected,
|
|
86
88
|
total_signed,
|
|
87
89
|
total_closed,
|
|
88
|
-
total_dibursed,
|
|
89
90
|
loan_statistic,
|
|
90
91
|
};
|
|
91
92
|
}
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./gimo.type"), exports);
|
|
18
18
|
__exportStar(require("./lending.type"), exports);
|
|
19
|
+
__exportStar(require("./response"), exports);
|
|
@@ -307,7 +307,7 @@ function statisticX3ThisMonthTool(options) {
|
|
|
307
307
|
}
|
|
308
308
|
function _statisticX3(p) {
|
|
309
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
310
|
-
var _a, _b, _c;
|
|
310
|
+
var _a, _b, _c, _d, _e, _f;
|
|
311
311
|
const { created_from, created_to } = p;
|
|
312
312
|
const res = yield (0, lending_service_1.statisticX3)({
|
|
313
313
|
created_to,
|
|
@@ -318,7 +318,7 @@ function _statisticX3(p) {
|
|
|
318
318
|
`<br>`,
|
|
319
319
|
`Số đơn chờ duyệt: ${res.total_appraisal || "0"}`,
|
|
320
320
|
`<br>`,
|
|
321
|
-
`Số đơn được giải ngân: ${res.
|
|
321
|
+
`Số đơn được giải ngân: ${res.loan_statistic.loan_instance_list_data.total_elements || "0"}`,
|
|
322
322
|
`<hr>`,
|
|
323
323
|
`Số đơn bị từ chối: ${res.total_rejected || "0"}`,
|
|
324
324
|
`<br>`,
|
|
@@ -326,11 +326,11 @@ function _statisticX3(p) {
|
|
|
326
326
|
`<hr>`,
|
|
327
327
|
// `Tỷ lê đơn đơn được giải ngân/được duyệt: ${distributedOverApproval}%`,
|
|
328
328
|
// `<hr>`,
|
|
329
|
-
`Tổng đã giải ngân: ${(0, helpers_1.formatCurrency)((_a = res.loan_statistic) === null || _a === void 0 ? void 0 : _a.total_disbursement_amount) || "0"}`,
|
|
329
|
+
`Tổng đã giải ngân: ${(0, helpers_1.formatCurrency)((_b = (_a = res.loan_statistic) === null || _a === void 0 ? void 0 : _a.loan_instance_list_statistics) === null || _b === void 0 ? void 0 : _b.total_disbursement_amount) || "0"}`,
|
|
330
330
|
`<br>`,
|
|
331
|
-
`Tổng phải trả: ${(0, helpers_1.formatCurrency)((
|
|
331
|
+
`Tổng phải trả: ${(0, helpers_1.formatCurrency)((_d = (_c = res.loan_statistic) === null || _c === void 0 ? void 0 : _c.loan_instance_list_statistics) === null || _d === void 0 ? void 0 : _d.total_payment_amount) || "0"}`,
|
|
332
332
|
`<br>`,
|
|
333
|
-
`Tổng lãi phải trả: ${(0, helpers_1.formatCurrency)((
|
|
333
|
+
`Tổng lãi phải trả: ${(0, helpers_1.formatCurrency)((_f = (_e = res.loan_statistic) === null || _e === void 0 ? void 0 : _e.loan_instance_list_statistics) === null || _f === void 0 ? void 0 : _f.total_interest_amount) || "0"}`,
|
|
334
334
|
];
|
|
335
335
|
return { message: messageContent.join(""), statisticData: res };
|
|
336
336
|
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -39,9 +39,9 @@ server.tool("statistic_salary_x3_this_week", "Get statistic salary x3 this week"
|
|
|
39
39
|
|
|
40
40
|
server.tool(
|
|
41
41
|
"statistic_salary_x3_month",
|
|
42
|
-
`Get statistic salary x3 with month
|
|
43
|
-
{
|
|
44
|
-
month: z.string().describe("Month to statistic"),
|
|
42
|
+
`Get statistic salary x3 with month`,
|
|
43
|
+
{
|
|
44
|
+
month: z.string().describe("Month to statistic, month must be represented with format MM/yyyy"),
|
|
45
45
|
},
|
|
46
46
|
async (args) => {
|
|
47
47
|
return statisticX3MonthTool({ sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK, month: args.month });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { getEnv } from "../env";
|
|
3
|
-
import { Gimo, GimoLending } from "./types";
|
|
3
|
+
import { ApiResponseBase, Gimo, GimoLending } from "./types";
|
|
4
4
|
|
|
5
5
|
async function getAccessToken() {
|
|
6
6
|
const url = `${getEnv().DASH_URL}/api/v1/auth/admin/login`;
|
|
@@ -42,6 +42,7 @@ export async function statisticLoan(p: GimoLending.FilterLoan) {
|
|
|
42
42
|
.get<{
|
|
43
43
|
result: {
|
|
44
44
|
loan_instance_list_statistics: GimoLending.LoanStatistic;
|
|
45
|
+
loan_instance_list_data: ApiResponseBase<GimoLending.Loan>;
|
|
45
46
|
};
|
|
46
47
|
}>(url, {
|
|
47
48
|
headers: {
|
|
@@ -52,7 +53,7 @@ export async function statisticLoan(p: GimoLending.FilterLoan) {
|
|
|
52
53
|
sort: "created_at,DESC",
|
|
53
54
|
},
|
|
54
55
|
})
|
|
55
|
-
.then((res) => res.data.result
|
|
56
|
+
.then((res) => res.data.result);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export async function statisticX3(p: GimoLending.FilterApplication) {
|
|
@@ -86,9 +87,9 @@ export async function statisticX3(p: GimoLending.FilterApplication) {
|
|
|
86
87
|
(item) => item.status === GimoLending.LendingApplicationStatus.CLOSED
|
|
87
88
|
).length;
|
|
88
89
|
|
|
89
|
-
const total_dibursed = applications.filter(
|
|
90
|
-
|
|
91
|
-
).length;
|
|
90
|
+
// const total_dibursed = applications.filter(
|
|
91
|
+
// (item) => item.disbursement_status === GimoLending.LoanDisbursementStatus.DISBURSED
|
|
92
|
+
// ).length;
|
|
92
93
|
|
|
93
94
|
return {
|
|
94
95
|
total: total_elements,
|
|
@@ -98,7 +99,6 @@ export async function statisticX3(p: GimoLending.FilterApplication) {
|
|
|
98
99
|
total_rejected,
|
|
99
100
|
total_signed,
|
|
100
101
|
total_closed,
|
|
101
|
-
total_dibursed,
|
|
102
102
|
loan_statistic,
|
|
103
103
|
};
|
|
104
104
|
} catch (error) {
|
|
@@ -360,7 +360,7 @@ async function _statisticX3(p: {
|
|
|
360
360
|
`<br>`,
|
|
361
361
|
`Số đơn chờ duyệt: ${res.total_appraisal || "0"}`,
|
|
362
362
|
`<br>`,
|
|
363
|
-
`Số đơn được giải ngân: ${res.
|
|
363
|
+
`Số đơn được giải ngân: ${res.loan_statistic.loan_instance_list_data.total_elements || "0"}`,
|
|
364
364
|
`<hr>`,
|
|
365
365
|
`Số đơn bị từ chối: ${res.total_rejected || "0"}`,
|
|
366
366
|
`<br>`,
|
|
@@ -368,11 +368,11 @@ async function _statisticX3(p: {
|
|
|
368
368
|
`<hr>`,
|
|
369
369
|
// `Tỷ lê đơn đơn được giải ngân/được duyệt: ${distributedOverApproval}%`,
|
|
370
370
|
// `<hr>`,
|
|
371
|
-
`Tổng đã giải ngân: ${formatCurrency(res.loan_statistic?.total_disbursement_amount) || "0"}`,
|
|
371
|
+
`Tổng đã giải ngân: ${formatCurrency(res.loan_statistic?.loan_instance_list_statistics?.total_disbursement_amount) || "0"}`,
|
|
372
372
|
`<br>`,
|
|
373
|
-
`Tổng phải trả: ${formatCurrency(res.loan_statistic?.total_payment_amount) || "0"}`,
|
|
373
|
+
`Tổng phải trả: ${formatCurrency(res.loan_statistic?.loan_instance_list_statistics?.total_payment_amount) || "0"}`,
|
|
374
374
|
`<br>`,
|
|
375
|
-
`Tổng lãi phải trả: ${formatCurrency(res.loan_statistic?.total_interest_amount) || "0"}`,
|
|
375
|
+
`Tổng lãi phải trả: ${formatCurrency(res.loan_statistic?.loan_instance_list_statistics?.total_interest_amount) || "0"}`,
|
|
376
376
|
];
|
|
377
377
|
return { message: messageContent.join(""), statisticData: res };
|
|
378
378
|
}
|