From 5e32b6b2140121ab2eeaf1c4e667b03c4a8ce938 Mon Sep 17 00:00:00 2001 From: 199901012 Date: Fri, 12 Mar 2021 23:21:22 +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/HighMerchantController.java | 34 ++++++++++++++++++- .../com/hai/service/HighMerchantService.java | 7 ++++ .../service/impl/HighMerchantServiceImpl.java | 11 ++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java index 4e9fdf36..6141bdae 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java @@ -68,7 +68,7 @@ public class HighMerchantController { log.error("HighMerchantController -> updateMerchant() error!","该主角色没有权限"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); } - + if (StringUtils.isBlank(highMerchant.getMerchantKey()) || StringUtils.isBlank(highMerchant.getMerchantName()) || StringUtils.isBlank(highMerchant.getTelephone()) @@ -183,6 +183,38 @@ public class HighMerchantController { } } + @RequestMapping(value="/disableMerchant",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "禁用商户") + public ResponseData disableMerchant(@RequestParam(name = "id", required = true) Long id) { + try { + + highMerchantService.updateStatus(id, 0); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighMerchantController -> disableMerchant() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/enableMerchant",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "启用商户") + public ResponseData enableMerchant(@RequestParam(name = "id", required = true) Long id) { + try { + + highMerchantService.updateStatus(id, 1); + + return ResponseMsgUtil.success("操作成功"); + + } catch (Exception e) { + log.error("HighMerchantController -> enableMerchant() error!",e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/getMerchantList",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询商户列表") diff --git a/hai-service/src/main/java/com/hai/service/HighMerchantService.java b/hai-service/src/main/java/com/hai/service/HighMerchantService.java index 6ab88e7f..a9a34f97 100644 --- a/hai-service/src/main/java/com/hai/service/HighMerchantService.java +++ b/hai-service/src/main/java/com/hai/service/HighMerchantService.java @@ -25,6 +25,13 @@ public interface HighMerchantService { **/ void updateMerchant(HighMerchantModel highMerchant) throws Exception; + /** + * @Author 胡锐 + * @Description 修改状态 + * @Date 2021/3/12 23:13 + **/ + void updateStatus(Long id, Integer status); + /** * 根据id查询 * @param id diff --git a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java index 0c14a360..5374bc4c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.java @@ -66,6 +66,17 @@ public class HighMerchantServiceImpl implements HighMerchantService { } } + @Override + public void updateStatus(Long id, Integer status) { + // 查询商户 + HighMerchantModel merchant = getMerchantById(id); + if(merchant != null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); + } + merchant.setStatus(status); + highMerchantMapper.updateByPrimaryKey(merchant); + } + @Override public HighMerchantModel getMerchantById(Long id) { HighMerchant merchant = highMerchantMapper.selectByPrimaryKey(id);