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