Commit 034211b8 authored by lixiang's avatar lixiang

删除指定shopua

parent e0651649
......@@ -10,6 +10,7 @@ import com.edgec.browserbackend.account.service.*;
import com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode;
import com.edgec.browserbackend.browser.domain.PayBack;
import com.edgec.browserbackend.browser.dto.IpListRequestDto;
import com.edgec.browserbackend.browser.service.ShopService;
import com.edgec.browserbackend.browser.service.TempService;
import com.edgec.browserbackend.common.auth.Securitys;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
......@@ -71,6 +72,9 @@ public class AdministratorController {
@Autowired
private PayBackService payBackService;
@Autowired
private ShopService shopService;
//--------------------------------ROOT用户操作--------------------------------------//
//管理员注册tested
@PreAuthorize(Securitys.ROOT_EL)
......@@ -688,6 +692,15 @@ public class AdministratorController {
administratorService.delNotice();
return true;
}
/**
* 删除shopua
*/
@PreAuthorize(Securitys.ADMIN_EL)
@RequestMapping(path = "/0xadministrator/delShopUa/{uaflag}", method = RequestMethod.DELETE)
public boolean delShopUa(@PathVariable String uaflag) {
return shopService.delShopUa(uaflag);
}
}
......
......@@ -806,6 +806,18 @@ public class ShopServiceImpl implements ShopService {
return shop.getFavoritesUrls();
}
@Override
public boolean delShopUa(String uaflag) {
List<ShopUA> all = shopUaRepository.findAll();
for(ShopUA shopUa : all){
List<String> uaList = shopUa.getUaList();
List<String> newUaList = uaList.stream().filter((p) -> !p.contains(uaflag)).collect(Collectors.toList());
shopUa.setUaList(newUaList);
shopUaRepository.save(shopUa);
}
return true;
}
@Override
public boolean saveFavoritesByShopId(String shopId, FavoriteUrl favoriteUrl) {
return shopRepository.saveFavoritesUrls(shopId, favoriteUrl);
......
......@@ -65,4 +65,6 @@ public interface ShopService {
boolean deleteFavoritesByShopId(String shopId, FavoriteUrl favoriteUrl);
List<FavoriteUrl> getFavoritesByShopId(String shopId);
boolean delShopUa(String flag);
}
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