Compare commits

..

No commits in common. "fea0420ae43a3628b280f4086a4cb88e8b4526c9" and "ce1aa869446bdeaf5b05486f111469b716190935" have entirely different histories.

6 changed files with 7 additions and 44 deletions

View File

@ -34,7 +34,6 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
return [
`${this.tableName}.id`,
`${this.tableName}.image_url`,
`${this.tableName}.video_url`,
`${this.tableName}.created_at`,
`${this.tableName}.status`,
`${this.tableName}.item_type`,

View File

@ -4,8 +4,9 @@ import { EventTopics } from 'src/core/strings/constants/interface.constants';
import { TransactionType } from 'src/modules/transaction/transaction/constants';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
import { TransactionEntity } from 'src/modules/transaction/transaction/domain/entities/transaction.entity';
import { Brackets, DeleteQueryBuilder, IsNull, MoreThan, Not } from 'typeorm';
import { Between, IsNull, MoreThan, Not } from 'typeorm';
import * as _ from 'lodash';
import * as moment from 'moment';
import { EMPTY_UUID, STATUS } from 'src/core/strings/constants/base.constants';
import { RecapReconciliationDto } from '../../../infrastructure/dto/recap.dto';
@ -57,11 +58,11 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
} = transaction;
const group_by =
creator_counter_no +
'|' +
'-' +
payment_type_counter +
'|' +
'-' +
payment_type_method_id +
'|' +
'_' +
payment_date;
if (!this.recapTransactions[group_by]) {
@ -76,38 +77,6 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
async process(): Promise<void> {
const total_recap = Object.keys(this.recapTransactions);
const deleteQuery: DeleteQueryBuilder<TransactionEntity> = this.dataService
.getRepository()
.createQueryBuilder(this.tableName)
.delete();
deleteQuery.where(
`payment_date = :payment_date and is_recap_transaction = true`,
{
payment_date: this.paymentDate,
},
);
deleteQuery.andWhere(
new Brackets((qb) => {
for (const condition of total_recap) {
const [
creator_counter_no,
payment_type_counter,
payment_type_method_id,
] = condition.split('|');
const whereMethodId =
payment_type_method_id == 'null'
? 'IS NULL'
: `= '${payment_type_method_id}'`;
qb.andWhere(
`NOT (creator_counter_no = '${creator_counter_no}' AND payment_type_counter = '${payment_type_counter}' AND payment_type_method_id ${whereMethodId})`,
);
}
}),
);
await deleteQuery.execute();
for (const recap of total_recap) {
const first_transaction = this.recapTransactions[recap][0];

View File

@ -126,9 +126,6 @@ export class PriceCalculator {
let result = null;
try {
if (!formula) {
break;
}
result = math.evaluate(formula.formula_string, values);
calledVariable = [];
} catch (error) {

View File

@ -191,7 +191,7 @@ export function mappingRevertTransaction(data, type) {
const bundlingTotalPrice =
(item.item?.bundling_items?.reduce(
(a, b) => a + Number(b.item_rates || b.base_price),
(a, b) => a + Number(b.item_rates ?? b.base_price),
0,
) ?? 0) * +item.qty;
const totalAndBundlingRatio = total_price / bundlingTotalPrice;
@ -199,7 +199,7 @@ export function mappingRevertTransaction(data, type) {
if (bundling.total_net_price) return bundling;
const basePrice =
(bundling.item_rates || bundling.base_price) *
(bundling.item_rates ?? bundling.base_price) *
+item.qty *
totalAndBundlingRatio;
const discount = discountPercent * basePrice;

View File

@ -35,7 +35,6 @@ export class DetailVipCategoryManager extends BaseDetailManager<VipCategoryEntit
`${this.tableName}.id`,
`${this.tableName}.status`,
`${this.tableName}.name`,
`${this.tableName}.has_vip_pass`,
`${this.tableName}.created_at`,
`${this.tableName}.updated_at`,
`${this.tableName}.creator_name`,

View File

@ -39,7 +39,6 @@ export class IndexVipCategoryManager extends BaseIndexManager<VipCategoryEntity>
`${this.tableName}.id`,
`${this.tableName}.status`,
`${this.tableName}.name`,
`${this.tableName}.has_vip_pass`,
`${this.tableName}.created_at`,
`${this.tableName}.updated_at`,
`${this.tableName}.creator_name`,