商户查询接口检查

master
wangning 8 years ago
parent 24f2c0bf95
commit 90b37f3bab

@ -1,6 +1,5 @@
package au.com.royalpay.payment.manage.analysis.core.impls; package au.com.royalpay.payment.manage.analysis.core.impls;
import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi;
import au.com.royalpay.payment.core.PaymentApi; import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean; import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
import au.com.royalpay.payment.manage.analysis.core.DashboardService; import au.com.royalpay.payment.manage.analysis.core.DashboardService;
@ -8,10 +7,12 @@ import au.com.royalpay.payment.manage.analysis.core.PartnerCardDashboardService;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper; import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider; import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
@ -21,11 +22,12 @@ import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Created by yishuqian on 20/02/2017. * Created by yishuqian on 20/02/2017.
*/ */
@ -44,10 +46,13 @@ public class PartnerCardDashboardServiceImp implements PartnerCardDashboardServi
@Resource @Resource
private MerchantInfoProvider merchantInfoProvider; private MerchantInfoProvider merchantInfoProvider;
@Resource @Resource
private ClientConfigService clientConfigService;
@Resource
private PaymentApi paymentApi; private PaymentApi paymentApi;
@Override @Override
public JSONObject getCommonAnalysis(String client_moniker) { public JSONObject getCommonAnalysis(String client_moniker) {
JSONObject client = clientManager.getClientInfoByMoniker(client_moniker); JSONObject client = clientManager.getClientInfoByMoniker(client_moniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id")); JSONObject earlistOrder = transactionAnalysisMapper.getEarliestOrder(client.getIntValue("client_id"));
Date data = new Date(); Date data = new Date();
if (earlistOrder != null){ if (earlistOrder != null){

@ -1,6 +1,7 @@
package au.com.royalpay.payment.manage.apps.web; package au.com.royalpay.payment.manage.apps.web;
import au.com.royalpay.payment.manage.apps.AppController; import au.com.royalpay.payment.manage.apps.AppController;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -13,10 +14,14 @@ import javax.annotation.Resource;
public class CustomerRMIController { public class CustomerRMIController {
@Resource @Resource
private ClientManager clientManager; private ClientManager clientManager;
@Resource
private ClientConfigService clientConfigService;
@RequestMapping(value = "/{client_moniker}", method = RequestMethod.GET) @RequestMapping(value = "/{client_moniker}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public JSONObject checkPointsAfterPay(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.APP_INFO) JSONObject app) { public JSONObject checkPointsAfterPay(@PathVariable String client_moniker, @ModelAttribute(CommonConsts.APP_INFO) JSONObject app) {
return clientManager.getClientInfoByMoniker(client_moniker); JSONObject result = clientManager.getClientInfoByMoniker(client_moniker);
result.putAll(clientConfigService.find(result.getIntValue("client_id")));
return result;
} }
} }

@ -7,6 +7,7 @@ import au.com.royalpay.payment.manage.mappers.funds.FundsConfigMapper;
import au.com.royalpay.payment.manage.mappers.funds.XPlanMerchantMapper; import au.com.royalpay.payment.manage.mappers.funds.XPlanMerchantMapper;
import au.com.royalpay.payment.manage.mappers.funds.XPlanOperationLogMapper; import au.com.royalpay.payment.manage.mappers.funds.XPlanOperationLogMapper;
import au.com.royalpay.payment.manage.mappers.funds.XPlanTransactionMapper; import au.com.royalpay.payment.manage.mappers.funds.XPlanTransactionMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.env.RequestEnvironment; import au.com.royalpay.payment.tools.env.RequestEnvironment;
@ -14,18 +15,21 @@ import au.com.royalpay.payment.tools.env.SysConfigManager;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.utils.PageListUtils; import au.com.royalpay.payment.tools.utils.PageListUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
/** /**
* Create by yixian at 2017-09-14 17:33 * Create by yixian at 2017-09-14 17:33
*/ */
@ -44,6 +48,8 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService {
private XPlanMerchantMapper xPlanMerchantMapper; private XPlanMerchantMapper xPlanMerchantMapper;
@Resource @Resource
private XPlanTransactionMapper xPlanTransactionMapper; private XPlanTransactionMapper xPlanTransactionMapper;
@Resource
private ClientConfigService clientConfigService;
@Override @Override
public void configuration(XPlanFundConfig config, JSONObject manager) { public void configuration(XPlanFundConfig config, JSONObject manager) {
@ -112,6 +118,7 @@ public class XPlanFundConfigServiceImpl implements XPlanFundConfigService {
private JSONObject getClient(String clientMoniker) { private JSONObject getClient(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }

@ -10,6 +10,7 @@ import au.com.royalpay.payment.manage.mappers.funds.*;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.CalendarMapper; import au.com.royalpay.payment.manage.mappers.system.CalendarMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientConfigService;
import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.tools.permission.enums.PartnerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
@ -66,6 +67,8 @@ public class XPlanFundProcessorImpl implements XPlanFundProcesor {
private XPlanInterestClientLogMapper xPlanInterestClientLogMapper; private XPlanInterestClientLogMapper xPlanInterestClientLogMapper;
@Resource @Resource
private XPlanFundConfigService xPlanFundConfigService; private XPlanFundConfigService xPlanFundConfigService;
@Resource
private ClientConfigService clientConfigService;
@Resource(name = "systemCalculator") @Resource(name = "systemCalculator")
private SettlementDetailCalculator systemCalculator; private SettlementDetailCalculator systemCalculator;
@ -395,6 +398,7 @@ public class XPlanFundProcessorImpl implements XPlanFundProcesor {
private JSONObject getClient(String clientMoniker) { private JSONObject getClient(String clientMoniker) {
JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker); JSONObject client = clientManager.getClientInfoByMoniker(clientMoniker);
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }

@ -275,6 +275,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (manager != null) { if (manager != null) {
checkClientOrg(manager, client); checkClientOrg(manager, client);
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
client.put("show_all_permission", true); client.put("show_all_permission", true);
int role = manager != null ? manager.getIntValue("role") : 0; int role = manager != null ? manager.getIntValue("role") : 0;
if (manager != null) { if (manager != null) {
@ -601,6 +602,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) { if (client.getString("sub_merchant_id") == null || client.getString("sub_merchant_id").equals("")) {
throw new BadRequestException("该商户未设置微信 Sub Merchant ID!"); throw new BadRequestException("该商户未设置微信 Sub Merchant ID!");
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
Integer open_status = client.getInteger("open_status"); Integer open_status = client.getInteger("open_status");
boolean checkGreenChannel = client.getIntValue("approve_result") == 2 && (client.getIntValue("source") == 1 || client.getIntValue("source") == 2); boolean checkGreenChannel = client.getIntValue("approve_result") == 2 && (client.getIntValue("source") == 1 || client.getIntValue("source") == 2);
client.put("approve_result", pass); client.put("approve_result", pass);
@ -1180,6 +1182,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
throw new NotFoundException("Partner Not Exists"); throw new NotFoundException("Partner Not Exists");
} }
int clientId = client.getIntValue("client_id"); int clientId = client.getIntValue("client_id");
JSONObject clientConfig = clientConfigService.find(clientId);
List<JSONObject> rates = new ArrayList<>(); List<JSONObject> rates = new ArrayList<>();
for (PaymentChannelApi channel : channels) { for (PaymentChannelApi channel : channels) {
rates.addAll(merchantInfoProvider.listClientRates(clientId, new Date(), channel.channel(), includingInactive)); rates.addAll(merchantInfoProvider.listClientRates(clientId, new Date(), channel.channel(), includingInactive));
@ -1188,7 +1191,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
try { try {
for (JSONObject rate : rates) { for (JSONObject rate : rates) {
if (rate.get("clean_days") == null) { if (rate.get("clean_days") == null) {
rate.put("clean_days", client.getIntValue("clean_days")); rate.put("clean_days", clientConfig.getIntValue("clean_days"));
} }
} }
} catch (Exception ignore) { } catch (Exception ignore) {
@ -1829,6 +1832,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
String address = client.getString("address") + "," + client.getString("suburb") + ',' + client.getString("state") + ',' + client.getString("postcode"); String address = client.getString("address") + "," + client.getString("suburb") + ',' + client.getString("state") + ',' + client.getString("postcode");
client.remove("address"); client.remove("address");
client.put("address", address); client.put("address", address);
@ -1882,6 +1886,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
String address = client.getString("address").trim(); String address = client.getString("address").trim();
if (address.contains(",")) { if (address.contains(",")) {
client.put("address", address.substring(0, address.lastIndexOf(",")).trim()); client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
@ -1982,6 +1987,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
String address = client.getString("address").trim(); String address = client.getString("address").trim();
if (address.contains(",")) { if (address.contains(",")) {
client.put("address", address.substring(0, address.lastIndexOf(",")).trim()); client.put("address", address.substring(0, address.lastIndexOf(",")).trim());
@ -2495,6 +2501,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client.getInteger("open_status") == null) { if (client.getInteger("open_status") == null) {
int countProduct = commoditiesMapper.checkProduct(client.getInteger("client_id")); int countProduct = commoditiesMapper.checkProduct(client.getInteger("client_id"));
if (countProduct <= 0) { if (countProduct <= 0) {
@ -2567,7 +2574,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { if (manager != null && ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) {
int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id")); int bdOperatClientRole = clientBDMapper.checkBDPermission(client.getIntValue("client_id"), manager.getString("manager_id"));
if (bdOperatClientRole <= 0) { if (bdOperatClientRole <= 0) {
@ -2608,6 +2615,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
if (client == null) { if (client == null) {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client.getInteger("open_status") == null) { if (client.getInteger("open_status") == null) {
int countProduct = commoditiesMapper.checkProduct(client.getInteger("client_id")); int countProduct = commoditiesMapper.checkProduct(client.getInteger("client_id"));
if (countProduct <= 0) { if (countProduct <= 0) {

@ -121,6 +121,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
if (client == null) { if (client == null) {
throw new ForbiddenException("用户不存在或已禁用"); throw new ForbiddenException("用户不存在或已禁用");
} }
client.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
client = clientInfoWithNoSecretInfo(client); client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) { if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id")); JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));
@ -149,6 +150,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
JSONObject account = managerMapper.findAvailableByLoginId(loginInfo.getLoginId()); JSONObject account = managerMapper.findAvailableByLoginId(loginInfo.getLoginId());
validLoginInfo(loginInfo, account); validLoginInfo(loginInfo, account);
JSONObject client = clientManager.getClientInfoIgnoreInvalid(account.getIntValue("client_id")); JSONObject client = clientManager.getClientInfoIgnoreInvalid(account.getIntValue("client_id"));
client.putAll(clientConfigService.find(client.getIntValue("client_id")));
if (client != null && !client.getBooleanValue("is_valid")) { if (client != null && !client.getBooleanValue("is_valid")) {
throw new BadRequestException(LocaleSupport.localeMessage("error.login.password")); throw new BadRequestException(LocaleSupport.localeMessage("error.login.password"));
} }
@ -219,6 +221,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
} }
JSONObject account = new JSONObject(); JSONObject account = new JSONObject();
client = clientManager.getClientDetailById(client.getIntValue("client_id")); client = clientManager.getClientDetailById(client.getIntValue("client_id"));
client.putAll(clientConfigService.find(client.getIntValue("parent_client_id")));
client = clientInfoWithNoSecretInfo(client); client = clientInfoWithNoSecretInfo(client);
if (client.getInteger("parent_client_id") != null) { if (client.getInteger("parent_client_id") != null) {
JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id")); JSONObject rootPartner = clientManager.getClientInfo(client.getIntValue("parent_client_id"));

@ -33,6 +33,7 @@
<select id="listPartners" resultType="com.alibaba.fastjson.JSONObject"> <select id="listPartners" resultType="com.alibaba.fastjson.JSONObject">
SELECT DISTINCT c.*,o.name org_name SELECT DISTINCT c.*,o.name org_name
FROM sys_clients c FROM sys_clients c
inner join sys_client_config on scc.client_id = c.client_id
inner join sys_org o inner join sys_org o
on o.org_id=c.org_id on o.org_id=c.org_id
<if test="bd_user!=null"> <if test="bd_user!=null">
@ -165,6 +166,7 @@
</select> </select>
<select id="listPartnerSelection" resultType="com.alibaba.fastjson.JSONObject"> <select id="listPartnerSelection" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.*,o.name org_name FROM sys_clients c SELECT c.*,o.name org_name FROM sys_clients c
inner join sys_client_config scc on scc.client_id = c.client_id
inner join sys_org o on o.org_id=c.org_id inner join sys_org o on o.org_id=c.org_id
<if test="bd_user!=null"> <if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
@ -255,19 +257,22 @@
<select id="analysisClients" resultType="com.alibaba.fastjson.JSONObject"> <select id="analysisClients" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT
sum(if(((approve_result=4 and open_status is null) or (approve_result=3 and open_status is null) or open_status=1 or open_status=2 or open_status=4),1,0)) wp, sum(if(((scc.approve_result=4 and scc.open_status is null) or (scc.approve_result=3 and scc.open_status is null) or scc.open_status=1 or scc.open_status=2 or scc.open_status=4),1,0)) wp,
sum(if(approve_result is null and source= 4,1,0)) a_unagree, sum(if(scc.approve_result is null and scc.source= 4,1,0)) a_unagree,
sum(if(((approve_result=4 and open_status is null) or (approve_result=3 and open_status is null) or open_status=1 or open_status=2 or open_status=4) and source = 4,1,0)) a_wp, sum(if(((scc.approve_result=4 and scc.open_status is null) or (scc.approve_result=3 and scc.open_status is null) or scc.open_status=1 or scc.open_status=2 or scc.open_status=4) and scc.source = 4,1,0)) a_wp,
sum(if(approve_result=2 and source = 4,1,0)) wa, sum(if(scc.approve_result=2 and scc.source = 4,1,0)) wa,
sum(if(approve_result=1,1,0)) pass, sum(if(scc.approve_result=1,1,0)) pass,
sum(if(approve_result=1 and source=2,1,0)) z_pass, sum(if(scc.approve_result=1 and scc.source=2,1,0)) z_pass,
sum(if(approve_result=1 and source = 4,1,0)) a_pass, sum(if(scc.approve_result=1 and scc.source = 4,1,0)) a_pass,
sum(if(approve_result=0,1,0)) not_pass, sum(if(scc.approve_result=0,1,0)) not_pass,
sum(if(source=4,1,0)) quick_pass sum(if(scc.source=4,1,0)) quick_pass
<if test="tempSubMchId"> <if test="tempSubMchId">
,sum(if(locate(sub_merchant_id,#{tempSubMchId})>0 and skip_clearing=0,1,0)) temp_submchid ,sum(if(locate(sub_merchant_id,#{tempSubMchId})>0 and skip_clearing=0,1,0)) temp_submchid
</if> </if>
FROM sys_clients where is_valid = 1 FROM sys_clients c
left join sys_client_config scc on scc.client_id = c.client_id
where is_valid = 1
</select> </select>
<select id="listCityClientIds" resultType="java.lang.String"> <select id="listCityClientIds" resultType="java.lang.String">
SELECT DISTINCT cb.client_id SELECT DISTINCT cb.client_id

Loading…
Cancel
Save