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

BI API Enhancement

parent 9e0aaa73
...@@ -434,6 +434,12 @@ class ParamHolder{ ...@@ -434,6 +434,12 @@ class ParamHolder{
*/ */
public $dateOfAccountSuspensionTo; public $dateOfAccountSuspensionTo;
/**
*
* @var int
*/
public $orderByAlgorithm;
/** /**
* *
* @var object * @var object
......
...@@ -56,6 +56,11 @@ class TransactionManager extends RequestUtil { ...@@ -56,6 +56,11 @@ class TransactionManager extends RequestUtil {
$this -> paramHolder -> userAccount = $this -> requestParam("userAccount", true); $this -> paramHolder -> userAccount = $this -> requestParam("userAccount", true);
$this -> paramHolder -> view = $this -> requestParam("view", true); $this -> paramHolder -> view = $this -> requestParam("view", true);
$this -> paramHolder -> currency = $this -> requestParam("currency", 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(){ private function userListParams(){
......
...@@ -39,7 +39,17 @@ class MoneyOutTransactions extends OpenAPIAbstraction{ ...@@ -39,7 +39,17 @@ class MoneyOutTransactions extends OpenAPIAbstraction{
} }
private function list(){ 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); $rowCount = count($list);
$totalPage = $this -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $rowCount); $totalPage = $this -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $rowCount);
......
...@@ -173,10 +173,21 @@ class OverallTransactions extends OpenAPIAbstraction{ ...@@ -173,10 +173,21 @@ class OverallTransactions extends OpenAPIAbstraction{
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50; $page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
} }
if(count($rtn) > NO_COUNT) switch($this -> holder -> orderByAlgorithm){
return array(DELIMIT_AND . implode(DELIMIT_AND, $rtn), $page); 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{ ...@@ -44,6 +44,8 @@ class UserList extends OpenAPIAbstraction{
"last_name" => $this -> getColumnData($user, COLUMN_LAST_NAME), "last_name" => $this -> getColumnData($user, COLUMN_LAST_NAME),
"account_type" => $this -> getColumnData($user, COLUMN_ACCOUNT_TYPE) ? "Corporate" : "Individual", "account_type" => $this -> getColumnData($user, COLUMN_ACCOUNT_TYPE) ? "Corporate" : "Individual",
"account_cat" => $this -> getColumnData($user, COLUMN_TEST_ACCOUNT_FLG) == 0 ? "Live" : "Test", "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]) "balances" => $this -> generateBalances($user[COLUMN_USER_ACCOUNT])
]; ];
} }
...@@ -240,14 +242,20 @@ class UserList extends OpenAPIAbstraction{ ...@@ -240,14 +242,20 @@ class UserList extends OpenAPIAbstraction{
$start = ($this -> holder -> page - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT; $start = ($this -> holder -> page - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT;
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50; $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[] = $where;
$rtn[] = $having; $rtn[] = $having;
$rtn[] = "create_time {$this -> holder -> orderByAlgorithm}";
if($this -> holder -> page != -1){ $rtn[] = $this -> holder -> page != -1 ? $page : NO_STRING;
$rtn[] = $page;
}else
$rtn[] = NO_STRING;
return $rtn; return $rtn;
} }
......
...@@ -179,10 +179,21 @@ trait ProcessingHistory{ ...@@ -179,10 +179,21 @@ trait ProcessingHistory{
$page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50; $page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
} }
if(count($rtn) > NO_COUNT) switch($holder -> orderByAlgorithm){
return array(DELIMIT_AND . implode(DELIMIT_AND, $rtn), $page); case 1:
$holder -> orderByAlgorithm = "ASC";
break;
case 2:
$holder -> orderByAlgorithm = "DESC";
break;
}
return array(NO_STRING, $page); $delimitedArrayByAnd =
(count($rtn) > NO_COUNT)
? DELIMIT_AND . implode(DELIMIT_AND, $rtn)
: NO_STRING;
return array($delimitedArrayByAnd, "transaction_time {$holder -> orderByAlgorithm}", $page);
} }
/** /**
......
...@@ -53,6 +53,11 @@ trait ValidationExpression { ...@@ -53,6 +53,11 @@ trait ValidationExpression {
&& count($sys -> getAccountCommon($holder -> userAccount)) === 0, && count($sys -> getAccountCommon($holder -> userAccount)) === 0,
"message" => "[User Balance Result]: Account No. doesn't exist [{$holder -> userAccount}]", "message" => "[User Balance Result]: Account No. doesn't exist [{$holder -> userAccount}]",
"code" => 8 "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{ ...@@ -27,7 +27,18 @@ trait Withdrawal{
$sys = $holder -> getSource(); $sys = $holder -> getSource();
if($sys instanceof System){ 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); $rowCount = count($list);
$totalPage = $sys -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $rowCount); $totalPage = $sys -> getTotalPageCommon(VAR_DEFAULT_PAGE_COUNT, $rowCount);
......
...@@ -607,8 +607,8 @@ ...@@ -607,8 +607,8 @@
u_id != '' u_id != ''
__ELEMENT02__ __ELEMENT02__
ORDER BY ORDER BY
create_time DESC
__ELEMENT03__ __ELEMENT03__
__ELEMENT04__
</LIST_ACCOUNTS_REVISED_BI> </LIST_ACCOUNTS_REVISED_BI>
<!-- <!--
...@@ -1958,7 +1958,7 @@ ...@@ -1958,7 +1958,7 @@
AND users.admin_flg = 0 AND users.admin_flg = 0
AND users.status IN (2, 3, 4, 5, 6, 7) AND users.status IN (2, 3, 4, 5, 6, 7)
ORDER BY ORDER BY
withdraw.create_time DESC __ELEMENT02__
</LIST_WITHDRAW_REVISED> </LIST_WITHDRAW_REVISED>
<!-- <!--
...@@ -3489,8 +3489,8 @@ ...@@ -3489,8 +3489,8 @@
1 1
__ELEMENT01__ __ELEMENT01__
ORDER BY ORDER BY
transaction_time DESC __ELEMENT02__
__ELEMENT02__ __ELEMENT03__
</LIST_TRANSACTION> </LIST_TRANSACTION>
<LIST_DELETED_TRANSACTION> <LIST_DELETED_TRANSACTION>
......
...@@ -275,20 +275,19 @@ class TransactionModelClass extends ModelClassEx { ...@@ -275,20 +275,19 @@ class TransactionModelClass extends ModelClassEx {
// ページ数 // ページ数
$start = ($this -> getTargetPage() - VAL_INT_1) * VAR_DEFAULT_PAGE_COUNT; $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; $page = ' LIMIT ' . $start . DELIMIT_COMMA . VAL_INT_50;
if($this -> getType() == TYPE_EXPORT){ if($this -> getType() == TYPE_EXPORT)
$page = ''; $page = '';
}
// 検索条件の結合 // 検索条件の結合
if(count($rtn) > NO_COUNT) { $delimitedArrayByAnd =
return array(DELIMIT_AND . implode(DELIMIT_AND, $rtn), $page); (count($rtn) > NO_COUNT)
} else { ? DELIMIT_AND . implode(DELIMIT_AND, $rtn)
return array(NO_STRING, $page); : NO_STRING;
}
return array($delimitedArrayByAnd, "transaction_time DESC", $page);
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
......
...@@ -84,7 +84,7 @@ class LogicWithdraw extends WithdrawModelClass { ...@@ -84,7 +84,7 @@ class LogicWithdraw extends WithdrawModelClass {
-------------------------------------------------------------------------*/ -------------------------------------------------------------------------*/
function lists() { function lists() {
//remove _REVISED if want to use the old query - mark //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()))); $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