From f26a747c05e9e31bf954c94cde76a2b5e85fa84c Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 27 Dec 2017 15:04:06 +0800 Subject: [PATCH] add new sub partner excepeion --- .../core/impls/ClientManagerImpl.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index dab9557d1..62364635e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -70,6 +70,7 @@ import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; +import com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; @@ -413,7 +414,11 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (clientMapper.findClientByMoniker(registery.getClientMoniker()) != null) { throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); } - clientMapper.save(partner); + try { + clientMapper.save(partner); + } catch (Exception e) { + throw new BadRequestException("error.partner.valid.dumplicate_client_moniker"); + } if (ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))) { JSONObject client_bd = new JSONObject(); @@ -2721,7 +2726,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } private TemplateMessage initSendToComplianceGreenChannelTemplate(String loginUrl, String wxopenid, String templateId2, String bd_user_name, - JSONObject client) { + JSONObject client) { TemplateMessage msg = new TemplateMessage(wxopenid, templateId2, loginUrl); msg.put("first", bd_user_name + " 提交了新商户绿色通道申请,请审核", "#ff0000"); msg.put("keyword1", client.getString("client_moniker") + "申请绿色通道", "#0000ff"); @@ -2784,8 +2789,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = compliance.getString("wx_openid"); try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作合同" + client_moniker, bd_user_name, "制作合同申请", - "BD申请制作" + short_name + "的合同"); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), "BD申请制作合同" + client_moniker, + bd_user_name, "制作合同申请", "BD申请制作" + short_name + "的合同"); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { logger.error("Wechat Message Error,open_status=1" + e.getMessage()); @@ -2802,8 +2807,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid if (wxopenid != null) { try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合同制作完成", "Compliance", "合规材料", - "上传完整合规材料,商户:" + short_name); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合同制作完成", + "Compliance", "合规材料", "上传完整合规材料,商户:" + short_name); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { logger.error("Wechat Message Error,open_status=3" + e.getMessage()); @@ -2822,8 +2827,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = compliance.getString("wx_openid"); try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合规材料已提交", bd_user_name, "审核材料", - "BD已提交合规材料,等待审核"); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "合规材料已提交", + bd_user_name, "审核材料", "BD已提交合规材料,等待审核"); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { logger.error("Wechat Message Error,open_status=1" + e.getMessage()); @@ -2858,8 +2863,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid String wxopenid = compliance.getString("wx_openid"); try { MpWechatApi paymentApi = mpWechatApiProvider.getNewPaymentApi(); - TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "申请绿色通道", bd_user_name, "绿色通道申请", - "BD已提交绿色通道申请,商户:" + short_name); + TemplateMessage msg = initSendCommissionTemplate(wxopenid, paymentApi.getTemplateId("commission"), client_moniker + "申请绿色通道", + bd_user_name, "绿色通道申请", "BD已提交绿色通道申请,商户:" + short_name); paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { logger.error("Wechat Message Error,open_status=10");