|
|
@@ -23,6 +23,7 @@ import org.dromara.common.platform.PlatformUtils;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
import org.dromara.common.tenant.helper.TenantHelper;
|
|
|
import org.dromara.order.api.RemoteSubOrderService;
|
|
|
+import org.dromara.system.api.RemoteAreaStationService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.dromara.archieves.domain.bo.UsrPetBo;
|
|
|
@@ -31,10 +32,7 @@ import org.dromara.archieves.domain.vo.SysTagVo;
|
|
|
import org.dromara.archieves.service.IArcChangeLogService;
|
|
|
import org.dromara.archieves.service.IUsrPetService;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.Collections;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -58,6 +56,8 @@ public class UsrPetServiceImpl implements IUsrPetService {
|
|
|
|
|
|
@DubboReference
|
|
|
private final RemoteSubOrderService remoteSubOrderService;
|
|
|
+ @DubboReference
|
|
|
+ private final RemoteAreaStationService remoteAreaStationService;
|
|
|
|
|
|
@Override
|
|
|
public UsrPetVo queryById(Long id) {
|
|
|
@@ -95,6 +95,15 @@ public class UsrPetServiceImpl implements IUsrPetService {
|
|
|
|
|
|
private LambdaQueryWrapper<UsrPet> buildQueryWrapper(UsrPetBo bo) {
|
|
|
LambdaQueryWrapper<UsrPet> lqw = Wrappers.lambdaQuery();
|
|
|
+
|
|
|
+ if (Platform.isAdmin()) {
|
|
|
+ List<Long> customerIds = new ArrayList<>();
|
|
|
+ customerMapper.selectList(Wrappers.lambdaQuery(UsrCustomer.class).select(UsrCustomer::getId)
|
|
|
+ .in(UsrCustomer::getStationId, WrapperUtils.convertIds(remoteAreaStationService.listByUserId(LoginHelper.getUserId()))))
|
|
|
+ .forEach(e -> customerIds.add(e.getId()));
|
|
|
+ lqw.in(UsrPet::getUserId, WrapperUtils.convertIds(customerIds));
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(bo.getKeyword())) {
|
|
|
// 先查匹配主人名/手机号的userId列表
|
|
|
List<Long> matchUserIds = customerMapper.selectList(
|