Commit 1fe2fc95 by weijiguang

新增后台退款接口

parent d06db564
......@@ -101,7 +101,7 @@ public class ShopController extends BaseController {
/**
* 开始营业
*/
@PreAuthorize("@ss.hasPermi('system:shop:open')")
@PreAuthorize("@ss.hasPermi('system:shop:start')")
@Log(title = "店铺", businessType = BusinessType.UPDATE)
@GetMapping("/open/{shopId}")
@ApiOperation("开始营业")
......@@ -111,6 +111,18 @@ public class ShopController extends BaseController {
}
/**
* 暂停营业
*/
@PreAuthorize("@ss.hasPermi('system:shop:suspended')")
@Log(title = "店铺", businessType = BusinessType.UPDATE)
@GetMapping("/close/{shopId}")
@ApiOperation("暂停营业")
public AjaxResult close(@PathVariable Long shopId) {
shopService.close(shopId);
return AjaxResult.success();
}
/**
* 修改店铺
*/
@PreAuthorize("@ss.hasPermi('system:shop:edit')")
......
......@@ -39,6 +39,8 @@ public interface IShopService
void open(Long shopId);
void close(Long shopId);
/**
* 新增店铺
*
......
......@@ -140,6 +140,16 @@ public class ShopServiceImpl implements IShopService {
shopMapper.updateShop(new Shop(shopId, ShopState.OPEN.getState()));
}
@Override
public void close(Long shopId) {
Shop shop = shopMapper.selectShopById(shopId);
Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]");
if (!Objects.equals(shop.getState(), ShopState.OPEN.getState())) {
throw new ServiceException("店铺暂停营业状态下才能正常营业");
}
shopMapper.updateShop(new Shop(shopId, ShopState.CLOSE.getState()));
}
/**
* 新增店铺
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment