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); } }