From 4eced16988b420f8c8316b7ae93ce78549efab37 Mon Sep 17 00:00:00 2001 From: liuxinxin Date: Mon, 29 Jul 2019 17:57:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E6=98=93=E6=B5=81=E6=B0=B4=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=9F=A5=E8=AF=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mappers/system/ClientApplyMapper.java | 3 ++ .../merchants/core/impls/ClientApplyImpl.java | 32 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientApplyMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientApplyMapper.java index e8938bcb6..5e221cd6e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientApplyMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientApplyMapper.java @@ -24,6 +24,9 @@ public interface ClientApplyMapper { @AutoSql(type = SqlType.SELECT) JSONObject findClientApplicationById(@Param("client_apply_id") String client_apply_id); + @AutoSql(type = SqlType.SELECT) + JSONObject findClientApplicationByClientMoniker(@Param("client_moniker") String client_moniker); + PageList listPartnerApplications(JSONObject params, PageBounds pageBounds); @AutoSql(type = SqlType.COUNT) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java index 2d9c07f5d..d2e549f7a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientApplyImpl.java @@ -218,8 +218,36 @@ public class ClientApplyImpl implements ClientApply, ApplicationEventPublisherAw partner.put("bd_user", manager.getString("manager_id")); partner.put("bd_user_name", manager.getString("display_name")); - if (clientMapper.findClientByMoniker(info.getClientMoniker()) != null) { - throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); + JSONObject client; + + if ((client = clientMapper.findClientByMoniker(info.getClientMoniker())) != null) { + if( manager.getString("manager_id").equals(client.getString("creator")) ) + { + if(clientApplyMapper.findClientApplicationByClientMoniker(info.getClientMoniker()) != null) + { + throw new BadRequestException("无效,已关联商户"); + } + JSONObject client_bd = new JSONObject(); + client_bd.put("client_id", partner.getIntValue("client_id")); + client_bd.put("bd_id", manager.getString("manager_id")); + client_bd.put("bd_name", manager.getString("display_name")); + client_bd.put("create_time", new Date()); + client_bd.put("create_id", manager.getString("manager_id")); + client_bd.put("start_date", new Date()); + client_bd.put("proportion", 1); + clientBDMapper.saveBD(client_bd); + + apply.put("client_apply_id", client_apply_id); + apply.put("client_id", partner.getIntValue("client_id")); + apply.put("client_moniker", info.getClientMoniker()); + apply.put("apply_approve_result", 2); + apply.put("apply_approve_time", new Date()); + clientApplyMapper.updatePartnerApplication(apply); + + return partner; + } + throw new BadRequestException("您只能关联自己创建的商户"); + //throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); } partner.put("source", 2);//自主申请 partner.put("country", "AUS");//自主申请