|
@@ -1,12 +1,21 @@
|
|
package com.slibra.business.service.impl;
|
|
package com.slibra.business.service.impl;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+import com.slibra.business.res.NeighbourhoodAndBuilding;
|
|
|
|
+import com.slibra.business.res.NeighbourhoodAndNumber;
|
|
|
|
+import com.slibra.business.res.PumpAndBuildingNumberNames;
|
|
|
|
+import com.slibra.business.res.PumpAndNumber;
|
|
import com.slibra.common.utils.DateUtils;
|
|
import com.slibra.common.utils.DateUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.slibra.business.mapper.TPumpingStationMapper;
|
|
import com.slibra.business.mapper.TPumpingStationMapper;
|
|
import com.slibra.business.domain.TPumpingStation;
|
|
import com.slibra.business.domain.TPumpingStation;
|
|
import com.slibra.business.service.ITPumpingStationService;
|
|
import com.slibra.business.service.ITPumpingStationService;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 泵站Service业务层处理
|
|
* 泵站Service业务层处理
|
|
@@ -41,7 +50,41 @@ public class TPumpingStationServiceImpl implements ITPumpingStationService
|
|
@Override
|
|
@Override
|
|
public List<TPumpingStation> selectTPumpingStationList(TPumpingStation tPumpingStation)
|
|
public List<TPumpingStation> selectTPumpingStationList(TPumpingStation tPumpingStation)
|
|
{
|
|
{
|
|
- return tPumpingStationMapper.selectTPumpingStationList(tPumpingStation);
|
|
|
|
|
|
+ List<TPumpingStation> pumpingStations = tPumpingStationMapper.selectTPumpingStationList(tPumpingStation);
|
|
|
|
+ //2024年11月12日15:51:43 返回泵站关联的小区信息
|
|
|
|
+ if(!CollectionUtils.isEmpty(pumpingStations)){
|
|
|
|
+ for (TPumpingStation pumpingStation : pumpingStations) {
|
|
|
|
+ this.addNeighbourhoodAndBuildings(pumpingStation);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return pumpingStations;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询泵站关联的小区信息
|
|
|
|
+ * @param pumpingStation
|
|
|
|
+ */
|
|
|
|
+ private void addNeighbourhoodAndBuildings(TPumpingStation pumpingStation) {
|
|
|
|
+ List<NeighbourhoodAndBuilding> list = this.tPumpingStationMapper.getNeighbourhoodAndBuildingByPumpingId(pumpingStation.getId());
|
|
|
|
+ if(!CollectionUtils.isEmpty(list)){
|
|
|
|
+ Map<String, List<NeighbourhoodAndBuilding>> collect = list.stream().collect(Collectors.groupingBy(NeighbourhoodAndBuilding::getNeighborhoodName));
|
|
|
|
+ List<NeighbourhoodAndNumber> result = new ArrayList<>(collect.size());
|
|
|
|
+ collect.forEach((key, value) -> {
|
|
|
|
+ NeighbourhoodAndNumber neighbourhoodAndNumber = new NeighbourhoodAndNumber();
|
|
|
|
+ neighbourhoodAndNumber.setNeighbourhoodName(key);
|
|
|
|
+ neighbourhoodAndNumber.setBuildingsNames(value.stream().map(NeighbourhoodAndBuilding::getNeighborhoodBuildingName).collect(Collectors.joining("、")));
|
|
|
|
+ result.add(neighbourhoodAndNumber);
|
|
|
|
+ });
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ for (int i = 0; i < result.size(); i++) {
|
|
|
|
+ NeighbourhoodAndNumber neighbourhoodAndNumber = result.get(i);
|
|
|
|
+ sb.append(neighbourhoodAndNumber.getNeighbourhoodName()).append("(").append(neighbourhoodAndNumber.getBuildingsNames()).append(")");
|
|
|
|
+ if (i != result.size() - 1) {
|
|
|
|
+ sb.append(",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ pumpingStation.setNeighbourhoodAndBuildings(sb.toString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|