|
@@ -452,9 +452,10 @@ public class StoreRenovationRequirementServiceImpl extends ServiceImpl<StoreReno
|
|
|
Integer sortType,
|
|
Integer sortType,
|
|
|
String requirementTitle,
|
|
String requirementTitle,
|
|
|
String startTime,
|
|
String startTime,
|
|
|
- String endTime) {
|
|
|
|
|
- log.info("StoreRenovationRequirementServiceImpl.getRequirementPage?storeId={}, city={}, renovationType={}, status={}, auditStatus={}, sortType={}, requirementTitle={}, startTime={}, endTime={}",
|
|
|
|
|
- storeId, city, renovationType, status, auditStatus, sortType, requirementTitle, startTime, endTime);
|
|
|
|
|
|
|
+ String endTime,
|
|
|
|
|
+ Boolean hasCommunicated) {
|
|
|
|
|
+ log.info("StoreRenovationRequirementServiceImpl.getRequirementPage?storeId={}, city={}, renovationType={}, status={}, auditStatus={}, sortType={}, requirementTitle={}, startTime={}, endTime={}, hasCommunicated={}",
|
|
|
|
|
+ storeId, city, renovationType, status, auditStatus, sortType, requirementTitle, startTime, endTime, hasCommunicated);
|
|
|
|
|
|
|
|
LambdaQueryWrapper<StoreRenovationRequirement> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<StoreRenovationRequirement> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(StoreRenovationRequirement::getDeleteFlag, 0);
|
|
wrapper.eq(StoreRenovationRequirement::getDeleteFlag, 0);
|
|
@@ -520,10 +521,22 @@ public class StoreRenovationRequirementServiceImpl extends ServiceImpl<StoreReno
|
|
|
wrapper.orderByDesc(StoreRenovationRequirement::getCreatedTime);
|
|
wrapper.orderByDesc(StoreRenovationRequirement::getCreatedTime);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- IPage<StoreRenovationRequirement> requirementPage = this.page(new Page<>(page.getCurrent(), page.getSize()), wrapper);
|
|
|
|
|
-
|
|
|
|
|
- // 转换为DTO
|
|
|
|
|
- IPage<StoreRenovationRequirementDto> dtoPage = requirementPage.convert(requirement -> {
|
|
|
|
|
|
|
+ // 如果传入了 hasCommunicated 参数,需要先查询所有数据(不分页),计算沟通状态后再过滤和分页
|
|
|
|
|
+ IPage<StoreRenovationRequirement> requirementPage;
|
|
|
|
|
+ List<StoreRenovationRequirement> requirementList;
|
|
|
|
|
+ if (hasCommunicated != null) {
|
|
|
|
|
+ // 查询所有符合条件的数据(不分页)
|
|
|
|
|
+ requirementList = this.list(wrapper);
|
|
|
|
|
+ requirementPage = new Page<>(page.getCurrent(), page.getSize());
|
|
|
|
|
+ requirementPage.setTotal(requirementList.size());
|
|
|
|
|
+ requirementPage.setRecords(new ArrayList<>());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 正常分页查询
|
|
|
|
|
+ requirementPage = this.page(new Page<>(page.getCurrent(), page.getSize()), wrapper);
|
|
|
|
|
+ requirementList = requirementPage.getRecords();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<StoreRenovationRequirementDto> dtoList = requirementList.stream().map(requirement -> {
|
|
|
StoreRenovationRequirementDto dto = new StoreRenovationRequirementDto();
|
|
StoreRenovationRequirementDto dto = new StoreRenovationRequirementDto();
|
|
|
BeanUtils.copyProperties(requirement, dto);
|
|
BeanUtils.copyProperties(requirement, dto);
|
|
|
|
|
|
|
@@ -536,7 +549,12 @@ public class StoreRenovationRequirementServiceImpl extends ServiceImpl<StoreReno
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return dto;
|
|
return dto;
|
|
|
- });
|
|
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 创建分页对象
|
|
|
|
|
+ IPage<StoreRenovationRequirementDto> dtoPage = new Page<>(page.getCurrent(), page.getSize());
|
|
|
|
|
+ dtoPage.setRecords(dtoList);
|
|
|
|
|
+ dtoPage.setTotal(hasCommunicated != null ? dtoList.size() : requirementPage.getTotal());
|
|
|
|
|
|
|
|
// 批量查询商铺信息并填充到DTO
|
|
// 批量查询商铺信息并填充到DTO
|
|
|
if (dtoPage.getRecords() != null && !dtoPage.getRecords().isEmpty()) {
|
|
if (dtoPage.getRecords() != null && !dtoPage.getRecords().isEmpty()) {
|
|
@@ -600,9 +618,9 @@ public class StoreRenovationRequirementServiceImpl extends ServiceImpl<StoreReno
|
|
|
|
|
|
|
|
// 检查是否已查询过该商铺的沟通状态
|
|
// 检查是否已查询过该商铺的沟通状态
|
|
|
String communicationKey = currentUserPhoneId + "_" + publishingShopPhoneId;
|
|
String communicationKey = currentUserPhoneId + "_" + publishingShopPhoneId;
|
|
|
- Boolean hasCommunicated = communicationStatusMap.get(communicationKey);
|
|
|
|
|
|
|
+ Boolean communicated = communicationStatusMap.get(communicationKey);
|
|
|
|
|
|
|
|
- if (hasCommunicated == null) {
|
|
|
|
|
|
|
+ if (communicated == null) {
|
|
|
// 判断互相都发送过消息才算沟通过
|
|
// 判断互相都发送过消息才算沟通过
|
|
|
// 检查 currentUserPhoneId 是否给 publishingShopPhoneId 发送过消息
|
|
// 检查 currentUserPhoneId 是否给 publishingShopPhoneId 发送过消息
|
|
|
LambdaQueryWrapper<LifeMessage> messageWrapper1 = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<LifeMessage> messageWrapper1 = new LambdaQueryWrapper<>();
|
|
@@ -621,11 +639,11 @@ public class StoreRenovationRequirementServiceImpl extends ServiceImpl<StoreReno
|
|
|
boolean hasSentMessage2 = messageCount2 != null && messageCount2 > 0;
|
|
boolean hasSentMessage2 = messageCount2 != null && messageCount2 > 0;
|
|
|
|
|
|
|
|
// 只有双方都发送过消息才算沟通过
|
|
// 只有双方都发送过消息才算沟通过
|
|
|
- hasCommunicated = hasSentMessage1 && hasSentMessage2;
|
|
|
|
|
- communicationStatusMap.put(communicationKey, hasCommunicated);
|
|
|
|
|
|
|
+ communicated = hasSentMessage1 && hasSentMessage2;
|
|
|
|
|
+ communicationStatusMap.put(communicationKey, communicated);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- dto.setHasCommunicated(hasCommunicated);
|
|
|
|
|
|
|
+ dto.setHasCommunicated(communicated);
|
|
|
} else {
|
|
} else {
|
|
|
dto.setHasCommunicated(false);
|
|
dto.setHasCommunicated(false);
|
|
|
}
|
|
}
|
|
@@ -636,6 +654,28 @@ public class StoreRenovationRequirementServiceImpl extends ServiceImpl<StoreReno
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 如果传入了 hasCommunicated 参数,根据沟通状态进行过滤
|
|
|
|
|
+ if (hasCommunicated != null) {
|
|
|
|
|
+ List<StoreRenovationRequirementDto> filteredList = dtoPage.getRecords().stream()
|
|
|
|
|
+ .filter(dto -> hasCommunicated.equals(dto.getHasCommunicated()))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ // 更新总数
|
|
|
|
|
+ dtoPage.setTotal(filteredList.size());
|
|
|
|
|
+
|
|
|
|
|
+ // 手动分页
|
|
|
|
|
+ int current = (int) page.getCurrent();
|
|
|
|
|
+ int size = (int) page.getSize();
|
|
|
|
|
+ int start = (current - 1) * size;
|
|
|
|
|
+ int end = Math.min(start + size, filteredList.size());
|
|
|
|
|
+
|
|
|
|
|
+ if (start < filteredList.size()) {
|
|
|
|
|
+ dtoPage.setRecords(filteredList.subList(start, end));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ dtoPage.setRecords(new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return dtoPage;
|
|
return dtoPage;
|
|
|
}
|
|
}
|
|
|
|
|
|