|
|
@@ -15,6 +15,8 @@ import com.zsElectric.boot.charging.mapper.ThirdPartyConnectorInfoMapper;
|
|
|
import com.zsElectric.boot.charging.mapper.ThirdPartyEquipmentPricePolicyMapper;
|
|
|
import com.zsElectric.boot.charging.mapper.ThirdPartyPolicyInfoMapper;
|
|
|
import com.zsElectric.boot.charging.mapper.ThirdPartyStationInfoMapper;
|
|
|
+import com.zsElectric.boot.system.model.vo.DictItemOptionVO;
|
|
|
+import com.zsElectric.boot.system.service.DictItemService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -26,7 +28,9 @@ import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -44,8 +48,15 @@ public class PricePolicyManagementServiceImpl implements PricePolicyManagementSe
|
|
|
private final ThirdPartyConnectorInfoMapper connectorInfoMapper;
|
|
|
private final ThirdPartyEquipmentPricePolicyMapper pricePolicyMapper;
|
|
|
private final ThirdPartyPolicyInfoMapper policyInfoMapper;
|
|
|
+ private final DictItemService dictItemService;
|
|
|
|
|
|
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
+
|
|
|
+ // 字典缓存
|
|
|
+ private Map<String, String> constructionTypeMap;
|
|
|
+ private Map<String, String> stationStatusMap;
|
|
|
+ private Map<String, String> stationTypeMap;
|
|
|
+ private Map<String, String> connectorTypeMap;
|
|
|
|
|
|
@Override
|
|
|
public Page<PricePolicyPageVO> queryPricePolicyPage(PricePolicyPageQuery query) {
|
|
|
@@ -85,6 +96,7 @@ public class PricePolicyManagementServiceImpl implements PricePolicyManagementSe
|
|
|
vo.setEquipmentOwner(station.getEquipmentOwnerId());
|
|
|
vo.setAddress(station.getAddress());
|
|
|
vo.setLocationType(getLocationType(station.getConstruction()));
|
|
|
+ vo.setStationType(getStationType(station.getStationType()));
|
|
|
vo.setTerminalCount(getTerminalCount(station.getStationId()));
|
|
|
vo.setStationStatus(getStationStatusText(station.getStationStatus()));
|
|
|
vo.setServiceTel(station.getServiceTel());
|
|
|
@@ -288,8 +300,81 @@ public class PricePolicyManagementServiceImpl implements PricePolicyManagementSe
|
|
|
* 获取场所类型文本
|
|
|
*/
|
|
|
private String getLocationType(Integer construction) {
|
|
|
- // TODO: 根据建设场所代码返回文本
|
|
|
- return "其他";
|
|
|
+ if (construction == null) {
|
|
|
+ return "其他";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 懒加载字典数据
|
|
|
+ if (constructionTypeMap == null) {
|
|
|
+ loadConstructionTypeDict();
|
|
|
+ }
|
|
|
+
|
|
|
+ return constructionTypeMap.getOrDefault(String.valueOf(construction), "其他");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载建设场所类型字典
|
|
|
+ */
|
|
|
+ private void loadConstructionTypeDict() {
|
|
|
+ constructionTypeMap = new HashMap<>();
|
|
|
+ List<DictItemOptionVO> dictItems = dictItemService.getDictItems("charging_construction_type");
|
|
|
+ for (DictItemOptionVO item : dictItems) {
|
|
|
+ constructionTypeMap.put(item.getValue(), item.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取站点类型文本
|
|
|
+ */
|
|
|
+ private String getStationType(Integer stationType) {
|
|
|
+ if (stationType == null) {
|
|
|
+ return "其他";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 懒加载字典数据
|
|
|
+ if (stationTypeMap == null) {
|
|
|
+ loadStationTypeDict();
|
|
|
+ }
|
|
|
+
|
|
|
+ return stationTypeMap.getOrDefault(String.valueOf(stationType), "其他");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载站点类型字典
|
|
|
+ */
|
|
|
+ private void loadStationTypeDict() {
|
|
|
+ stationTypeMap = new HashMap<>();
|
|
|
+ List<DictItemOptionVO> dictItems = dictItemService.getDictItems("charging_station_type");
|
|
|
+ for (DictItemOptionVO item : dictItems) {
|
|
|
+ stationTypeMap.put(item.getValue(), item.getLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取充电设备接口类型文本
|
|
|
+ */
|
|
|
+ public String getConnectorType(Integer connectorType) {
|
|
|
+ if (connectorType == null) {
|
|
|
+ return "其他";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 懒加载字典数据
|
|
|
+ if (connectorTypeMap == null) {
|
|
|
+ loadConnectorTypeDict();
|
|
|
+ }
|
|
|
+
|
|
|
+ return connectorTypeMap.getOrDefault(String.valueOf(connectorType), "其他");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载充电设备接口类型字典
|
|
|
+ */
|
|
|
+ private void loadConnectorTypeDict() {
|
|
|
+ connectorTypeMap = new HashMap<>();
|
|
|
+ List<DictItemOptionVO> dictItems = dictItemService.getDictItems("charging_connector_type");
|
|
|
+ for (DictItemOptionVO item : dictItems) {
|
|
|
+ connectorTypeMap.put(item.getValue(), item.getLabel());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -307,7 +392,26 @@ public class PricePolicyManagementServiceImpl implements PricePolicyManagementSe
|
|
|
* 获取站点状态文本
|
|
|
*/
|
|
|
private String getStationStatusText(Integer status) {
|
|
|
- // TODO: 根据状态代码返回文本
|
|
|
- return "未知";
|
|
|
+ if (status == null) {
|
|
|
+ return "未知";
|
|
|
+ }
|
|
|
+
|
|
|
+ // 懒加载字典数据
|
|
|
+ if (stationStatusMap == null) {
|
|
|
+ loadStationStatusDict();
|
|
|
+ }
|
|
|
+
|
|
|
+ return stationStatusMap.getOrDefault(String.valueOf(status), "未知");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载站点状态字典
|
|
|
+ */
|
|
|
+ private void loadStationStatusDict() {
|
|
|
+ stationStatusMap = new HashMap<>();
|
|
|
+ List<DictItemOptionVO> dictItems = dictItemService.getDictItems("charging_station_status");
|
|
|
+ for (DictItemOptionVO item : dictItems) {
|
|
|
+ stationStatusMap.put(item.getValue(), item.getLabel());
|
|
|
+ }
|
|
|
}
|
|
|
}
|