Commit f3bc8799 authored by xuxin's avatar xuxin

针对彭海的店铺分组修改

parent 3af04800
...@@ -162,7 +162,27 @@ public class ShopController { ...@@ -162,7 +162,27 @@ public class ShopController {
ResultDto resultDto = new ResultDto(); ResultDto resultDto = new ResultDto();
try { try {
ShopPageResultDto shopDtos = shopService.getShopList(principal.getName(), shopRequestDto.getGroup(), ShopPageResultDto shopDtos = shopService.getShopList(principal.getName(), shopRequestDto.getGroup(),
shopRequestDto.getPage(), shopRequestDto.getAmount(), shopRequestDto.getFilter()); shopRequestDto.getPage(), shopRequestDto.getAmount(), shopRequestDto.getFilter(), null);
resultDto.setData(shopDtos);
resultDto.setStatus(0);
} catch (ClientRequestException e) {
dealClientRequestException(resultDto, e);
}
return resultDto;
}
/**
* 针对鹏海的需求
* 当 groupId 传 -1 的时候,查询出来的不应该是所有的店铺,而是所有未分配的店铺
*/
@RequestMapping(value = "/penghai/list", method = RequestMethod.POST)
public ResultDto getPenghaiShopList(Principal principal, @RequestBody ShopRequestDto shopRequestDto) {
logger.info("shop list params {}", JSONObject.toJSONString(shopRequestDto));
ResultDto resultDto = new ResultDto();
try {
ShopPageResultDto shopDtos = shopService.getShopList(principal.getName(), shopRequestDto.getGroup(),
shopRequestDto.getPage(), shopRequestDto.getAmount(), shopRequestDto.getFilter(), "penghai");
resultDto.setData(shopDtos); resultDto.setData(shopDtos);
resultDto.setStatus(0); resultDto.setStatus(0);
} catch (ClientRequestException e) { } catch (ClientRequestException e) {
......
...@@ -389,11 +389,10 @@ public class ShopServiceImpl implements ShopService { ...@@ -389,11 +389,10 @@ public class ShopServiceImpl implements ShopService {
} }
@Override @Override
public ShopPageResultDto getShopList(String username, String groupId, int pageNum, int amount, ShopFilterDto shopFilterDto) { public ShopPageResultDto getShopList(String username, String groupId, int pageNum, int amount, ShopFilterDto shopFilterDto, String tag) {
// 1. 校验当前登录用户的账户是否存在 // 1. 校验当前登录用户的账户是否存在
Account account = accountRepository.findByName(username).orElseThrow(() -> new ClientRequestException(AccountErrorCode.NAMENOTEXIST)); Account account = accountRepository.findByName(username).orElseThrow(() -> new ClientRequestException(AccountErrorCode.NAMENOTEXIST));
// 2. 如有有分组校验当前查询的分组信息是否正确 // 2. 如有有分组校验当前查询的分组信息是否正确
Group group = null; Group group = null;
if (groupId != null) { if (groupId != null) {
...@@ -405,13 +404,19 @@ public class ShopServiceImpl implements ShopService { ...@@ -405,13 +404,19 @@ public class ShopServiceImpl implements ShopService {
// 3. 根据 groupId 与 username 来查询 shopIds (如果当前用户是父账户,则查询结果包含子账户的shopId) // 3. 根据 groupId 与 username 来查询 shopIds (如果当前用户是父账户,则查询结果包含子账户的shopId)
List<String> allIds = null; List<String> allIds = null;
if ("-1".equals(groupId)) {
allIds = userShopRepository.findByUsername(username).stream() if (!"penghai".equals(tag)) {
.map(UserShop::getShopId).collect(Collectors.toList()); if ("-1".equals(groupId)) {
// 如果分组 allIds = userShopRepository.findByUsername(username).stream().map(UserShop::getShopId).collect(Collectors.toList());
} else { }
allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream() if (!"-1".equals(groupId)) {
.map(UserShop::getShopId).collect(Collectors.toList()); // 如果分组
allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream().map(UserShop::getShopId).collect(Collectors.toList());
}
}
if ("penghai".equals(tag)) {
allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream().map(UserShop::getShopId).collect(Collectors.toList());
} }
// 4. 根据传入的过滤条件得到 shopIds // 4. 根据传入的过滤条件得到 shopIds
......
...@@ -25,7 +25,7 @@ public interface ShopService { ...@@ -25,7 +25,7 @@ public interface ShopService {
ShopResultDto queryShop(String username, String shopId); ShopResultDto queryShop(String username, String shopId);
ShopPageResultDto getShopList(String username, String groupId, int page, int amount, ShopFilterDto shopFilterDto); ShopPageResultDto getShopList(String username, String groupId, int page, int amount, ShopFilterDto shopFilterDto, String tag);
ShopSummary getShopSummary(String username); ShopSummary getShopSummary(String username);
......
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