gemcap-be-common 1.5.195 → 1.5.196
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/package.json
CHANGED
|
@@ -16,13 +16,13 @@ class LoanStatementEffectsService {
|
|
|
16
16
|
this.monthEndDataService = monthEndDataService;
|
|
17
17
|
}
|
|
18
18
|
async saveMonthData(productId, statementDate) {
|
|
19
|
-
|
|
19
|
+
const date = dayjs_1.default.utc(statementDate);
|
|
20
|
+
if (date.date() !== 1) {
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const year = (0, dayjs_1.default)(statementDate).subtract(1, 'd').year();
|
|
23
|
+
const monthEndDate = date.subtract(1, 'day').endOf('day');
|
|
24
|
+
const balance = await (0, loan_products_db_1.getLoanProductBalance)(productId, monthEndDate.toDate());
|
|
25
|
+
const lastTransaction = await this.loanStatementBalanceService.getLastStatementTransactionForDate(productId, monthEndDate.toDate());
|
|
26
26
|
const keptData = {
|
|
27
27
|
[MonthEndData_Model_1.EMonthEndDataType.BALANCE]: balance?.balance ?? 0,
|
|
28
28
|
[MonthEndData_Model_1.EMonthEndDataType.FLOATED_BALANCE]: balance?.floatedBalance ?? 0,
|
|
@@ -31,8 +31,8 @@ class LoanStatementEffectsService {
|
|
|
31
31
|
await Promise.all(Object.entries(keptData).map(async ([dataType, dataValue]) => {
|
|
32
32
|
await this.monthEndDataService.upsertMonthEndData({
|
|
33
33
|
productId: new mongoose_1.default.Types.ObjectId(productId),
|
|
34
|
-
year,
|
|
35
|
-
month,
|
|
34
|
+
year: monthEndDate.year(),
|
|
35
|
+
month: monthEndDate.month() + 1,
|
|
36
36
|
dataType: dataType,
|
|
37
37
|
dataValue,
|
|
38
38
|
});
|
|
@@ -15,13 +15,13 @@ export class LoanStatementEffectsService {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async saveMonthData(productId: string, statementDate: Date) {
|
|
18
|
-
|
|
18
|
+
const date = dayjs.utc(statementDate);
|
|
19
|
+
if (date.date() !== 1) {
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const year = dayjs(statementDate).subtract(1, 'd').year();
|
|
22
|
+
const monthEndDate = date.subtract(1, 'day').endOf('day');
|
|
23
|
+
const balance = await getLoanProductBalanceDB(productId, monthEndDate.toDate());
|
|
24
|
+
const lastTransaction = await this.loanStatementBalanceService.getLastStatementTransactionForDate(productId, monthEndDate.toDate());
|
|
25
25
|
|
|
26
26
|
const keptData = {
|
|
27
27
|
[EMonthEndDataType.BALANCE]: balance?.balance ?? 0,
|
|
@@ -31,8 +31,8 @@ export class LoanStatementEffectsService {
|
|
|
31
31
|
await Promise.all(Object.entries(keptData).map(async ([dataType, dataValue]) => {
|
|
32
32
|
await this.monthEndDataService.upsertMonthEndData({
|
|
33
33
|
productId: new mongoose.Types.ObjectId(productId),
|
|
34
|
-
year,
|
|
35
|
-
month,
|
|
34
|
+
year: monthEndDate.year(),
|
|
35
|
+
month: monthEndDate.month() + 1,
|
|
36
36
|
dataType: dataType as EMonthEndDataType,
|
|
37
37
|
dataValue,
|
|
38
38
|
});
|