From 6929b209fa76ad86c91518fea63b5f36813a6bf9 Mon Sep 17 00:00:00 2001 From: yangkai Date: Mon, 27 Aug 2018 17:25:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=94=AF=E4=BB=98=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=BD=95=E5=85=A5=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customers/core/impls/CustomerPaymentInfoImpl.java | 7 ++----- .../customers/web/CustomerPaymentInfoController.java | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java index 6fe52d5ea..934376c9e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/core/impls/CustomerPaymentInfoImpl.java @@ -16,7 +16,7 @@ public class CustomerPaymentInfoImpl implements CustomerPaymentInfoService { @Override public void saveCustomerPaymentInfo(JSONObject paymentInfo) { if (sysCustomerPaymentInfoMapper.selectPaymentInfo(paymentInfo.getString("wechat_openid")) != null) { - throw new BadRequestException("openid exists"); + throw new BadRequestException("openid already exists"); } sysCustomerPaymentInfoMapper.save(paymentInfo); } @@ -24,10 +24,7 @@ public class CustomerPaymentInfoImpl implements CustomerPaymentInfoService { @Override public void updateCustomerPaymentInfo(JSONObject paymentInfo) { if (paymentInfo.getString("id") == null) { - throw new BadRequestException("ID is not empty"); - } - if (sysCustomerPaymentInfoMapper.selectById(paymentInfo.getString("id")) == null) { - throw new BadRequestException("ID:" + paymentInfo.getString("id") + " not exists!"); + throw new BadRequestException("ID is empty"); } sysCustomerPaymentInfoMapper.update(paymentInfo); } diff --git a/src/main/java/au/com/royalpay/payment/manage/customers/web/CustomerPaymentInfoController.java b/src/main/java/au/com/royalpay/payment/manage/customers/web/CustomerPaymentInfoController.java index f42a47c45..f8eb0acc1 100644 --- a/src/main/java/au/com/royalpay/payment/manage/customers/web/CustomerPaymentInfoController.java +++ b/src/main/java/au/com/royalpay/payment/manage/customers/web/CustomerPaymentInfoController.java @@ -13,18 +13,18 @@ public class CustomerPaymentInfoController { @Resource private CustomerPaymentInfoService customerPaymentInfoService; - @RequestMapping(value = "/save", method = RequestMethod.POST) - public void saveTest(@RequestBody JSONObject paymentInfo) { + @RequestMapping(value = "/update", method = RequestMethod.POST) + public void savePaymentInfo(@RequestBody JSONObject paymentInfo) { customerPaymentInfoService.saveCustomerPaymentInfo(paymentInfo); } @RequestMapping(value = "/update", method = RequestMethod.PUT) - public void updateTest(@RequestBody JSONObject paymentInfo) { + public void updatePaymentInfo(@RequestBody JSONObject paymentInfo) { customerPaymentInfoService.updateCustomerPaymentInfo(paymentInfo); } @RequestMapping(value = "/{openid}/check", method = RequestMethod.GET) - public JSONObject selectTest(@PathVariable String openid) { + public JSONObject selectPaymentInfo(@PathVariable String openid) { return customerPaymentInfoService.selectPaymentInfoByOpenId(openid); } }