Commit adf15779 authored by huangjiamin's avatar huangjiamin

修改UA的接口

parent d81c7504
......@@ -11,6 +11,7 @@ public enum BrowserErrorCode implements ErrorCode {
INFORMATIONNOTCOMPELETE(BROWSER_BASE + 100, "The information about shop does not complete"),
SHOPNOTEXIST(BROWSER_BASE + 101, "The shop does not exist"),
SHOP_BINDED(BROWSER_BASE + 102, "The shop has bind with ip"),
SHOP_ERROR(BROWSER_BASE + 103, "Shop error!"),
IPNOTEXIST(BROWSER_BASE + 201, "The ip do not exist"),
IPNOTBINDTOSHOP(BROWSER_BASE + 202, "The ip does not bind this shop."),
......
......@@ -2,6 +2,7 @@ package com.edgec.browserbackend.browser.controller;
import com.alibaba.fastjson.JSONObject;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.dto.ShopRequestDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
......@@ -211,6 +212,16 @@ public class ShopController {
return resultDto;
}
@GetMapping("/list")
public List<Shop> getShops(@RequestParam String owner, @RequestParam String shopName) {
return shopService.getShopListByOwner(owner, shopName);
}
@PutMapping
public String putShop(@RequestParam String id, @RequestParam String shopUa) {
return shopService.updateShopUa(id, shopUa);
}
/**
* 针对鹏海的需求
* 当 groupId 传 -1 的时候,查询出来的不应该是所有的店铺,而是所有未分配的店铺
......
......@@ -17,4 +17,6 @@ public interface ShopRepository extends MongoRepository<Shop, String>, ShopRepos
List<Shop> findByShopIdIn(List<String> shopIds);
List<Shop> findByOwnerIn(List<String> owners);
List<Shop> findByOwnerAndShopName(String owner, String shopName);
}
......@@ -487,6 +487,20 @@ public class ShopServiceImpl implements ShopService {
return ShopResultDto.of(shop, userShop.getGroupId(), ipResourceDto);
}
@Override
public List<Shop> getShopListByOwner(String owner, String shopName) {
return shopRepository.findByOwnerAndShopName(owner, shopName);
}
@Override
public String updateShopUa(String id, String shopUa) {
Shop shop = shopRepository.findById(id).orElseThrow(
() -> new ClientRequestException(BrowserErrorCode.SHOP_ERROR, "shop not exists!"));
shop.setShopUA(shopUa);
return shopRepository.save(shop).getShopId();
}
@Override
public ShopPageResultDto getShopList(String username, String groupId, int pageNum, int amount, ShopFilterDto shopFilterDto, String tag) {
long start = System.currentTimeMillis();
......
package com.edgec.browserbackend.browser.service;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.domain.ShopSummary;
import com.edgec.browserbackend.browser.dto.FavoriteUrl;
import com.edgec.browserbackend.browser.dto.ShopFilterDto;
......@@ -67,4 +68,8 @@ public interface ShopService {
List<FavoriteUrl> getFavoritesByShopId(String shopId);
boolean delShopUa(String flag);
List<Shop> getShopListByOwner(String owner, String shopName);
String updateShopUa(String id, String shopUa);
}
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