|
|
@@ -471,6 +471,56 @@ public class StorePaymentConfigController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @ApiOperationSupport(order = 11)
|
|
|
+ @ApiOperation(value = "设置收款账号-保存银行卡", notes = "按 store_user_id 新增或更新银行卡号、开户银行名称(与微信/支付宝配置同一条 store_payment_config 记录)")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "storeUserId", value = "店铺用户ID(store_user.id)", dataType = "int", paramType = "form", required = true),
|
|
|
+ @ApiImplicitParam(name = "bankCardNo", value = "银行卡号", dataType = "string", paramType = "form", required = true),
|
|
|
+ @ApiImplicitParam(name = "bankName", value = "开户银行名称", dataType = "string", paramType = "form", required = true)
|
|
|
+ })
|
|
|
+ @PostMapping("/saveBankByStoreUserId")
|
|
|
+ public R<Integer> saveBankByStoreUserId(
|
|
|
+ @RequestParam Integer storeUserId,
|
|
|
+ @RequestParam String bankCardNo,
|
|
|
+ @RequestParam String bankName) {
|
|
|
+ log.info("StorePaymentConfigController.saveBankByStoreUserId storeUserId={}", storeUserId);
|
|
|
+ if (storeUserId == null) {
|
|
|
+ return R.fail("店铺用户ID不能为空");
|
|
|
+ }
|
|
|
+ if (bankCardNo == null || bankCardNo.trim().isEmpty()) {
|
|
|
+ return R.fail("银行卡号不能为空");
|
|
|
+ }
|
|
|
+ if (bankName == null || bankName.trim().isEmpty()) {
|
|
|
+ return R.fail("银行名称不能为空");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ StoreUser storeUser = storeUserService.getById(storeUserId);
|
|
|
+ if (storeUser == null) {
|
|
|
+ return R.fail("店铺用户不存在");
|
|
|
+ }
|
|
|
+ StorePaymentConfig config = storePaymentConfigService.getByStoreUserId(storeUserId);
|
|
|
+ if (config == null) {
|
|
|
+ config = new StorePaymentConfig();
|
|
|
+ config.setStoreId(storeUser.getStoreId());
|
|
|
+ config.setStoreUserId(storeUserId);
|
|
|
+ config.setAppId("");
|
|
|
+ fillCreatedUser(config);
|
|
|
+ } else {
|
|
|
+ fillUpdatedUser(config);
|
|
|
+ }
|
|
|
+ config.setBankCardNo(bankCardNo.trim());
|
|
|
+ config.setBankName(bankName.trim());
|
|
|
+ boolean ok = config.getId() == null ? storePaymentConfigService.save(config) : storePaymentConfigService.updateById(config);
|
|
|
+ if (!ok) {
|
|
|
+ return R.fail("保存失败");
|
|
|
+ }
|
|
|
+ return R.data(config.getId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("保存银行卡收款信息失败 storeUserId={}", storeUserId, e);
|
|
|
+ return R.fail("保存失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation("分页查询支付配置列表")
|
|
|
@ApiImplicitParams({
|