存档旧的匹配事务和清除存档的事务

使用本节中的脚本可存档等于或超过指定天数的匹配事务(包括支持和调整详细信息),然后从 Account Reconciliation 中清除存档的事务。存档的匹配事务记录在 ZIP 文件中。

脚本的工作原理

  1. 使用 input.properties 文件中的信息登录环境
  2. 运行以下 archiveTmTransactions 命令来创建存档。生成的 ZIP 文件和日志文件分别使用默认名称 Archive_Transactions_INTERCO_JOB_ID.zipArchive_Transactions_INTERCO_JOB_ID.log

    epmautomate archiveTmTransactions INTERCO 365 filterOperator=contains filterValue=14001

    您可以通过修改 input.properties 文件来更改命令参数。
  3. 将日志文件和包含存档事务的 .ZIP 文件下载到本地计算机。如果未找到匹配的事务,则脚本将显示错误消息。
  4. 将包含存档事务的 .ZIP 文件复制到 Oracle Object Store。
  5. 运行 purgeArchivedTmTransactions 命令(使用 archiveTmTransactions 作业的作业 ID)从应用程序中删除存档的匹配事务。

重新运行该脚本

  1. 创建 input.properties 文件,并使用环境信息进行相应的更新。将该文件保存到一个本地目录。在本次讨论中,此目录名为 parentsnapshotdirectory。此文件的内容因操作系统的不同而异。

    请确保您对此目录具有写权限。对于 Windows,您可能需要使用以管理员身份运行选项启动 PowerShell,以便能够运行脚本。

  2. 创建 transaction_match.ps1 (Windows PowerShell) 或 transaction_match.sh (Linux/UNIX) 脚本,并将其保存到 input.properties 所在的 parentsnapshotdirectory 中。
  3. 启动脚本。
    • Linux/UNIX:运行 ./transaction_match.sh
    • Windows PowerShell:运行 transaction_match.ps1

创建 input.properties 脚本

通过复制并更新以下脚本来创建 input.properties

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
epmusername=exampleAdmin1
epmpassword=examplePassword1.epw
epmurl=exampleURL1
objectstorageusername=exampleAdmin2
objectstoragepassword=examplePassword2
objectstorageurl=exampleURL2
matchtype=INTERCO
age=365
filteroperator=contains
filtervalues=FilterValue=14001
proxyserverusername=myProxyserver
proxyserverpassword=myProxyserver_pwd
proxyserverdomain=myProxyDomain

注:

仅限 Windows:input.properties 文件中删除以下属性:

  • javahome=JAVA_HOME
  • epmautomatescript=EPM_AUTOMATE_LOCATION

如果没有为 Windows 网络环境启用在代理服务器中进行身份验证,则从 input.properties 文件中删除以下属性。

  • proxyserverusername
  • proxyserverpassword
  • proxyserverdomain

表 3-24 input.properties 参数

参数 说明
javahome EPM Automate 使用的 JDK 的安装目录。从 Windows 版本的 input.properties 中删除此条目。

示例:javahome=./home/JDK/bin

epmautomatescript 安装 EPM Automate 的目录。从 Windows 版本的 input.properties 中删除此条目。

示例:epmautomatescript=./home/utils/EPMAutomate/bin

epmusername 服务管理员超级用户用户或有权存档匹配事务的查看者的名称。

示例:epmusername=ServiceAdmin

epmuserpassword 标识为 epmusername 的用户的加密密码文件。

示例:epmpassword=myPwd.epw

epmurl 要存档匹配事务的环境的 URL。

示例:epmurl=https://test-cloudpln.pbcs.us1.oraclecloud.com

objectstorageusername 具有向 Oracle Object Storage Cloud 写入所需访问权限的用户的 ID。

对于在联合身份提供程序中创建的用户,请指定用户的全限定名称(例如 exampleIdP/jdoeexampleIdP/john.doe@example.com,其中 exampleIdP 是联合身份提供程序的名称)。对于其他用户,请指定用户 ID。

示例:epmusername=myIdP/jdoe

objectstoragepassword objectstorageusername 中标识的用户关联的 Swift 密码或身份验证令牌。此密码与用户用于登录对象存储控制台的密码不同。身份验证令牌是 Oracle 生成的令牌,您可以将其与第三方 API 一起用于身份验证,例如与 Swift 客户端一起用于身份验证。有关创建此令牌的说明,请参阅 Oracle Cloud Infrastructure 文档中的“创建身份验证令牌”。

示例:objectstoragepassword=jDoe_PWD

objectstorageurl Oracle Object Storage Cloud 存储桶的 URL,后面可以附加对象名称。

示例:objectstorageurl=https://swiftobjectstorage.region_identifier.oraclecloud.com/v1/namespace/MT_Archives/2023_archives

matchtype 应存档匹配事务的匹配类型的标识符 (TextID)。

示例:matchtype=cashrecon

age

自匹配事务以来的天数。将存档超过或等于此值的匹配事务。

示例:age=180

filteroperator 用于标识包含要存档的匹配事务的帐户的筛选条件。必须是以下项之一:equalsnot_equalsstarts_withends_withcontainsnot_contains

此值与 filterValue 相结合,用于标识要存档匹配事务的帐户。

示例:filteroperator=not_equals

filtervalues 一个或多个用于标识要存档的事务的筛选器值。如果 equalsnot_equals 指定为 filterOperator,可以使用空格分隔的列表指定多个值。如果指定多个值,将选择与任何筛选器运算符和筛选器值组合匹配的帐户中的事务进行存档。

示例:filterValue=101-120 filterValue=140-202

proxyserverusername 使用具有 Internet 访问控制权的代理服务器对安全会话进行身份验证的用户名。

示例:proxyserverusername=myProxyserver

proxyserverpassword 用于在代理服务器中对用户进行身份验证的密码。

示例:proxyserverpassword=myProxyserver_pwd

proxyserverdomain 为代理服务器定义的域的名称。

示例:proxyserverdomain=myProxyDomain

Windows 脚本

通过复制以下脚本来创建 transaction_match.ps1。将其存储在存储 input.properties 的文件夹中。

# Archive and Purge Transaction Matching PowerShell script

$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$epmusername="$($inputproperties.epmusername)"
$epmpassword="$($inputproperties.epmpassword)"
$epmurl="$($inputproperties.epmurl)"
$objectstorageusername="$($inputproperties.objectstorageusername)"
$objectstoragepassword="$($inputproperties.objectstoragepassword)"
$objectstorageurl="$($inputproperties.objectstorageurl)"
$matchtype="$($inputproperties.matchtype)"
$age="$($inputproperties.age)"
$filteroperator="$($inputproperties.filteroperator)"
$filtervalues="$($inputproperties.filtervalues)"
$proxyserverusername="$($inputproperties.proxyserverusername)"
$proxyserverpassword="$($inputproperties.proxyserverpassword)"
$proxyserverdomain="$($inputproperties.proxyserverdomain)"

echo "Running processes to archive and purge transaction matching transactions ..."
if (${proxyserverusername}) {
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl} ${proxyserverusername} ${proxyserverpassword} ${proxyserverdomain}" 
    epmautomate login ${epmusername} ${epmpassword} ${epmurl} ${proxyserverusername} ${proxyserverpassword} ${proxyserverdomain} 
} else {
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl}" 
    epmautomate login ${epmusername} ${epmpassword} ${epmurl}
}
echo "Running epmautomate archiveTmTransactions \"${matchtype}\" ${age} filterOperator=${filteroperator} ${filtervalues}"
epmautomate archiveTmTransactions "${matchtype}" "${age}" "filterOperator=${filteroperator}" "${filtervalues}" > ./outfile.txt.tmp

$jobIdLine=Select-String -Path "outfile.txt.tmp" -Pattern "Job ID"; $jobIdLine=($jobIdLine -split ":")[-2]; $jobid=($jobIdLine -split " ")[1];
$logfile="Archive_Transactions_${matchtype}_${jobid}.log"
$transactionsfile="Archive_Transactions_${matchtype}_${jobid}.zip"
epmautomate listfiles > ./files.txt.tmp
$transactionslogfound=Select-String -Path "./files.txt.tmp" -Pattern "${logfile}"
$transactionsfilefound=Select-String -Path "./files.txt.tmp" -Pattern "${transactionsfile}"
rm ./outfile.txt.tmp
rm ./files.txt.tmp

if (${transactionslogfound}) {
    echo "Running epmautomate downloadfile \"${logfile}\""
    epmautomate downloadfile "${logfile}"
    if (${transactionsfilefound}) {
        echo "Running epmautomate downloadfile ${transactionsfile}"
        epmautomate downloadfile "${transactionsfile}" 
        if ($?) {
            echo "Running epmautomate copyToObjectStorage ${transactionsfile} ${objectstorageusername} ${objectstoragepassword} ${objectstorageurl}"
            epmautomate copyToObjectStorage "${transactionsfile}" "${objectstorageusername}" "${objectstoragepassword}" "${objectstorageurl}"
            if ($?) {
                echo "Running epmautomate purgeArchivedTMTransactions JOBID=${jobid}"
                epmautomate purgeArchivedTMTransactions "JobID=${jobid}"
            } 
            else {
                echo "EPMAutomate copyToObjectStorage failed. Purging of archived matched transactions will not be attempted."
            } 
        }
        else {
            echo "Download of transactions file ${transactionsfile} failed. Copy to object storage, and purging of archived matched transactions will not be attempted."
        }
    } 
    else {
        echo "No matched transactions found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
    }
} 
else { 
    echo "Matchtype ID \"${matchtype}\" not found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
}

echo "Running epmautomate logout"
epmautomate logout
echo "Script processing completed."

Linux/UNIX 脚本

通过复制以下脚本来创建 transaction_match.sh。将其存储在存储 input.properties 的文件夹中。

#!/bin/sh

. ./input.properties
export JAVA_HOME=${javahome}

echo "Running processes to archive and purge transaction matching transactions..."
if [[ "${proxyserverusername}" != "" ]]
then
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" 
    ${epmautomatescript} login "${epmusername}" "${epmpassword}" "${epmurl}" "ProxyServerUserName=${proxyserverusername}" "ProxyServerPassword=${proxyserverpassword}" "ProxyServerDomain=${proxyserverdomain}" 
else
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl}" 
    ${epmautomatescript} login "${epmusername}" "${epmpassword}" "${epmurl}" 
fi
echo "Running epmautomate archiveTmTransactions \"${matchtype}\" ${age} filterOperator=${filteroperator} ${filtervalues}"
${epmautomatescript} archiveTmTransactions "${matchtype}" "${age}" "filterOperator=${filteroperator}" "${filtervalues}" > ./output.txt.tmp

jobid=$(grep "Job ID" ./output.txt.tmp | cut -d':' -f3 | cut -d' ' -f2)
logfile="Archive_Transactions_${matchtype}_${jobid}.log"
transactionsfile="Archive_Transactions_${matchtype}_${jobid}.zip"
${epmautomatescript} listfiles > ./files.txt.tmp
transactionslogfound=$(grep "${logfile}" ./files.txt.tmp | wc -l)
transactionsfilefound=$(grep "${transactionsfile}" ./files.txt.tmp | wc -l)
rm ./files.txt.tmp
rm ./output.txt.tmp

if [ ${transactionslogfound} -eq 0 ]
then
    echo "Matchtype ID \"${matchtype}\" not found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
else
    echo "Running epmautomate downloadfile \"${logfile}\""
    ${epmautomatescript} downloadfile "${logfile}"
    if [ ${transactionsfilefound} -eq 0 ]
    then
        echo "No matched transactions found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
    else
        echo "Running epmautomate downloadfile ${transactionsfile}"
        ${epmautomatescript} downloadfile "${transactionsfile}" 
        if [ $? -eq 0 ]
        then
            echo "Running epmautomate copyToObjectStorage ${transactionsfile} ${objectstorageusername} ${objectstoragepassword} ${objectstorageurl}"
            ${epmautomatescript} copyToObjectStorage "${transactionsfile}" "${objectstorageusername}" "${objectstoragepassword}" "${objectstorageurl}"
            if [ $? -eq 0 ]
            then
                echo "Running epmautomate purgeArchivedTMTransactions JOBID=${jobid}"
                ${epmautomatescript} purgeArchivedTMTransactions "JobID=${jobid}"
            else
                echo "EPMAutomate copyToObjectStorage failed. Purging of archived matched transactions will not be attempted."
            fi
        else
            echo "Download of transactions file ${transactionsfile} failed. Copy to object storage, and purging of archived matched transactions will not be attempted."
        fi
    fi
fi

echo "Running epmautomate logout"
${epmautomatescript} logout
echo "Script processing completed."