From 35d64043f8be626176ef20fa117474a2a28e20cd Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 20 Jun 2023 11:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BsPayQrCodeController.java | 34 +++++++++++++++++-- .../service/impl/BsPayQrCodeServiceImpl.java | 2 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/cweb/src/main/java/com/cweb/controller/BsPayQrCodeController.java b/cweb/src/main/java/com/cweb/controller/BsPayQrCodeController.java index 806d86a..1c044fe 100644 --- a/cweb/src/main/java/com/cweb/controller/BsPayQrCodeController.java +++ b/cweb/src/main/java/com/cweb/controller/BsPayQrCodeController.java @@ -133,12 +133,42 @@ public class BsPayQrCodeController { public ResponseData bindStore(@RequestBody JSONObject body) { try { - if (body.getLong("qrCodeId") == null || body.getLong("storeId") == null) { + if ((body.getLong("qrCodeId") == null && StringUtils.isBlank(body.getString("serialNumber"))) || body.getLong("storeId") == null) { log.error("configAccount error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - payQrCodeService.bindStore(body.getLong("storeId"),body.getLong("qrCodeId")); + Long qrCodeId = body.getLong("qrCodeId"); + + if (StringUtils.isNotBlank(body.getString("serialNumber"))) { + BsPayQrCode payQrCode = payQrCodeService.getDetailBySN(body.getString("serialNumber")); + if (payQrCode == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的支付码"); + } + qrCodeId = payQrCode.getId(); + } + payQrCodeService.bindStore(body.getLong("storeId"),qrCodeId); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/unbindStore",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "解绑门店") + public ResponseData unbindStore(@RequestBody JSONObject body) { + try { + + if (body.getLong("qrCodeId") == null) { + log.error("BsDeviceController error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + payQrCodeService.unbindStore(body.getLong("qrCodeId")); return ResponseMsgUtil.success("操作成功"); diff --git a/service/src/main/java/com/hfkj/service/impl/BsPayQrCodeServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsPayQrCodeServiceImpl.java index 5d074a1..70dde27 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsPayQrCodeServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsPayQrCodeServiceImpl.java @@ -260,6 +260,8 @@ public class BsPayQrCodeServiceImpl implements BsPayQrCodeService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "二维码序未绑定门店"); } + qrCode.setSalesmanId(null); + qrCode.setSalesmanName(null); qrCode.setStoreId(null); qrCode.setStoreName(null); qrCode.setStoreBindTime(null);