master
taylor.dang 5 years ago
parent 68c4af820b
commit 94073272f1

@ -7,17 +7,15 @@ import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.client.ClientCustomersMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ExchangeRateMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.defines.TradeType;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
import org.slf4j.Logger;
@ -26,6 +24,7 @@ import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
@ -34,8 +33,6 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
/**
* Created by davep on 2016-07-28.
*/
@ -62,7 +59,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
private StringRedisTemplate stringRedisTemplate;
@Resource
private ClientCustomersMapper clientCustomersMapper;
private MerchantInfoProvider merchantInfoProvider;
@ -323,6 +320,8 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
params.remove("client_ids");
}
JSONObject res = new JSONObject();
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(partner.getIntValue("client_id"));
params.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
params.put("client_id", partner.getIntValue("client_id"));
JSONObject today = getTransJSONO(params);
params.put("begin",DateUtils.addDays(params.getDate("begin"),-1));

@ -430,6 +430,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
List<JSONObject> children = clientMapper.listChildClients(client.getIntValue("client_id"));
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
client.putAll(mchConfig);
client.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
client.put("has_children", !children.isEmpty());
if (client.getInteger("parent_client_id") != null) {
client.put("parent_client", clientMapper.findClient(client.getInteger("parent_client_id")));
@ -2076,6 +2077,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
checkOrgPermission(manager, client);
List<JSONObject> listChildClients = clientMapper.listChildClients(client.getIntValue("client_id"));
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
if(mchConfig.getBooleanValue("hide_sub_mch")){
return new ArrayList<>();
}
if (!mchConfig.getBooleanValue("disable_level3_mch")) {
for (JSONObject partner : listChildClients) {
List<JSONObject> clients = clientMapper.listChildClients(partner.getIntValue("client_id"));

@ -201,6 +201,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
}
JSONObject mchConfig = merchantInfoProvider.getMchExtParams(client.getIntValue("client_id"));
client.putAll(mchConfig);
client.put("hide_sub_mch", mchConfig.getBooleanValue("hide_sub_mch"));
account.put("client", client);
account.put("client_moniker", client.getString("client_moniker"));
if (client.getIntValue("approve_result") == 2) {

@ -152,18 +152,22 @@
<select id="analysisNotSettled" resultType="java.lang.Double">
<![CDATA[
SELECT ifnull(sum(if(transaction_type = 'Credit', clearing_amount, -clearing_amount)), 0)
FROM pmt_transactions
WHERE clearing_status = 0
SELECT ifnull(sum(if(pt.transaction_type = 'Credit', pt.clearing_amount, -pt.clearing_amount)), 0)
FROM pmt_transactions pt
LEFT JOIN sys_clients sc on sc.client_id = pt.client_id
WHERE pt.clearing_status = 0
]]>
<if test="client_ids!=null">
AND client_id IN
<if test="!hide_sub_mch and client_ids!=null">
AND pt.client_id IN
<foreach collection="client_ids" open="(" close=")" separator="," item="client_id">
#{client_id}
</foreach>
</if>
<if test="client_ids==null and client_id != null">
and client_id=#{client_id}
<if test="!hide_sub_mch and client_ids==null and client_id != null">
and pt.client_id=#{client_id}
</if>
<if test="hide_sub_mch">
and (sc.client_id=#{client_id} or sc.parent_client_id = #{client_id})
</if>
</select>

@ -665,7 +665,7 @@ define(['angular','decimal', 'uiRouter', 'uiBootstrap', 'angularEcharts'], funct
$scope.loadSettlementLogs(1);
};
if (!$scope.currentUser.client.has_children){
if (!$scope.currentUser.client.has_children || ($scope.currentUser.client.has_children && $scope.currentUser.client.hide_sub_mch)) {
$scope.loadDashboard();
}
function loadTransCommon() {

@ -200,9 +200,6 @@ define(['angular', 'uiBootstrap', 'uiRouter'], function (angular) {
url += connectSymbol + 'dev_id=' + params.dev_id;
connectSymbol = '&'
}
if (!params.client_ids) {
$scope.params.client_ids = [$scope.currentUser.client.client_id]
}
params.client_ids.forEach(function (i) {
url += connectSymbol + 'client_ids=' + i;
connectSymbol = '&';

Loading…
Cancel
Save