'提交代码'

dev-discount
199901012 4 years ago
parent ecc1c80682
commit 5e32b6b214
  1. 34
      hai-bweb/src/main/java/com/bweb/controller/HighMerchantController.java
  2. 7
      hai-service/src/main/java/com/hai/service/HighMerchantService.java
  3. 11
      hai-service/src/main/java/com/hai/service/impl/HighMerchantServiceImpl.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 = "查询商户列表")

@ -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

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

Loading…
Cancel
Save