Commit c5795e66 authored by Antonio.Suerte's avatar Antonio.Suerte

BI API Enhancement

parent 117ddd06
......@@ -434,6 +434,12 @@ class ParamHolder{
*/
public $dateOfAccountSuspensionTo;
/**
*
* @var int
*/
public $orderByAlgorithm;
/**
*
* @var object
......
......@@ -56,6 +56,11 @@ class TransactionManager extends RequestUtil {
$this -> paramHolder -> userAccount = $this -> requestParam("userAccount", true);
$this -> paramHolder -> view = $this -> requestParam("view", true);
$this -> paramHolder -> currency = $this -> requestParam("currency", true);
$this -> paramHolder -> orderByAlgorithm = $this -> requestParam("orderByAlgo");
if(empty($this -> paramHolder -> orderByAlgorithm))
$this -> paramHolder -> orderByAlgorithm = 1;
}
private function userListParams(){
......
......@@ -39,7 +39,17 @@ class MoneyOutTransactions extends OpenAPIAbstraction{
}
private function list(){
$list = $this -> accessSelect('LIST_WITHDRAW_REVISED', [$this -> getWhere()]);
switch($this -> holder -> orderByAlgorithm){
case 1:
$this -> holder -> orderByAlgorithm = "ASC";
break;
case 2:
$this -> holder -> orderByAlgorithm = "DESC";
break;
}
$list = $this -> accessSelect('LIST_WITHDRAW_REVISED', [$this -> getWhere(),
"withdraw.create_time {$this -> holder -> orderByAlgorithm}"]);
$rowCount = count($list);
$totalPage = $this -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $rowCount);
......
......@@ -173,10 +173,21 @@ class OverallTransactions extends OpenAPIAbstraction{
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
}
if(count($rtn) > NO_COUNT)
return array(DELIMIT_AND . implode(DELIMIT_AND, $rtn), $page);
switch($this -> holder -> orderByAlgorithm){
case 1:
$this -> holder -> orderByAlgorithm = "ASC";
break;
case 2:
$this -> holder -> orderByAlgorithm = "DESC";
break;
}
$delimitedArrayByAnd =
(count($rtn) > NO_COUNT)
? DELIMIT_AND . implode(DELIMIT_AND, $rtn)
: NO_STRING;
return array(NO_STRING, $page);
return array($delimitedArrayByAnd, "transaction_time {$this -> holder -> orderByAlgorithm}", $page);
}
/**
......
......@@ -44,6 +44,8 @@ class UserList extends OpenAPIAbstraction{
"last_name" => $this -> getColumnData($user, COLUMN_LAST_NAME),
"account_type" => $this -> getColumnData($user, COLUMN_ACCOUNT_TYPE) ? "Corporate" : "Individual",
"account_cat" => $this -> getColumnData($user, COLUMN_TEST_ACCOUNT_FLG) == 0 ? "Live" : "Test",
"create_time" => $this -> getColumnData($user, COLUMN_CREATE_TIME),
"suspension_time" => $this -> getColumnData($user, COLUMN_SUSPENSION_TIME),
"balances" => $this -> generateBalances($user[COLUMN_USER_ACCOUNT])
];
}
......@@ -240,13 +242,19 @@ class UserList extends OpenAPIAbstraction{
$start = ($this -> holder -> page - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT;
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
switch($this -> holder -> orderByAlgorithm){
case 1:
$this -> holder -> orderByAlgorithm = "ASC";
break;
case 2:
$this -> holder -> orderByAlgorithm = "DESC";
break;
}
$rtn[] = $where;
$rtn[] = $having;
if($this -> holder -> page != -1){
$rtn[] = $page;
}else
$rtn[] = NO_STRING;
$rtn[] = "create_time {$this -> holder -> orderByAlgorithm}";
$rtn[] = $this -> holder -> page != -1 ? $page : NO_STRING;
return $rtn;
}
......
......@@ -179,10 +179,21 @@ trait ProcessingHistory{
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
}
if(count($rtn) > NO_COUNT)
return array(DELIMIT_AND . implode(DELIMIT_AND, $rtn), $page);
switch($holder -> orderByAlgorithm){
case 1:
$holder -> orderByAlgorithm = "ASC";
break;
case 2:
$holder -> orderByAlgorithm = "DESC";
break;
}
$delimitedArrayByAnd =
(count($rtn) > NO_COUNT)
? DELIMIT_AND . implode(DELIMIT_AND, $rtn)
: NO_STRING;
return array(NO_STRING, $page);
return array($delimitedArrayByAnd, "transaction_time {$holder -> orderByAlgorithm}", $page);
}
/**
......
......@@ -53,6 +53,11 @@ trait ValidationExpression {
&& count($sys -> getAccountCommon($holder -> userAccount)) === 0,
"message" => "[User Balance Result]: Account No. doesn't exist [{$holder -> userAccount}]",
"code" => 8
],
[
"notvalid" => $holder -> orderByAlgorithm != 1 && $holder -> orderByAlgorithm != 2,
"message" => "Invalid Sorting Order [{$holder -> orderByAlgorithm}] (1 and 2 are the only allowed option)",
"code" => 9
]
];
}
......
......@@ -27,7 +27,18 @@ trait Withdrawal{
$sys = $holder -> getSource();
if($sys instanceof System){
$list = $sys -> accessSelect('LIST_WITHDRAW_REVISED', [$this -> getWhereWithdrawal($holder)]);
switch($holder -> orderByAlgorithm){
case 1:
$holder -> orderByAlgorithm = "ASC";
break;
case 2:
$holder -> orderByAlgorithm = "DESC";
break;
}
$list = $sys -> accessSelect('LIST_WITHDRAW_REVISED', [$this -> getWhereWithdrawal($holder),
"withdraw.create_time {$holder -> orderByAlgorithm}"]);
$rowCount = count($list);
$totalPage = $sys -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $rowCount);
......
......@@ -607,8 +607,8 @@
u_id != ''
__ELEMENT02__
ORDER BY
create_time DESC
__ELEMENT03__
__ELEMENT04__
</LIST_ACCOUNTS_REVISED_BI>
<!--
......@@ -1958,7 +1958,7 @@
AND users.admin_flg = 0
AND users.status IN (2, 3, 4, 5, 6, 7)
ORDER BY
withdraw.create_time DESC
__ELEMENT02__
</LIST_WITHDRAW_REVISED>
<!--
......@@ -3489,8 +3489,8 @@
1
__ELEMENT01__
ORDER BY
transaction_time DESC
__ELEMENT02__
__ELEMENT03__
</LIST_TRANSACTION>
<LIST_DELETED_TRANSACTION>
......
......@@ -275,20 +275,19 @@ class TransactionModelClass extends ModelClassEx {
// ページ数
$start = ($this -> getTargetPage() - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT;
$end = $this -> getTargetPage() * VAR_DEFAULT_PAGE_COUNT;
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
if($this -> getType() == TYPE_EXPORT){
if($this -> getType() == TYPE_EXPORT)
$page = '';
}
// 検索条件の結合
if(count($rtn) > NO_COUNT) {
return array(DELIMIT_AND . implode(DELIMIT_AND, $rtn), $page);
} else {
return array(NO_STRING, $page);
}
$delimitedArrayByAnd =
(count($rtn) > NO_COUNT)
? DELIMIT_AND . implode(DELIMIT_AND, $rtn)
: NO_STRING;
return array($delimitedArrayByAnd, "transaction_time DESC", $page);
}
/*-------------------------------------------------------------------------
......
......@@ -84,7 +84,7 @@ class LogicWithdraw extends WithdrawModelClass {
-------------------------------------------------------------------------*/
function lists() {
//remove _REVISED if want to use the old query - mark
$this -> setResult($this -> accessSelect('LIST_WITHDRAW_REVISED', array($this -> getWhere_new())));
$this -> setResult($this -> accessSelect('LIST_WITHDRAW_REVISED', array($this -> getWhere(), "withdraw.create_time DESC")));
$this -> setTotal($this -> accessSelect('LIST_WITHDRAW_TOTAL', array($this -> getWhere())));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment