Commit f40a0752 by weijiguang

新增后台退款接口

parent 1fe2fc95
...@@ -99,6 +99,30 @@ public class ShopController extends BaseController { ...@@ -99,6 +99,30 @@ public class ShopController extends BaseController {
} }
/** /**
* 恢复营业
*/
@PreAuthorize("@ss.hasPermi('system:shop:restart')")
@Log(title = "店铺", businessType = BusinessType.UPDATE)
@GetMapping("/restore/{shopId}")
@ApiOperation("恢复营业")
public AjaxResult restore(@PathVariable Long shopId) {
shopService.restore(shopId);
return AjaxResult.success();
}
/**
* 设置默认店铺
*/
@PreAuthorize("@ss.hasPermi('system:shop:default')")
@Log(title = "店铺", businessType = BusinessType.UPDATE)
@GetMapping("/default/{shopId}")
@ApiOperation("设置默认店铺")
public AjaxResult setDefault(@PathVariable Long shopId) {
shopService.setDefault(shopId);
return AjaxResult.success();
}
/**
* 开始营业 * 开始营业
*/ */
@PreAuthorize("@ss.hasPermi('system:shop:start')") @PreAuthorize("@ss.hasPermi('system:shop:start')")
......
...@@ -37,10 +37,14 @@ public interface IShopService ...@@ -37,10 +37,14 @@ public interface IShopService
void testStart(Long shopId); void testStart(Long shopId);
void setDefault(Long shopId);
void open(Long shopId); void open(Long shopId);
void close(Long shopId); void close(Long shopId);
void restore(Long shopId);
/** /**
* 新增店铺 * 新增店铺
* *
......
...@@ -131,6 +131,19 @@ public class ShopServiceImpl implements IShopService { ...@@ -131,6 +131,19 @@ public class ShopServiceImpl implements IShopService {
} }
@Override @Override
public void setDefault(Long shopId) {
Shop shop = shopMapper.selectShopById(shopId);
Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]");
shopMapper.updateNoDefault();
shop.setUpdatedAt(new Date());
shop.setIsDefault(1L);
shopMapper.updateShop(shop);
}
@Override
public void open(Long shopId) { public void open(Long shopId) {
Shop shop = shopMapper.selectShopById(shopId); Shop shop = shopMapper.selectShopById(shopId);
Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]"); Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]");
...@@ -150,6 +163,16 @@ public class ShopServiceImpl implements IShopService { ...@@ -150,6 +163,16 @@ public class ShopServiceImpl implements IShopService {
shopMapper.updateShop(new Shop(shopId, ShopState.CLOSE.getState())); shopMapper.updateShop(new Shop(shopId, ShopState.CLOSE.getState()));
} }
@Override
public void restore(Long shopId) {
Shop shop = shopMapper.selectShopById(shopId);
Assert.notNull(shop, "未查询到匹配的店铺信息[id=" + shopId + "]");
if (!Objects.equals(shop.getState(), ShopState.DELETE.getState())) {
throw new ServiceException("店铺暂停营业状态下才能正常营业");
}
shopMapper.updateShop(new Shop(shopId, ShopState.OPEN.getState()));
}
/** /**
* 新增店铺 * 新增店铺
* *
...@@ -175,9 +198,9 @@ public class ShopServiceImpl implements IShopService { ...@@ -175,9 +198,9 @@ public class ShopServiceImpl implements IShopService {
@Override @Override
public int updateShop(Shop shop) { public int updateShop(Shop shop) {
shop.setUpdatedAt(new Date()); shop.setUpdatedAt(new Date());
if (1 == shop.getIsDefault()) { // if (1 == shop.getIsDefault()) {
shopMapper.updateNoDefault(); // shopMapper.updateNoDefault();
} // }
if (shop.getDistanceLimit() == null) { if (shop.getDistanceLimit() == null) {
shop.setDistanceLimit(0.0); shop.setDistanceLimit(0.0);
} }
......
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