Merged PR 849: 有効なアカウント内の削除されたユーザーの割り当て履歴が集計されない

## 概要
[Task3929: 有効なアカウント内の削除されたユーザーの割り当て履歴が集計されない](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3929)

- 元PBI or タスクへのリンク(内容・目的などはそちらにあるはず)
- 何をどう変更したか、追加したライブラリなど
- このPull Requestでの対象/対象外
- 影響範囲(他の機能にも影響があるか)

## レビューポイント
- 特にレビューしてほしい箇所
- 軽微なものや自明なものは記載不要
- 修正範囲が大きい場合などに記載
- 全体的にや仕様を満たしているか等は本当に必要な時のみ記載

## UIの変更
- Before/Afterのスクショなど
- スクショ置き場

## 動作確認状況
- ローカルで確認、develop環境で確認など

## 補足
- 相談、参考資料などがあれば
This commit is contained in:
maruyama.t 2024-03-15 12:19:16 +00:00
parent f80912c617
commit cab7a75ec1
7 changed files with 1814 additions and 232 deletions

View File

@ -382,18 +382,26 @@ function compareCardLicenses(
}
*/
const formattedActivated = getFormattedDate(
filterdCardLicenses[0].activated_at,
`yyyy/MM/dd hh:mm:ss`
const formattedFileActivated = getFormattedDate(
cardlicensesInputFile.activated_at
? new Date(cardlicensesInputFile.activated_at)
: null,
`yyyy/MM/dd hh:mm:ss`,
true
);
if (cardlicensesInputFile.activated_at !== formattedActivated) {
const formattedDbActivated = getFormattedDate(
filterdCardLicenses[0].activated_at,
`yyyy/MM/dd hh:mm:ss`,
true
);
if (formattedFileActivated !== formattedDbActivated) {
const VerificationResultDetailsOne: VerificationResultDetails = {
input: "cardLicenses",
inputRow: row,
diffTargetTable: "cardLicenses",
columnName: "activated_at",
fileData: cardlicensesInputFile.activated_at,
databaseData: formattedActivated,
fileData: formattedFileActivated,
databaseData: formattedDbActivated,
reason: "内容不一致",
};
VerificationResultDetails.push(VerificationResultDetailsOne);
@ -574,7 +582,13 @@ function compareLicenses(
// expiry_dateについて、時はゼロパディングした値で比較する×0109 ○19
if (
!licensesFromDatabase[i] ||
licensesFromFile[i].expired_date !==
getFormattedDate(
licensesFromFile[i].expired_date
? new Date(licensesFromFile[i].expired_date)
: null,
`yyyy/MM/dd hh:mm:ss`,
true
) !==
getFormattedDate(
licensesFromDatabase[i].expiry_date,
`yyyy/MM/dd hh:mm:ss`,
@ -586,7 +600,13 @@ function compareLicenses(
inputRow: licensesFromFile[i].row,
diffTargetTable: "licenses",
columnName: "expired_date",
fileData: licensesFromFile[i].expired_date,
fileData: getFormattedDate(
licensesFromFile[i].expired_date
? new Date(licensesFromFile[i].expired_date)
: null,
`yyyy/MM/dd hh:mm:ss`,
true
),
databaseData: licensesFromDatabase[i]
? getFormattedDate(
licensesFromDatabase[i].expiry_date,

View File

@ -154,7 +154,7 @@
"status": "Status",
"expiration": "Verfallsdatum",
"remaining": "Verbleibender Zeitraum",
"autoRenew": "Automatische Erneuerung",
"autoRenew": "Automatisch zuweisen",
"licenseAlert": "Lizenzalarm",
"notification": "Benachrichtigung",
"users": "Benutzer",
@ -436,7 +436,7 @@
"templateOptional": "Vorlage (Optional)",
"editRule": "Regel bearbeiten",
"selected": "Ausgewählter transkriptionist",
"pool": "Liste der Transkriptionisten",
"pool": "Transkriptionsliste",
"selectAuthor": "Autoren-ID auswählen",
"selectWorktypeId": "Aufgabentypkennung auswählen",
"selectTemplate": "Vorlage auswählen"
@ -456,7 +456,7 @@
"addTypistGroup": "Transkriptionist Gruppe hinzufügen",
"transcriptionist": "Transkriptionist",
"selected": "Ausgewählter transkriptionist",
"pool": "Liste der Transkriptionisten",
"pool": "Transkriptionsliste",
"add": "Hinzufügen",
"remove": "Entfernen",
"editTypistGroup": "Transkriptionistengruppe bearbeiten"

View File

@ -154,7 +154,7 @@
"status": "Status",
"expiration": "Expiration Date",
"remaining": "Remaining Period",
"autoRenew": "Auto Renew",
"autoRenew": "Auto Assign",
"licenseAlert": "License Alert",
"notification": "Notification",
"users": "Users",
@ -436,7 +436,7 @@
"templateOptional": "Template (Optional)",
"editRule": "Edit Rule",
"selected": "Selected Transcriptionist",
"pool": "Transcriptionist List",
"pool": "Transcription List",
"selectAuthor": "Select Author ID",
"selectWorktypeId": "Select Worktype ID",
"selectTemplate": "Select Template"
@ -456,7 +456,7 @@
"addTypistGroup": "Add Transcriptionist Group",
"transcriptionist": "Transcriptionist",
"selected": "Selected Transcriptionist",
"pool": "Transcriptionist List",
"pool": "Transcription List",
"add": "Add",
"remove": "Remove",
"editTypistGroup": "Edit Transcriptionist Group"

View File

@ -154,7 +154,7 @@
"status": "Estado",
"expiration": "Fecha de caducidad",
"remaining": "Período restante",
"autoRenew": "Renovación Automática",
"autoRenew": "Asignación automática",
"licenseAlert": "Alerta de licencia",
"notification": "Notificación",
"users": "Usuarios",
@ -436,7 +436,7 @@
"templateOptional": "Plantilla (Opcional)",
"editRule": "Editar regla",
"selected": "Transcriptor seleccionado",
"pool": "Lista de transcriptores",
"pool": "Lista de transcriptor",
"selectAuthor": "Seleccionar ID de autor",
"selectWorktypeId": "Seleccionar ID de tipo de trabajo",
"selectTemplate": "Seleccionar Plantilla"
@ -456,7 +456,7 @@
"addTypistGroup": "Agregar grupo transcriptor",
"transcriptionist": "Transcriptor",
"selected": "Transcriptor seleccionado",
"pool": "Lista de transcriptores",
"pool": "Lista de transcriptor",
"add": "Añadir",
"remove": "Eliminar",
"editTypistGroup": "Editar grupo transcriptor"

View File

@ -154,7 +154,7 @@
"status": "État",
"expiration": "Date d'expiration",
"remaining": "Période restante",
"autoRenew": "Renouvellement automatique",
"autoRenew": "Assignation automatique",
"licenseAlert": "Alerte de licence",
"notification": "Notification",
"users": "Utilisateurs",
@ -436,7 +436,7 @@
"templateOptional": "Masque (Facultatif)",
"editRule": "Modifier la règle",
"selected": "Transcriptionniste sélectionné",
"pool": "Liste des transcripteurs",
"pool": "Liste de transcriptionniste",
"selectAuthor": "Sélectionner le Identifiant Auteur",
"selectWorktypeId": "Sélectionner le Identifiant du Type de travail",
"selectTemplate": "Sélectionner le Masque"
@ -456,7 +456,7 @@
"addTypistGroup": "Ajouter un groupe de transcripteurs",
"transcriptionist": "Transcriptionniste",
"selected": "Transcriptionniste sélectionné",
"pool": "Liste des transcripteurs",
"pool": "Liste de transcriptionniste",
"add": "Ajouter",
"remove": "Supprimer",
"editTypistGroup": "Modifier le groupe de transcripteurs"

View File

@ -27,6 +27,7 @@ import {
} from "../constants";
import { DateWithDayEndTime } from "../common/types/types";
import { initializeDataSource } from "../database/initializeDataSource";
import { bigintTransformer } from "../common/entity";
/**
*
@ -166,8 +167,11 @@ export async function getBaseData(
);
const switchedlicensesInTargetMonth = await licenseAllocationHistory
.createQueryBuilder("licenseAllocationHistory")
.innerJoinAndSelect("licenseAllocationHistory.user", "user")
.innerJoin("user.account", "account")
.innerJoin(
"accounts",
"account",
"licenseAllocationHistory.account_id = account.id"
)
.where("account.tier = :tier", { tier: TIERS.TIER5 })
.andWhere("licenseAllocationHistory.switch_from_type IN (:...types)", {
types: [SWITCH_FROM_TYPE.CARD, SWITCH_FROM_TYPE.TRIAL],
@ -408,10 +412,6 @@ export async function transferData(
targetMonthYYYYMM: string
): Promise<outputDataAnalysisLicensesCSV> {
context.log("[IN]transferData");
class userIdAndRoles {
id: number;
role: string;
}
const accountsAndUsersFromTier5 = baseData.accountsAndUsersFromTier5;
const validLicenses = baseData.avairableLicenses;
const currentMonthIssuedLicenses = baseData.licensesIssuedInTargetMonth;
@ -448,7 +448,7 @@ export async function transferData(
outputDataAU.push(...header);
// ユーザーIDとロールを格納する配列型が違う為新たに作成する
let tier5userIdAndRoles: userIdAndRoles[] = [];
let tier5userIdAndRoles: { id: number; role: string }[] = [];
try {
// 第五階層のアカウントごとにループ
for (const account of accountsAndUsersFromTier5) {
@ -464,13 +464,20 @@ export async function transferData(
// ユーザーとユーザーアーカイブからユーザーIDとロールを取得する
if (account.user) {
tier5userIdAndRoles = account.user.map((user) => {
return { id: user.id, role: user.role };
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
return { id: bigintTransformer.from(user.id), role: user.role };
});
}
if (account.userArchive) {
tier5userIdAndRoles = tier5userIdAndRoles.concat(
account.userArchive.map((userArchive) => {
return { id: userArchive.id, role: userArchive.role };
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
return {
id: bigintTransformer.from(userArchive.id),
role: userArchive.role,
};
})
);
}
@ -735,40 +742,59 @@ export async function transferData(
(license) =>
tier5userIdAndRoles.find(
(user) =>
user.id === license.user_id && user.role === USER_ROLES.TYPIST
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
user.id === bigintTransformer.from(license.user_id) &&
user.role === USER_ROLES.TYPIST
)
);
const switchedTypistLicensesAuthor = switchedTrialLicenses.filter(
(license) =>
tier5userIdAndRoles.find(
(user) =>
user.id === license.user_id && user.role === USER_ROLES.AUTHOR
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
user.id === bigintTransformer.from(license.user_id) &&
user.role === USER_ROLES.AUTHOR
)
);
const switchedTypistLicensesNone = switchedTrialLicenses.filter(
(license) =>
tier5userIdAndRoles.find(
(user) =>
user.id === license.user_id && user.role === USER_ROLES.NONE
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
user.id === bigintTransformer.from(license.user_id) &&
user.role === USER_ROLES.NONE
)
);
const switchedCardLicensesTypist = switchedCardLicenses.filter(
(license) =>
tier5userIdAndRoles.find(
(user) =>
user.id === license.user_id && user.role === USER_ROLES.TYPIST
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
user.id === bigintTransformer.from(license.user_id) &&
user.role === USER_ROLES.TYPIST
)
);
const switchedCardLicensesAuthor = switchedCardLicenses.filter(
(license) =>
tier5userIdAndRoles.find(
(user) =>
user.id === license.user_id && user.role === USER_ROLES.AUTHOR
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
user.id === bigintTransformer.from(license.user_id) &&
user.role === USER_ROLES.AUTHOR
)
);
const switchedCardLicensesNone = switchedCardLicenses.filter((license) =>
tier5userIdAndRoles.find(
(user) => user.id === license.user_id && user.role === USER_ROLES.NONE
(user) =>
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
user.id === bigintTransformer.from(license.user_id) &&
user.role === USER_ROLES.NONE
)
);
// 切り替えライセンスの数をカウント
@ -920,7 +946,12 @@ export async function transferData(
// アカウントに紐づくユーザーを取得
if (account.userArchive) {
tier5userIdAndRoles = account.userArchive.map((userArchive) => {
return { id: userArchive.id, role: userArchive.role };
return {
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
id: bigintTransformer.from(userArchive.id),
role: userArchive.role,
};
});
}
// アカウントに紐づくライセンスを取得
@ -1159,33 +1190,51 @@ export async function transferData(
//Typist・Author・None
const switchedTypistLicensesTypist = switchedTrialLicenses.filter(
(license) =>
tier5userIdAndRoles?.find((user) => user.id === license.user_id)
?.role === USER_ROLES.TYPIST
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
tier5userIdAndRoles?.find(
(user) => user.id === bigintTransformer.from(license.user_id)
)?.role === USER_ROLES.TYPIST
);
const switchedTypistLicensesAuthor = switchedTrialLicenses.filter(
(license) =>
tier5userIdAndRoles?.find((user) => user.id === license.user_id)
?.role === USER_ROLES.AUTHOR
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
tier5userIdAndRoles?.find(
(user) => user.id === bigintTransformer.from(license.user_id)
)?.role === USER_ROLES.AUTHOR
);
const switchedTypistLicensesNone = switchedTrialLicenses.filter(
(license) =>
tier5userIdAndRoles?.find((user) => user.id === license.user_id)
?.role === USER_ROLES.NONE
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
tier5userIdAndRoles?.find(
(user) => user.id === bigintTransformer.from(license.user_id)
)?.role === USER_ROLES.NONE
);
const switchedCardLicensesTypist = switchedCardLicenses.filter(
(license) =>
tier5userIdAndRoles?.find((user) => user.id === license.user_id)
?.role === USER_ROLES.TYPIST
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
tier5userIdAndRoles?.find(
(user) => user.id === bigintTransformer.from(license.user_id)
)?.role === USER_ROLES.TYPIST
);
const switchedCardLicensesAuthor = switchedCardLicenses.filter(
(license) =>
tier5userIdAndRoles?.find((user) => user.id === license.user_id)
?.role === USER_ROLES.AUTHOR
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
tier5userIdAndRoles?.find(
(user) => user.id === bigintTransformer.from(license.user_id)
)?.role === USER_ROLES.AUTHOR
);
const switchedCardLicensesNone = switchedCardLicenses.filter(
(license) =>
tier5userIdAndRoles?.find((user) => user.id === license.user_id)
?.role === USER_ROLES.NONE
// XXX entityを修正すべきだが、時期的に影響範囲が大きいため、ここで変換する
// 本対応は#3928で行う
tier5userIdAndRoles?.find(
(user) => user.id === bigintTransformer.from(license.user_id)
)?.role === USER_ROLES.NONE
);
// 切り替えライセンスの数をカウント
const switchedTypistLicensesTypistCount =
@ -1819,7 +1868,6 @@ export async function outputAnalysisLicensesData(
outputFileNameUS,
csvContentUS
);
context.log("resultUS: " + resultUS);
const resultEU = await blobstorageService.uploadFileAnalysisLicensesCSV(
context,
outputFileNameEU,

File diff suppressed because it is too large Load Diff