|
|
|
@ -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("操作成功"); |
|
|
|
|
|
|
|
|
|