修复未入驻师傅不展示的bug
This commit is contained in:
parent
3bf3f56587
commit
6d72575c0b
|
|
@ -133,19 +133,30 @@ public class WorkerController extends BaseController {
|
|||
|
||||
try {
|
||||
// 查询满足区域条件的师傅区域记录
|
||||
WorkerArea workerArea = new WorkerArea();
|
||||
workerArea.setDistrictId(workerListRequest.getAreaId());
|
||||
List<WorkerArea> workerAreaList = workerAreaService.getWorkerAreaList(workerArea);
|
||||
List<Long> workerIdsByArea = workerAreaList.stream().map(WorkerArea::getWorkerId).collect(Collectors.toList());
|
||||
List<Long> workerIdsByArea;
|
||||
if(workerListRequest.getAreaId() != null){
|
||||
WorkerArea workerArea = new WorkerArea();
|
||||
workerArea.setDistrictId(workerListRequest.getAreaId());
|
||||
List<WorkerArea> workerAreaList = workerAreaService.getWorkerAreaList(workerArea);
|
||||
workerIdsByArea = workerAreaList.stream().map(WorkerArea::getWorkerId).collect(Collectors.toList());
|
||||
}else {
|
||||
workerIdsByArea = new ArrayList<>();
|
||||
}
|
||||
|
||||
// 查询满足技能条件的师傅技能记录
|
||||
WorkerGoodsCategory workerGoodsCategory = new WorkerGoodsCategory();
|
||||
workerGoodsCategory.setGoodsCategoryId(workerListRequest.getGoodsCategoryId());
|
||||
List<WorkerGoodsCategory> workerGoodsCategoryList = workerGoodsCategoryService.getWorkerGoodsCategory(workerGoodsCategory);
|
||||
List<Long> workerIdsByCategory = workerGoodsCategoryList.stream().map(WorkerGoodsCategory::getWorkerId).collect(Collectors.toList());
|
||||
List<Long> workerIdsByCategory;
|
||||
if(workerListRequest.getGoodsCategoryId()!=null){
|
||||
WorkerGoodsCategory workerGoodsCategory = new WorkerGoodsCategory();
|
||||
workerGoodsCategory.setGoodsCategoryId(workerListRequest.getGoodsCategoryId());
|
||||
List<WorkerGoodsCategory> workerGoodsCategoryList = workerGoodsCategoryService.getWorkerGoodsCategory(workerGoodsCategory);
|
||||
workerIdsByCategory = workerGoodsCategoryList.stream().map(WorkerGoodsCategory::getWorkerId).collect(Collectors.toList());
|
||||
}else {
|
||||
workerIdsByCategory = new ArrayList<>();
|
||||
}
|
||||
|
||||
// 两个list中的workerid取交集
|
||||
List<Long> resWorkerIds = new ArrayList<>(CollectionUtils.intersection(workerIdsByArea, workerIdsByCategory));
|
||||
|
||||
if (CollectionUtils.isEmpty(resWorkerIds)) {
|
||||
if (CollectionUtils.isEmpty(resWorkerIds) && (workerListRequest.getAreaId() != null || workerListRequest.getGoodsCategoryId()!=null)) {
|
||||
// 交集不存在的情况直接返回空list
|
||||
return getDataTable(resList);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue