|
@@ -42,6 +42,7 @@ import com.qunzhixinxi.hnqz.admin.service.WmAgentEvaluationService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaAgentService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmDaDrugEntService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmRelationService;
|
|
|
+import com.qunzhixinxi.hnqz.admin.util.AreaUtils;
|
|
|
import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
|
|
|
import com.qunzhixinxi.hnqz.common.core.entity.BaseEntity;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
@@ -67,11 +68,13 @@ import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
+import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* 档案-代理商
|
|
@@ -137,25 +140,41 @@ public class WmDaAgentController {
|
|
|
|
|
|
|
|
|
// 区域限制
|
|
|
- List<Long> areaId;
|
|
|
+ List<Long> entIds = new LinkedList<>();
|
|
|
if (CollUtil.isNotEmpty(wmDaAgent.getAreaCodes())) {
|
|
|
-
|
|
|
- areaId = wmDaAgent.getAreaCodes();
|
|
|
-
|
|
|
+ entIds = enterpriseAreaService.listAreaEnts(wmDaAgent.getAreaCodes());
|
|
|
} else {
|
|
|
- areaId = userAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
|
|
|
+ List<Long> areaId = userAreaService.listUserAreas(Long.valueOf(SecurityUtils.getUser().getId()));
|
|
|
if (CollUtil.isNotEmpty(areaId)) {
|
|
|
- areaId = areaEntityService.list(Wrappers.<SysAreaEntity>lambdaQuery()
|
|
|
- .in(SysAreaEntity::getAreaId, areaId)
|
|
|
- .eq(SysAreaEntity::getAreaStatus, Boolean.TRUE)
|
|
|
- .eq(SysAreaEntity::getAreaType, UpmsType.AreaType.DISTRICT))
|
|
|
- .stream()
|
|
|
- .mapToLong(SysAreaEntity::getAreaId).boxed().distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 集合分片
|
|
|
+
|
|
|
+ List<List<Long>> partition = AreaUtils.partition(areaId);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for (List<Long> p : partition) {
|
|
|
+ List<Long> collect = areaEntityService.list(Wrappers.<SysAreaEntity>lambdaQuery()
|
|
|
+ .in(SysAreaEntity::getAreaId, p)
|
|
|
+ .eq(SysAreaEntity::getAreaStatus, Boolean.TRUE)
|
|
|
+ .eq(SysAreaEntity::getAreaType, UpmsType.AreaType.DISTRICT))
|
|
|
+ .stream()
|
|
|
+ .mapToLong(SysAreaEntity::getAreaId).boxed().distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(collect)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> eIds = enterpriseAreaService.listAreaEnts(collect);
|
|
|
+
|
|
|
+ entIds.addAll(eIds);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- List<Long> entIds = enterpriseAreaService.listAreaEnts(areaId);
|
|
|
+ // List<Long> entIds = enterpriseAreaService.listAreaEnts(areaId);
|
|
|
|
|
|
// 交集
|
|
|
Set<Integer> resSet = new HashSet<>(ids);
|