Преглед изворни кода

refactor(business): 调整第三方充电服务模块结构与实现

- 将第三方充电站、充电桩及价格策略服务整合成统一接口ThirdPartyChargingService
- 移除旧的ThirdPartyPricePolicyDataService及ThirdPartyEquipmentInfoService接口及实现
- 重构ChargingBusinessServiceImpl,调用新的统一ThirdPartyChargingService进行数据保存
- 新增ThirdPartyChargingServiceImpl,实现统一的充电站信息、设备信息及价格策略保存和查询逻辑
- 迁移充电桩相关模型、查询条件和VO类到business包中,调整对应Mapper和XML命名空间
- ThirdPartyChargingController调用新服务接口,并新增获取充电桩信息集合接口
- 优化价格策略保存逻辑,避免重复保存相同策略,支持明细比较
- 重命名和调整相关Mapper文件及资源路径,符合新的模块划分和功能统一设计
SheepHy пре 1 дан
родитељ
комит
f555debb15
22 измењених фајлова са 752 додато и 656 уклоњено
  1. 22 10
      src/main/java/com/zsElectric/boot/business/controller/ThirdPartyChargingController.java
  2. 3 3
      src/main/java/com/zsElectric/boot/business/mapper/ThirdPartyEquipmentInfoMapper.java
  3. 38 0
      src/main/java/com/zsElectric/boot/business/mapper/ThirdPartyStationInfoMapper.java
  4. 1 1
      src/main/java/com/zsElectric/boot/business/model/query/ThirdPartyEquipmentInfoQuery.java
  5. 1 1
      src/main/java/com/zsElectric/boot/business/model/query/ThirdPartyStationInfoQuery.java
  6. 13 0
      src/main/java/com/zsElectric/boot/business/model/vo/PartyStationInfoVO.java
  7. 1 1
      src/main/java/com/zsElectric/boot/business/model/vo/ThirdPartyEquipmentInfoVO.java
  8. 1 1
      src/main/java/com/zsElectric/boot/business/model/vo/ThirdPartyStationInfoVO.java
  9. 66 0
      src/main/java/com/zsElectric/boot/business/service/ThirdPartyChargingService.java
  10. 489 0
      src/main/java/com/zsElectric/boot/business/service/impl/ThirdPartyChargingServiceImpl.java
  11. 0 15
      src/main/java/com/zsElectric/boot/charging/mapper/ThirdPartyStationInfoMapper.java
  12. 0 22
      src/main/java/com/zsElectric/boot/charging/service/ThirdPartyEquipmentInfoService.java
  13. 0 19
      src/main/java/com/zsElectric/boot/charging/service/ThirdPartyPricePolicyDataService.java
  14. 0 19
      src/main/java/com/zsElectric/boot/charging/service/ThirdPartyStationDataService.java
  15. 0 22
      src/main/java/com/zsElectric/boot/charging/service/ThirdPartyStationInfoService.java
  16. 4 8
      src/main/java/com/zsElectric/boot/charging/service/impl/ChargingBusinessServiceImpl.java
  17. 0 32
      src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyEquipmentInfoServiceImpl.java
  18. 0 201
      src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyPricePolicyDataServiceImpl.java
  19. 0 242
      src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyStationDataServiceImpl.java
  20. 0 57
      src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyStationInfoServiceImpl.java
  21. 2 2
      src/main/resources/mapper/business/ThirdPartyEquipmentInfoMapper.xml
  22. 111 0
      src/main/resources/mapper/business/ThirdPartyStationInfoMapper.xml

+ 22 - 10
src/main/java/com/zsElectric/boot/business/controller/ThirdPartyChargingController.java

@@ -1,15 +1,16 @@
 package com.zsElectric.boot.business.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.zsElectric.boot.charging.model.query.ThirdPartyStationInfoQuery;
-import com.zsElectric.boot.charging.model.query.ThirdPartyEquipmentInfoQuery;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyStationInfoVO;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyEquipmentInfoVO;
-import com.zsElectric.boot.charging.service.ThirdPartyStationInfoService;
-import com.zsElectric.boot.charging.service.ThirdPartyEquipmentInfoService;
+import com.zsElectric.boot.business.model.query.ThirdPartyStationInfoQuery;
+import com.zsElectric.boot.business.model.query.ThirdPartyEquipmentInfoQuery;
+import com.zsElectric.boot.business.model.vo.PartyStationInfoVO;
+import com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO;
+import com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO;
+import com.zsElectric.boot.business.service.ThirdPartyChargingService;
 import com.zsElectric.boot.common.annotation.Log;
 import com.zsElectric.boot.common.enums.LogModuleEnum;
 import com.zsElectric.boot.core.web.PageResult;
+import com.zsElectric.boot.core.web.Result;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
@@ -18,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * 第三方充电站/充电桩信息查询控制器
  *
@@ -30,14 +33,13 @@ import org.springframework.web.bind.annotation.RestController;
 @RequiredArgsConstructor
 public class ThirdPartyChargingController {
 
-    private final ThirdPartyStationInfoService stationInfoService;
-    private final ThirdPartyEquipmentInfoService equipmentInfoService;
+    private final ThirdPartyChargingService chargingService;
 
     @Operation(summary = "充电站信息分页列表")
     @PostMapping("/stations/page")
     @Log(value = "充电站信息分页列表", module = LogModuleEnum.OTHER)
     public PageResult<ThirdPartyStationInfoVO> getStationInfoPage(@RequestBody ThirdPartyStationInfoQuery queryParams) {
-        IPage<ThirdPartyStationInfoVO> result = stationInfoService.getStationInfoPage(queryParams);
+        IPage<ThirdPartyStationInfoVO> result = chargingService.getStationInfoPage(queryParams);
         return PageResult.success(result);
     }
 
@@ -45,7 +47,17 @@ public class ThirdPartyChargingController {
     @PostMapping("/equipments/page")
     @Log(value = "充电桩信息分页列表", module = LogModuleEnum.OTHER)
     public PageResult<ThirdPartyEquipmentInfoVO> getEquipmentInfoPage(@RequestBody ThirdPartyEquipmentInfoQuery queryParams) {
-        IPage<ThirdPartyEquipmentInfoVO> result = equipmentInfoService.getEquipmentInfoPage(queryParams);
+        IPage<ThirdPartyEquipmentInfoVO> result = chargingService.getEquipmentInfoPage(queryParams);
         return PageResult.success(result);
     }
+
+    /**
+     * 获取充电桩信息集合
+     *
+     */
+    @Operation(summary = "获取充电桩信息集合(下拉使用)")
+    @PostMapping("/equipments/getPartyStationInfo")
+    public Result<List<PartyStationInfoVO>> getPartyStationInfo(){
+        return Result.success(chargingService.getPartyStationInfo());
+    }
 }

+ 3 - 3
src/main/java/com/zsElectric/boot/charging/mapper/ThirdPartyEquipmentInfoMapper.java → src/main/java/com/zsElectric/boot/business/mapper/ThirdPartyEquipmentInfoMapper.java

@@ -1,11 +1,11 @@
-package com.zsElectric.boot.charging.mapper;
+package com.zsElectric.boot.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zsElectric.boot.charging.entity.ThirdPartyEquipmentInfo;
-import com.zsElectric.boot.charging.model.query.ThirdPartyEquipmentInfoQuery;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyEquipmentInfoVO;
+import com.zsElectric.boot.business.model.query.ThirdPartyEquipmentInfoQuery;
+import com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 

+ 38 - 0
src/main/java/com/zsElectric/boot/business/mapper/ThirdPartyStationInfoMapper.java

@@ -0,0 +1,38 @@
+package com.zsElectric.boot.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zsElectric.boot.charging.entity.ThirdPartyStationInfo;
+import com.zsElectric.boot.business.model.query.ThirdPartyStationInfoQuery;
+import com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 第三方充电站信息Mapper接口
+ *
+ * @author system
+ * @since 2025-12-11
+ */
+@Mapper
+public interface ThirdPartyStationInfoMapper extends BaseMapper<ThirdPartyStationInfo> {
+
+    /**
+     * 分页查询充电站信息(联表查询设备数量)
+     *
+     * @param page 分页对象
+     * @param query 查询条件
+     * @return 充电站信息分页列表
+     */
+    IPage<ThirdPartyStationInfoVO> selectStationInfoPage(Page<ThirdPartyStationInfoVO> page, @Param("query") ThirdPartyStationInfoQuery query);
+
+    /**
+     * 分页查询充电站信息(联表查询设备数量,固定设备所属方)
+     *
+     * @param page 分页对象
+     * @param query 查询条件
+     * @return 充电站信息分页列表
+     */
+    IPage<ThirdPartyStationInfoVO> selectStationInfoPageByEquipment(Page<ThirdPartyStationInfoVO> page, @Param("query") ThirdPartyStationInfoQuery query);
+}

+ 1 - 1
src/main/java/com/zsElectric/boot/charging/model/query/ThirdPartyEquipmentInfoQuery.java → src/main/java/com/zsElectric/boot/business/model/query/ThirdPartyEquipmentInfoQuery.java

@@ -1,4 +1,4 @@
-package com.zsElectric.boot.charging.model.query;
+package com.zsElectric.boot.business.model.query;
 
 import com.zsElectric.boot.common.base.BasePageQuery;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 1 - 1
src/main/java/com/zsElectric/boot/charging/model/query/ThirdPartyStationInfoQuery.java → src/main/java/com/zsElectric/boot/business/model/query/ThirdPartyStationInfoQuery.java

@@ -1,4 +1,4 @@
-package com.zsElectric.boot.charging.model.query;
+package com.zsElectric.boot.business.model.query;
 
 import com.zsElectric.boot.common.base.BasePageQuery;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 13 - 0
src/main/java/com/zsElectric/boot/business/model/vo/PartyStationInfoVO.java

@@ -0,0 +1,13 @@
+package com.zsElectric.boot.business.model.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "第三方充电桩信息VO")
+@Data
+public class PartyStationInfoVO {
+    @Schema(description = "主键ID")
+    private Long id;
+    @Schema(description = "充电站名称")
+    private String stationName;
+}

+ 1 - 1
src/main/java/com/zsElectric/boot/charging/model/vo/ThirdPartyEquipmentInfoVO.java → src/main/java/com/zsElectric/boot/business/model/vo/ThirdPartyEquipmentInfoVO.java

@@ -1,4 +1,4 @@
-package com.zsElectric.boot.charging.model.vo;
+package com.zsElectric.boot.business.model.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 1 - 1
src/main/java/com/zsElectric/boot/charging/model/vo/ThirdPartyStationInfoVO.java → src/main/java/com/zsElectric/boot/business/model/vo/ThirdPartyStationInfoVO.java

@@ -1,4 +1,4 @@
-package com.zsElectric.boot.charging.model.vo;
+package com.zsElectric.boot.business.model.vo;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 66 - 0
src/main/java/com/zsElectric/boot/business/service/ThirdPartyChargingService.java

@@ -0,0 +1,66 @@
+package com.zsElectric.boot.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.zsElectric.boot.business.model.query.ThirdPartyEquipmentInfoQuery;
+import com.zsElectric.boot.business.model.query.ThirdPartyStationInfoQuery;
+import com.zsElectric.boot.business.model.vo.PartyStationInfoVO;
+import com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO;
+import com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO;
+import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
+import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
+
+import java.util.List;
+
+/**
+ * 第三方充电站/充电桩/价格策略统一服务接口
+ *
+ * @author system
+ * @since 2025-12-15
+ */
+public interface ThirdPartyChargingService {
+
+    /**
+     * 获取充电站信息分页列表
+     *
+     * @param queryParams 查询参数
+     * @return 充电站信息分页列表
+     */
+    IPage<ThirdPartyStationInfoVO> getStationInfoPage(ThirdPartyStationInfoQuery queryParams);
+
+    /**
+     * 获取充电桩信息分页列表
+     *
+     * @param queryParams 查询参数
+     * @return 充电桩信息分页列表
+     */
+    IPage<ThirdPartyEquipmentInfoVO> getEquipmentInfoPage(ThirdPartyEquipmentInfoQuery queryParams);
+
+    /**
+     * 获取充电桩信息集合
+     *
+     * @return 充电站信息集合
+     */
+    List<PartyStationInfoVO> getPartyStationInfo();
+
+    /**
+     * 保存充电站信息到数据库
+     *
+     * @param queryStationsInfoVO 充电站信息
+     */
+    void saveStationsInfo(QueryStationsInfoVO queryStationsInfoVO);
+
+    /**
+     * 保存价格策略信息
+     *
+     * @param pricePolicyVO 价格策略信息
+     */
+    void savePricePolicyInfo(ChargingPricePolicyVO pricePolicyVO);
+
+    /**
+     * 获取充电站信息分页列表(策略列表)
+     *
+     * @param queryParams 查询参数
+     * @return 充电站信息分页列表
+     */
+    IPage<ThirdPartyStationInfoVO> getStationInfoPageByEquipment(ThirdPartyStationInfoQuery queryParams);
+}

+ 489 - 0
src/main/java/com/zsElectric/boot/business/service/impl/ThirdPartyChargingServiceImpl.java

@@ -0,0 +1,489 @@
+package com.zsElectric.boot.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.zsElectric.boot.charging.entity.*;
+import com.zsElectric.boot.business.mapper.ThirdPartyEquipmentInfoMapper;
+import com.zsElectric.boot.business.mapper.ThirdPartyStationInfoMapper;
+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.business.model.query.ThirdPartyEquipmentInfoQuery;
+import com.zsElectric.boot.business.model.query.ThirdPartyStationInfoQuery;
+import com.zsElectric.boot.business.model.vo.PartyStationInfoVO;
+import com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO;
+import com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO;
+import com.zsElectric.boot.business.service.ThirdPartyChargingService;
+import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
+import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 第三方充电站/充电桩/价格策略统一服务实现
+ *
+ * @author system
+ * @since 2025-12-15
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService {
+
+    private final ThirdPartyStationInfoMapper stationInfoMapper;
+    private final ThirdPartyEquipmentInfoMapper equipmentInfoMapper;
+    private final ThirdPartyConnectorInfoMapper connectorInfoMapper;
+    private final ThirdPartyEquipmentPricePolicyMapper pricePolicyMapper;
+    private final ThirdPartyPolicyInfoMapper policyInfoMapper;
+    private final ObjectMapper objectMapper;
+
+    // ==================== 充电站信息查询 ====================
+
+    @Override
+    public IPage<ThirdPartyStationInfoVO> getStationInfoPage(ThirdPartyStationInfoQuery queryParams) {
+        // 构建分页
+        Page<ThirdPartyStationInfoVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
+
+        // 调用Mapper联表查询
+        return stationInfoMapper.selectStationInfoPage(page, queryParams);
+    }
+
+    // ==================== 充电桩信息查询 ====================
+
+    @Override
+    public IPage<ThirdPartyEquipmentInfoVO> getEquipmentInfoPage(ThirdPartyEquipmentInfoQuery queryParams) {
+        // 构建分页
+        Page<ThirdPartyEquipmentInfoVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
+
+        // 调用Mapper联表查询
+        return equipmentInfoMapper.selectEquipmentInfoPage(page, queryParams);
+    }
+
+    @Override
+    public List<PartyStationInfoVO> getPartyStationInfo() {
+        // 查询所有设备信息
+        List<ThirdPartyEquipmentInfo> equipmentInfos = equipmentInfoMapper.selectList(null);
+
+        // 获取所有不重复的充电站ID
+        List<String> stationIds = equipmentInfos.stream()
+                .map(ThirdPartyEquipmentInfo::getStationId)
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (stationIds.isEmpty()) {
+            return List.of();
+        }
+
+        // 查询充电站信息
+        List<ThirdPartyStationInfo> stationInfos = stationInfoMapper.selectList(
+                new LambdaQueryWrapper<ThirdPartyStationInfo>()
+                        .in(ThirdPartyStationInfo::getStationId, stationIds)
+        );
+
+        // 转换为VO
+        return stationInfos.stream()
+                .map(station -> {
+                    PartyStationInfoVO vo = new PartyStationInfoVO();
+                    vo.setId(station.getId());
+                    vo.setStationName(station.getStationName());
+                    return vo;
+                })
+                .collect(Collectors.toList());
+    }
+
+    // ==================== 充电站数据保存 ====================
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveStationsInfo(QueryStationsInfoVO queryStationsInfoVO) {
+        if (queryStationsInfoVO == null || CollectionUtils.isEmpty(queryStationsInfoVO.getStationInfos())) {
+            log.warn("充电站信息为空,跳过存储");
+            return;
+        }
+
+        List<StationInfo> stationInfos = queryStationsInfoVO.getStationInfos();
+        log.info("开始保存充电站信息,总数: {}", stationInfos.size());
+
+        for (StationInfo stationInfo : stationInfos) {
+            try {
+                // 保存充电站信息
+                saveStationInfo(stationInfo);
+
+                // 保存设备信息
+                if (!CollectionUtils.isEmpty(stationInfo.getEquipmentInfos())) {
+                    for (EquipmentInfo equipmentInfo : stationInfo.getEquipmentInfos()) {
+                        saveEquipmentInfo(equipmentInfo, stationInfo.getStationID());
+
+                        // 保存接口信息
+                        if (!CollectionUtils.isEmpty(equipmentInfo.getConnectorInfos())) {
+                            for (ConnectorInfo connectorInfo : equipmentInfo.getConnectorInfos()) {
+                                saveConnectorInfo(connectorInfo, equipmentInfo.getEquipmentID(), stationInfo.getStationID());
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                log.error("保存充电站信息失败, stationId: {}", stationInfo.getStationID(), e);
+                throw new RuntimeException("保存充电站信息失败: " + stationInfo.getStationID(), e);
+            }
+        }
+
+        log.info("充电站信息保存完成");
+    }
+
+    /**
+     * 保存充电站信息
+     */
+    private void saveStationInfo(StationInfo stationInfo) {
+        // 查询是否已存在
+        ThirdPartyStationInfo existingStation = stationInfoMapper.selectOne(
+                new LambdaQueryWrapper<ThirdPartyStationInfo>()
+                        .eq(ThirdPartyStationInfo::getStationId, stationInfo.getStationID())
+        );
+
+        ThirdPartyStationInfo entity = new ThirdPartyStationInfo();
+        if (existingStation != null) {
+            entity.setId(existingStation.getId());
+        }
+
+        // 设置字段值
+        entity.setStationId(stationInfo.getStationID());
+        entity.setOperatorId(stationInfo.getOperatorID());
+        entity.setEquipmentOwnerId(stationInfo.getEquipmentOwnerID());
+        entity.setStationName(stationInfo.getStationName());
+        entity.setCountryCode(stationInfo.getCountryCode());
+        entity.setAreaCode(stationInfo.getAreaCode());
+        entity.setAddress(stationInfo.getAddress());
+        entity.setStationTel(stationInfo.getStationTel());
+        entity.setServiceTel(stationInfo.getServiceTel());
+        entity.setStationType(stationInfo.getStationType());
+        entity.setStationStatus(stationInfo.getStationStatus());
+        entity.setParkNums(stationInfo.getParkNums());
+
+        // 处理经纬度
+        if (stationInfo.getStationLng() != null) {
+            entity.setStationLng(BigDecimal.valueOf(stationInfo.getStationLng()));
+        }
+        if (stationInfo.getStationLat() != null) {
+            entity.setStationLat(BigDecimal.valueOf(stationInfo.getStationLat()));
+        }
+
+        entity.setSiteGuide(stationInfo.getSiteGuide());
+        entity.setConstruction(stationInfo.getConstruction());
+
+        // 处理图片列表(转JSON)
+        if (!CollectionUtils.isEmpty(stationInfo.getPictures())) {
+            try {
+                entity.setPictures(objectMapper.writeValueAsString(stationInfo.getPictures()));
+            } catch (JsonProcessingException e) {
+                log.warn("图片列表转JSON失败", e);
+            }
+        }
+
+        entity.setBusineHours(stationInfo.getBusineHours());
+
+        // 处理费用(字符串转BigDecimal)
+        if (stationInfo.getElectricityFee() != null) {
+            try {
+                entity.setElectricityFee(new BigDecimal(stationInfo.getElectricityFee()));
+            } catch (NumberFormatException e) {
+                log.warn("电费转换失败: {}", stationInfo.getElectricityFee(), e);
+            }
+        }
+        if (stationInfo.getServiceFee() != null) {
+            try {
+                entity.setServiceFee(new BigDecimal(stationInfo.getServiceFee()));
+            } catch (NumberFormatException e) {
+                log.warn("服务费转换失败: {}", stationInfo.getServiceFee(), e);
+            }
+        }
+
+        entity.setParkFee(stationInfo.getParkFee());
+        entity.setPayment(stationInfo.getPayment());
+        entity.setSupportOrder(stationInfo.getSupportOrder());
+        entity.setRemark(stationInfo.getRemark());
+
+        // 插入或更新
+        if (existingStation == null) {
+            stationInfoMapper.insert(entity);
+        } else {
+            stationInfoMapper.updateById(entity);
+        }
+    }
+
+    /**
+     * 保存充电设备信息
+     */
+    private void saveEquipmentInfo(EquipmentInfo equipmentInfo, String stationId) {
+        // 查询是否已存在
+        ThirdPartyEquipmentInfo existingEquipment = equipmentInfoMapper.selectOne(
+                new LambdaQueryWrapper<ThirdPartyEquipmentInfo>()
+                        .eq(ThirdPartyEquipmentInfo::getEquipmentId, equipmentInfo.getEquipmentID())
+        );
+
+        ThirdPartyEquipmentInfo entity = new ThirdPartyEquipmentInfo();
+        if (existingEquipment != null) {
+            entity.setId(existingEquipment.getId());
+        }
+
+        // 设置字段值
+        entity.setEquipmentId(equipmentInfo.getEquipmentID());
+        entity.setStationId(stationId);
+        entity.setManufacturerId(equipmentInfo.getManufacturerID());
+        entity.setManufacturerName(equipmentInfo.getManufacturerName());
+        entity.setEquipmentModel(equipmentInfo.getEquipmentModel());
+        entity.setProductionDate(equipmentInfo.getProductionDate());
+        entity.setEquipmentType(equipmentInfo.getEquipmentType());
+
+        // 处理经纬度
+        if (equipmentInfo.getEquipmentLng() != null) {
+            entity.setEquipmentLng(BigDecimal.valueOf(equipmentInfo.getEquipmentLng()));
+        }
+        if (equipmentInfo.getEquipmentLat() != null) {
+            entity.setEquipmentLat(BigDecimal.valueOf(equipmentInfo.getEquipmentLat()));
+        }
+
+        // 处理功率
+        if (equipmentInfo.getPower() != null) {
+            entity.setPower(BigDecimal.valueOf(equipmentInfo.getPower()));
+        }
+
+        entity.setEquipmentName(equipmentInfo.getEquipmentName());
+
+        // 插入或更新
+        if (existingEquipment == null) {
+            equipmentInfoMapper.insert(entity);
+        } else {
+            equipmentInfoMapper.updateById(entity);
+        }
+    }
+
+    /**
+     * 保存充电接口信息
+     */
+    private void saveConnectorInfo(ConnectorInfo connectorInfo, String equipmentId, String stationId) {
+        // 查询是否已存在
+        ThirdPartyConnectorInfo existingConnector = connectorInfoMapper.selectOne(
+                new LambdaQueryWrapper<ThirdPartyConnectorInfo>()
+                        .eq(ThirdPartyConnectorInfo::getConnectorId, connectorInfo.getConnectorID())
+        );
+
+        ThirdPartyConnectorInfo entity = new ThirdPartyConnectorInfo();
+        if (existingConnector != null) {
+            entity.setId(existingConnector.getId());
+        }
+
+        // 设置字段值
+        entity.setConnectorId(connectorInfo.getConnectorID());
+        entity.setEquipmentId(equipmentId);
+        entity.setStationId(stationId);
+        entity.setConnectorName(connectorInfo.getConnectorName());
+        entity.setConnectorType(connectorInfo.getConnectorType());
+        entity.setVoltageUpperLimits(connectorInfo.getVoltageUpperLimits());
+        entity.setVoltageLowerLimits(connectorInfo.getVoltageLowerLimits());
+        entity.setCurrent(connectorInfo.getCurrent());
+
+        // 处理功率
+        if (connectorInfo.getPower() != null) {
+            entity.setPower(BigDecimal.valueOf(connectorInfo.getPower()));
+        }
+
+        entity.setParkNo(connectorInfo.getParkNo());
+        entity.setNationalStandard(connectorInfo.getNationalStandard());
+
+        // 插入或更新
+        if (existingConnector == null) {
+            connectorInfoMapper.insert(entity);
+        } else {
+            connectorInfoMapper.updateById(entity);
+        }
+    }
+
+    // ==================== 价格策略数据保存 ====================
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void savePricePolicyInfo(ChargingPricePolicyVO pricePolicyVO) {
+        if (pricePolicyVO == null) {
+            log.warn("价格策略信息为空,跳过存储");
+            return;
+        }
+
+        try {
+            // 查询最新的价格策略记录
+            ThirdPartyEquipmentPricePolicy latestPolicy = getLatestPricePolicy(
+                    pricePolicyVO.getEquipBizSeq(),
+                    pricePolicyVO.getConnectorID()
+            );
+
+            // 如果数据完全相同,不做任何操作
+            if (latestPolicy != null && isPolicySame(latestPolicy, pricePolicyVO)) {
+                log.info("价格策略数据未发生变化,跳过保存 - equipBizSeq: {}, connectorId: {}",
+                        pricePolicyVO.getEquipBizSeq(), pricePolicyVO.getConnectorID());
+                return;
+            }
+
+            // 数据发生变化,插入新记录
+            Long policyId = insertNewPricePolicy(pricePolicyVO);
+
+            // 保存价格策略明细
+            if (!CollectionUtils.isEmpty(pricePolicyVO.getPolicyInfos())) {
+                for (ChargingPricePolicyVO.PolicyInfo policyInfo : pricePolicyVO.getPolicyInfos()) {
+                    savePolicyInfoDetail(policyInfo, policyId);
+                }
+            }
+
+            log.info("价格策略信息保存成功(新增记录) - equipBizSeq: {}, connectorId: {}, policyId: {}",
+                    pricePolicyVO.getEquipBizSeq(), pricePolicyVO.getConnectorID(), policyId);
+
+        } catch (Exception e) {
+            log.error("保存价格策略信息失败 - equipBizSeq: {}, connectorId: {}",
+                    pricePolicyVO.getEquipBizSeq(), pricePolicyVO.getConnectorID(), e);
+            throw new RuntimeException("保存价格策略信息失败", e);
+        }
+    }
+
+    @Override
+    public IPage<ThirdPartyStationInfoVO> getStationInfoPageByEquipment(ThirdPartyStationInfoQuery queryParams) {
+        // 构建分页
+        Page<ThirdPartyStationInfoVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
+        // 调用Mapper联表查询(固定设备所属方MA6DP6BE7)
+        return stationInfoMapper.selectStationInfoPageByEquipment(page, queryParams);
+    }
+
+    /**
+     * 获取最新的价格策略记录
+     */
+    private ThirdPartyEquipmentPricePolicy getLatestPricePolicy(String equipBizSeq, String connectorId) {
+        List<ThirdPartyEquipmentPricePolicy> policies = pricePolicyMapper.selectList(
+                Wrappers.<ThirdPartyEquipmentPricePolicy>lambdaQuery()
+                        .eq(ThirdPartyEquipmentPricePolicy::getEquipBizSeq, equipBizSeq)
+                        .eq(ThirdPartyEquipmentPricePolicy::getConnectorId, connectorId)
+                        .orderByDesc(ThirdPartyEquipmentPricePolicy::getCreateTime)
+                        .last("LIMIT 1")
+        );
+
+        return CollectionUtils.isEmpty(policies) ? null : policies.get(0);
+    }
+
+    /**
+     * 判断价格策略是否相同(比较主表和明细表)
+     */
+    private boolean isPolicySame(ThirdPartyEquipmentPricePolicy latestPolicy, ChargingPricePolicyVO newPolicy) {
+        // 比较主表字段
+        if (!Objects.equals(latestPolicy.getSuccStat(), newPolicy.getSuccStat()) ||
+                !Objects.equals(latestPolicy.getFailReason(), newPolicy.getFailReason()) ||
+                !Objects.equals(latestPolicy.getSumPeriod(), newPolicy.getSumPeriod())) {
+            return false;
+        }
+
+        // 查询明细表数据
+        List<ThirdPartyPolicyInfo> existingDetails = policyInfoMapper.selectList(
+                Wrappers.<ThirdPartyPolicyInfo>lambdaQuery()
+                        .eq(ThirdPartyPolicyInfo::getPricePolicyId, latestPolicy.getId())
+                        .orderBy(true, true, ThirdPartyPolicyInfo::getStartTime)
+        );
+
+        // 比较明细表
+        return isPolicyDetailsSame(existingDetails, newPolicy.getPolicyInfos());
+    }
+
+    /**
+     * 比较价格策略明细是否相同
+     */
+    private boolean isPolicyDetailsSame(List<ThirdPartyPolicyInfo> existingDetails,
+                                        List<ChargingPricePolicyVO.PolicyInfo> newDetails) {
+        if (CollectionUtils.isEmpty(existingDetails) && CollectionUtils.isEmpty(newDetails)) {
+            return true;
+        }
+
+        if (CollectionUtils.isEmpty(existingDetails) || CollectionUtils.isEmpty(newDetails)) {
+            return false;
+        }
+
+        if (existingDetails.size() != newDetails.size()) {
+            return false;
+        }
+
+        // 按 StartTime 排序后比较
+        List<ChargingPricePolicyVO.PolicyInfo> sortedNewDetails = newDetails.stream()
+                .sorted(Comparator.comparing(ChargingPricePolicyVO.PolicyInfo::getStartTime))
+                .collect(Collectors.toList());
+
+        for (int i = 0; i < existingDetails.size(); i++) {
+            ThirdPartyPolicyInfo existing = existingDetails.get(i);
+            ChargingPricePolicyVO.PolicyInfo newDetail = sortedNewDetails.get(i);
+
+            if (!Objects.equals(existing.getStartTime(), newDetail.getStartTime()) ||
+                    !isBigDecimalEqual(existing.getElecPrice(), newDetail.getElecPrice()) ||
+                    !isBigDecimalEqual(existing.getServicePrice(), newDetail.getServicePrice()) ||
+                    !Objects.equals(existing.getPeriodFlag(), newDetail.getPeriodFlag())) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * 比较 BigDecimal 是否相等(处理 null 情况)
+     */
+    private boolean isBigDecimalEqual(BigDecimal a, BigDecimal b) {
+        if (a == null && b == null) {
+            return true;
+        }
+        if (a == null || b == null) {
+            return false;
+        }
+        return a.compareTo(b) == 0;
+    }
+
+    /**
+     * 插入新的价格策略记录
+     */
+    private Long insertNewPricePolicy(ChargingPricePolicyVO pricePolicyVO) {
+        ThirdPartyEquipmentPricePolicy entity = new ThirdPartyEquipmentPricePolicy();
+
+        // 设置字段值
+        entity.setEquipBizSeq(pricePolicyVO.getEquipBizSeq());
+        entity.setConnectorId(pricePolicyVO.getConnectorID());
+        entity.setSuccStat(pricePolicyVO.getSuccStat());
+        entity.setFailReason(pricePolicyVO.getFailReason());
+        entity.setSumPeriod(pricePolicyVO.getSumPeriod());
+        entity.setCreateTime(LocalDateTime.now());
+
+        // 插入新记录
+        pricePolicyMapper.insert(entity);
+
+        return entity.getId();
+    }
+
+    /**
+     * 保存价格策略明细
+     */
+    private void savePolicyInfoDetail(ChargingPricePolicyVO.PolicyInfo policyInfo, Long policyId) {
+        ThirdPartyPolicyInfo entity = new ThirdPartyPolicyInfo();
+        entity.setPricePolicyId(policyId);
+        entity.setStartTime(policyInfo.getStartTime());
+        entity.setElecPrice(policyInfo.getElecPrice());
+        entity.setServicePrice(policyInfo.getServicePrice());
+        entity.setPeriodFlag(policyInfo.getPeriodFlag());
+        entity.setCreateTime(LocalDateTime.now());
+
+        policyInfoMapper.insert(entity);
+    }
+}

+ 0 - 15
src/main/java/com/zsElectric/boot/charging/mapper/ThirdPartyStationInfoMapper.java

@@ -1,15 +0,0 @@
-package com.zsElectric.boot.charging.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zsElectric.boot.charging.entity.ThirdPartyStationInfo;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * 第三方充电站信息Mapper接口
- *
- * @author system
- * @since 2025-12-11
- */
-@Mapper
-public interface ThirdPartyStationInfoMapper extends BaseMapper<ThirdPartyStationInfo> {
-}

+ 0 - 22
src/main/java/com/zsElectric/boot/charging/service/ThirdPartyEquipmentInfoService.java

@@ -1,22 +0,0 @@
-package com.zsElectric.boot.charging.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.zsElectric.boot.charging.model.query.ThirdPartyEquipmentInfoQuery;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyEquipmentInfoVO;
-
-/**
- * 第三方充电桩信息服务接口
- *
- * @author system
- * @since 2025-12-11
- */
-public interface ThirdPartyEquipmentInfoService {
-
-    /**
-     * 获取充电桩信息分页列表
-     *
-     * @param queryParams 查询参数
-     * @return 充电桩信息分页列表
-     */
-    IPage<ThirdPartyEquipmentInfoVO> getEquipmentInfoPage(ThirdPartyEquipmentInfoQuery queryParams);
-}

+ 0 - 19
src/main/java/com/zsElectric/boot/charging/service/ThirdPartyPricePolicyDataService.java

@@ -1,19 +0,0 @@
-package com.zsElectric.boot.charging.service;
-
-import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
-
-/**
- * 第三方价格策略数据存储服务
- *
- * @author system
- * @since 2025-12-12
- */
-public interface ThirdPartyPricePolicyDataService {
-
-    /**
-     * 保存价格策略信息
-     *
-     * @param pricePolicyVO 价格策略信息
-     */
-    void savePricePolicyInfo(ChargingPricePolicyVO pricePolicyVO);
-}

+ 0 - 19
src/main/java/com/zsElectric/boot/charging/service/ThirdPartyStationDataService.java

@@ -1,19 +0,0 @@
-package com.zsElectric.boot.charging.service;
-
-import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
-
-/**
- * 第三方充电站数据存储服务
- *
- * @author system
- * @since 2025-12-11
- */
-public interface ThirdPartyStationDataService {
-
-    /**
-     * 保存充电站信息到数据库
-     *
-     * @param queryStationsInfoVO 充电站信息
-     */
-    void saveStationsInfo(QueryStationsInfoVO queryStationsInfoVO);
-}

+ 0 - 22
src/main/java/com/zsElectric/boot/charging/service/ThirdPartyStationInfoService.java

@@ -1,22 +0,0 @@
-package com.zsElectric.boot.charging.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.zsElectric.boot.charging.model.query.ThirdPartyStationInfoQuery;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyStationInfoVO;
-
-/**
- * 第三方充电站信息服务接口
- *
- * @author system
- * @since 2025-12-11
- */
-public interface ThirdPartyStationInfoService {
-
-    /**
-     * 获取充电站信息分页列表
-     *
-     * @param queryParams 查询参数
-     * @return 充电站信息分页列表
-     */
-    IPage<ThirdPartyStationInfoVO> getStationInfoPage(ThirdPartyStationInfoQuery queryParams);
-}

+ 4 - 8
src/main/java/com/zsElectric/boot/charging/service/impl/ChargingBusinessServiceImpl.java

@@ -7,13 +7,11 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.zsElectric.boot.charging.dto.StartChargingRequestDTO;
 import com.zsElectric.boot.charging.dto.StartChargingResponseVO;
 import com.zsElectric.boot.charging.service.ChargingBusinessService;
-import com.zsElectric.boot.charging.service.ThirdPartyPricePolicyDataService;
-import com.zsElectric.boot.charging.service.ThirdPartyStationDataService;
+import com.zsElectric.boot.business.service.ThirdPartyChargingService;
 import com.zsElectric.boot.charging.vo.*;
 import com.zsElectric.boot.common.constant.ConnectivityConstants;
 import com.zsElectric.boot.common.util.AESCryptoUtils;
 import com.zsElectric.boot.common.util.HmacMD5Util;
-import com.zsElectric.boot.common.util.SequenceGenUtil;
 import com.zsElectric.boot.common.util.electric.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -23,7 +21,6 @@ import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 
 
 @Slf4j
@@ -32,8 +29,7 @@ import java.util.Objects;
 public class ChargingBusinessServiceImpl implements ChargingBusinessService {
 
     private final ChargingUtil chargingUtil;
-    private final ThirdPartyStationDataService thirdPartyStationDataService;
-    private final ThirdPartyPricePolicyDataService thirdPartyPricePolicyDataService;
+    private final ThirdPartyChargingService thirdPartyChargingService;
 
     private final ObjectMapper objectMapper = new ObjectMapper();
 
@@ -113,7 +109,7 @@ public class ChargingBusinessServiceImpl implements ChargingBusinessService {
         
         // 保存价格策略信息到数据库
         try {
-            thirdPartyPricePolicyDataService.savePricePolicyInfo(result);
+            thirdPartyChargingService.savePricePolicyInfo(result);
         } catch (Exception e) {
             log.error("保存价格策略信息到数据库失败", e);
         }
@@ -152,7 +148,7 @@ public class ChargingBusinessServiceImpl implements ChargingBusinessService {
         
         // 保存充电站信息到数据库
         try {
-            thirdPartyStationDataService.saveStationsInfo(result);
+            thirdPartyChargingService.saveStationsInfo(result);
         } catch (Exception e) {
             log.error("保存充电站信息到数据库失败", e);
         }

+ 0 - 32
src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyEquipmentInfoServiceImpl.java

@@ -1,32 +0,0 @@
-package com.zsElectric.boot.charging.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zsElectric.boot.charging.mapper.ThirdPartyEquipmentInfoMapper;
-import com.zsElectric.boot.charging.model.query.ThirdPartyEquipmentInfoQuery;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyEquipmentInfoVO;
-import com.zsElectric.boot.charging.service.ThirdPartyEquipmentInfoService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-
-/**
- * 第三方充电桩信息服务实现
- *
- * @author system
- * @since 2025-12-11
- */
-@Service
-@RequiredArgsConstructor
-public class ThirdPartyEquipmentInfoServiceImpl implements ThirdPartyEquipmentInfoService {
-
-    private final ThirdPartyEquipmentInfoMapper equipmentInfoMapper;
-
-    @Override
-    public IPage<ThirdPartyEquipmentInfoVO> getEquipmentInfoPage(ThirdPartyEquipmentInfoQuery queryParams) {
-        // 构建分页
-        Page<ThirdPartyEquipmentInfoVO> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
-
-        // 调用Mapper联表查询
-        return equipmentInfoMapper.selectEquipmentInfoPage(page, queryParams);
-    }
-}

+ 0 - 201
src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyPricePolicyDataServiceImpl.java

@@ -1,201 +0,0 @@
-package com.zsElectric.boot.charging.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.zsElectric.boot.charging.entity.ThirdPartyEquipmentPricePolicy;
-import com.zsElectric.boot.charging.entity.ThirdPartyPolicyInfo;
-import com.zsElectric.boot.charging.mapper.ThirdPartyEquipmentPricePolicyMapper;
-import com.zsElectric.boot.charging.mapper.ThirdPartyPolicyInfoMapper;
-import com.zsElectric.boot.charging.service.ThirdPartyPricePolicyDataService;
-import com.zsElectric.boot.charging.vo.ChargingPricePolicyVO;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * 第三方价格策略数据存储服务实现
- *
- * @author system
- * @since 2025-12-12
- */
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class ThirdPartyPricePolicyDataServiceImpl implements ThirdPartyPricePolicyDataService {
-
-    private final ThirdPartyEquipmentPricePolicyMapper pricePolicyMapper;
-    private final ThirdPartyPolicyInfoMapper policyInfoMapper;
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void savePricePolicyInfo(ChargingPricePolicyVO pricePolicyVO) {
-        if (pricePolicyVO == null) {
-            log.warn("价格策略信息为空,跳过存储");
-            return;
-        }
-
-        try {
-            // 查询最新的价格策略记录
-            ThirdPartyEquipmentPricePolicy latestPolicy = getLatestPricePolicy(
-                    pricePolicyVO.getEquipBizSeq(), 
-                    pricePolicyVO.getConnectorID()
-            );
-
-            // 如果数据完全相同,不做任何操作
-            if (latestPolicy != null && isPolicySame(latestPolicy, pricePolicyVO)) {
-                log.info("价格策略数据未发生变化,跳过保存 - equipBizSeq: {}, connectorId: {}", 
-                        pricePolicyVO.getEquipBizSeq(), pricePolicyVO.getConnectorID());
-                return;
-            }
-
-            // 数据发生变化,插入新记录
-            Long policyId = insertNewPricePolicy(pricePolicyVO);
-
-            // 保存价格策略明细
-            if (!CollectionUtils.isEmpty(pricePolicyVO.getPolicyInfos())) {
-                for (ChargingPricePolicyVO.PolicyInfo policyInfo : pricePolicyVO.getPolicyInfos()) {
-                    savePolicyInfoDetail(policyInfo, policyId);
-                }
-            }
-
-            log.info("价格策略信息保存成功(新增记录) - equipBizSeq: {}, connectorId: {}, policyId: {}", 
-                    pricePolicyVO.getEquipBizSeq(), pricePolicyVO.getConnectorID(), policyId);
-
-        } catch (Exception e) {
-            log.error("保存价格策略信息失败 - equipBizSeq: {}, connectorId: {}", 
-                    pricePolicyVO.getEquipBizSeq(), pricePolicyVO.getConnectorID(), e);
-            throw new RuntimeException("保存价格策略信息失败", e);
-        }
-    }
-
-    /**
-     * 获取最新的价格策略记录
-     */
-    private ThirdPartyEquipmentPricePolicy getLatestPricePolicy(String equipBizSeq, String connectorId) {
-        List<ThirdPartyEquipmentPricePolicy> policies = pricePolicyMapper.selectList(
-                Wrappers.<ThirdPartyEquipmentPricePolicy>lambdaQuery()
-                        .eq(ThirdPartyEquipmentPricePolicy::getEquipBizSeq, equipBizSeq)
-                        .eq(ThirdPartyEquipmentPricePolicy::getConnectorId, connectorId)
-                        .orderByDesc(ThirdPartyEquipmentPricePolicy::getCreateTime)
-                        .last("LIMIT 1")
-        );
-        
-        return CollectionUtils.isEmpty(policies) ? null : policies.get(0);
-    }
-
-    /**
-     * 判断价格策略是否相同(比较主表和明细表)
-     */
-    private boolean isPolicySame(ThirdPartyEquipmentPricePolicy latestPolicy, ChargingPricePolicyVO newPolicy) {
-        // 比较主表字段
-        if (!Objects.equals(latestPolicy.getSuccStat(), newPolicy.getSuccStat()) ||
-            !Objects.equals(latestPolicy.getFailReason(), newPolicy.getFailReason()) ||
-            !Objects.equals(latestPolicy.getSumPeriod(), newPolicy.getSumPeriod())) {
-            return false;
-        }
-
-        // 查询明细表数据
-        List<ThirdPartyPolicyInfo> existingDetails = policyInfoMapper.selectList(
-                Wrappers.<ThirdPartyPolicyInfo>lambdaQuery()
-                        .eq(ThirdPartyPolicyInfo::getPricePolicyId, latestPolicy.getId())
-                        .orderBy(true, true, ThirdPartyPolicyInfo::getStartTime)
-        );
-
-        // 比较明细表
-        return isPolicyDetailsSame(existingDetails, newPolicy.getPolicyInfos());
-    }
-
-    /**
-     * 比较价格策略明细是否相同
-     */
-    private boolean isPolicyDetailsSame(List<ThirdPartyPolicyInfo> existingDetails, 
-                                        List<ChargingPricePolicyVO.PolicyInfo> newDetails) {
-        if (CollectionUtils.isEmpty(existingDetails) && CollectionUtils.isEmpty(newDetails)) {
-            return true;
-        }
-        
-        if (CollectionUtils.isEmpty(existingDetails) || CollectionUtils.isEmpty(newDetails)) {
-            return false;
-        }
-        
-        if (existingDetails.size() != newDetails.size()) {
-            return false;
-        }
-
-        // 按 StartTime 排序后比较
-        List<ChargingPricePolicyVO.PolicyInfo> sortedNewDetails = newDetails.stream()
-                .sorted(Comparator.comparing(ChargingPricePolicyVO.PolicyInfo::getStartTime))
-                .collect(Collectors.toList());
-
-        for (int i = 0; i < existingDetails.size(); i++) {
-            ThirdPartyPolicyInfo existing = existingDetails.get(i);
-            ChargingPricePolicyVO.PolicyInfo newDetail = sortedNewDetails.get(i);
-
-            if (!Objects.equals(existing.getStartTime(), newDetail.getStartTime()) ||
-                !isBigDecimalEqual(existing.getElecPrice(), newDetail.getElecPrice()) ||
-                !isBigDecimalEqual(existing.getServicePrice(), newDetail.getServicePrice()) ||
-                !Objects.equals(existing.getPeriodFlag(), newDetail.getPeriodFlag())) {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * 比较 BigDecimal 是否相等(处理 null 情况)
-     */
-    private boolean isBigDecimalEqual(BigDecimal a, BigDecimal b) {
-        if (a == null && b == null) {
-            return true;
-        }
-        if (a == null || b == null) {
-            return false;
-        }
-        return a.compareTo(b) == 0;
-    }
-
-    /**
-     * 插入新的价格策略记录
-     */
-    private Long insertNewPricePolicy(ChargingPricePolicyVO pricePolicyVO) {
-        ThirdPartyEquipmentPricePolicy entity = new ThirdPartyEquipmentPricePolicy();
-        
-        // 设置字段值
-        entity.setEquipBizSeq(pricePolicyVO.getEquipBizSeq());
-        entity.setConnectorId(pricePolicyVO.getConnectorID());
-        entity.setSuccStat(pricePolicyVO.getSuccStat());
-        entity.setFailReason(pricePolicyVO.getFailReason());
-        entity.setSumPeriod(pricePolicyVO.getSumPeriod());
-        entity.setCreateTime(LocalDateTime.now());
-
-        // 插入新记录
-        pricePolicyMapper.insert(entity);
-
-        return entity.getId();
-    }
-
-    /**
-     * 保存价格策略明细
-     */
-    private void savePolicyInfoDetail(ChargingPricePolicyVO.PolicyInfo policyInfo, Long policyId) {
-        ThirdPartyPolicyInfo entity = new ThirdPartyPolicyInfo();
-        entity.setPricePolicyId(policyId);
-        entity.setStartTime(policyInfo.getStartTime());
-        entity.setElecPrice(policyInfo.getElecPrice());
-        entity.setServicePrice(policyInfo.getServicePrice());
-        entity.setPeriodFlag(policyInfo.getPeriodFlag());
-        entity.setCreateTime(LocalDateTime.now());
-
-        policyInfoMapper.insert(entity);
-    }
-}

+ 0 - 242
src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyStationDataServiceImpl.java

@@ -1,242 +0,0 @@
-package com.zsElectric.boot.charging.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.zsElectric.boot.charging.entity.*;
-import com.zsElectric.boot.charging.mapper.ThirdPartyConnectorInfoMapper;
-import com.zsElectric.boot.charging.mapper.ThirdPartyEquipmentInfoMapper;
-import com.zsElectric.boot.charging.mapper.ThirdPartyStationInfoMapper;
-import com.zsElectric.boot.charging.service.ThirdPartyStationDataService;
-import com.zsElectric.boot.charging.vo.QueryStationsInfoVO;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 第三方充电站数据存储服务实现
- *
- * @author system
- * @since 2025-12-11
- */
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class ThirdPartyStationDataServiceImpl implements ThirdPartyStationDataService {
-
-    private final ThirdPartyStationInfoMapper stationInfoMapper;
-    private final ThirdPartyEquipmentInfoMapper equipmentInfoMapper;
-    private final ThirdPartyConnectorInfoMapper connectorInfoMapper;
-    private final ObjectMapper objectMapper;
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void saveStationsInfo(QueryStationsInfoVO queryStationsInfoVO) {
-        if (queryStationsInfoVO == null || CollectionUtils.isEmpty(queryStationsInfoVO.getStationInfos())) {
-            log.warn("充电站信息为空,跳过存储");
-            return;
-        }
-
-        List<StationInfo> stationInfos = queryStationsInfoVO.getStationInfos();
-        log.info("开始保存充电站信息,总数: {}", stationInfos.size());
-
-        for (StationInfo stationInfo : stationInfos) {
-            try {
-                // 保存充电站信息
-                saveStationInfo(stationInfo);
-
-                // 保存设备信息
-                if (!CollectionUtils.isEmpty(stationInfo.getEquipmentInfos())) {
-                    for (EquipmentInfo equipmentInfo : stationInfo.getEquipmentInfos()) {
-                        saveEquipmentInfo(equipmentInfo, stationInfo.getStationID());
-
-                        // 保存接口信息
-                        if (!CollectionUtils.isEmpty(equipmentInfo.getConnectorInfos())) {
-                            for (ConnectorInfo connectorInfo : equipmentInfo.getConnectorInfos()) {
-                                saveConnectorInfo(connectorInfo, equipmentInfo.getEquipmentID(), stationInfo.getStationID());
-                            }
-                        }
-                    }
-                }
-            } catch (Exception e) {
-                log.error("保存充电站信息失败, stationId: {}", stationInfo.getStationID(), e);
-                throw new RuntimeException("保存充电站信息失败: " + stationInfo.getStationID(), e);
-            }
-        }
-
-        log.info("充电站信息保存完成");
-    }
-
-    /**
-     * 保存充电站信息
-     */
-    private void saveStationInfo(StationInfo stationInfo) {
-        // 查询是否已存在
-        ThirdPartyStationInfo existingStation = stationInfoMapper.selectOne(
-                new LambdaQueryWrapper<ThirdPartyStationInfo>()
-                        .eq(ThirdPartyStationInfo::getStationId, stationInfo.getStationID())
-        );
-
-        ThirdPartyStationInfo entity = new ThirdPartyStationInfo();
-        if (existingStation != null) {
-            entity.setId(existingStation.getId());
-        }
-
-        // 设置字段值
-        entity.setStationId(stationInfo.getStationID());
-        entity.setOperatorId(stationInfo.getOperatorID());
-        entity.setEquipmentOwnerId(stationInfo.getEquipmentOwnerID());
-        entity.setStationName(stationInfo.getStationName());
-        entity.setCountryCode(stationInfo.getCountryCode());
-        entity.setAreaCode(stationInfo.getAreaCode());
-        entity.setAddress(stationInfo.getAddress());
-        entity.setStationTel(stationInfo.getStationTel());
-        entity.setServiceTel(stationInfo.getServiceTel());
-        entity.setStationType(stationInfo.getStationType());
-        entity.setStationStatus(stationInfo.getStationStatus());
-        entity.setParkNums(stationInfo.getParkNums());
-        
-        // 处理经纬度
-        if (stationInfo.getStationLng() != null) {
-            entity.setStationLng(BigDecimal.valueOf(stationInfo.getStationLng()));
-        }
-        if (stationInfo.getStationLat() != null) {
-            entity.setStationLat(BigDecimal.valueOf(stationInfo.getStationLat()));
-        }
-        
-        entity.setSiteGuide(stationInfo.getSiteGuide());
-        entity.setConstruction(stationInfo.getConstruction());
-        
-        // 处理图片列表(转JSON)
-        if (!CollectionUtils.isEmpty(stationInfo.getPictures())) {
-            try {
-                entity.setPictures(objectMapper.writeValueAsString(stationInfo.getPictures()));
-            } catch (JsonProcessingException e) {
-                log.warn("图片列表转JSON失败", e);
-            }
-        }
-        
-        entity.setBusineHours(stationInfo.getBusineHours());
-        
-        // 处理费用(字符串转BigDecimal)
-        if (stationInfo.getElectricityFee() != null) {
-            try {
-                entity.setElectricityFee(new BigDecimal(stationInfo.getElectricityFee()));
-            } catch (NumberFormatException e) {
-                log.warn("电费转换失败: {}", stationInfo.getElectricityFee(), e);
-            }
-        }
-        if (stationInfo.getServiceFee() != null) {
-            try {
-                entity.setServiceFee(new BigDecimal(stationInfo.getServiceFee()));
-            } catch (NumberFormatException e) {
-                log.warn("服务费转换失败: {}", stationInfo.getServiceFee(), e);
-            }
-        }
-        
-        entity.setParkFee(stationInfo.getParkFee());
-        entity.setPayment(stationInfo.getPayment());
-        entity.setSupportOrder(stationInfo.getSupportOrder());
-        entity.setRemark(stationInfo.getRemark());
-
-        // 插入或更新
-        if (existingStation == null) {
-            stationInfoMapper.insert(entity);
-        } else {
-            stationInfoMapper.updateById(entity);
-        }
-    }
-
-    /**
-     * 保存充电设备信息
-     */
-    private void saveEquipmentInfo(EquipmentInfo equipmentInfo, String stationId) {
-        // 查询是否已存在
-        ThirdPartyEquipmentInfo existingEquipment = equipmentInfoMapper.selectOne(
-                new LambdaQueryWrapper<ThirdPartyEquipmentInfo>()
-                        .eq(ThirdPartyEquipmentInfo::getEquipmentId, equipmentInfo.getEquipmentID())
-        );
-
-        ThirdPartyEquipmentInfo entity = new ThirdPartyEquipmentInfo();
-        if (existingEquipment != null) {
-            entity.setId(existingEquipment.getId());
-        }
-
-        // 设置字段值
-        entity.setEquipmentId(equipmentInfo.getEquipmentID());
-        entity.setStationId(stationId);
-        entity.setManufacturerId(equipmentInfo.getManufacturerID());
-        entity.setManufacturerName(equipmentInfo.getManufacturerName());
-        entity.setEquipmentModel(equipmentInfo.getEquipmentModel());
-        entity.setProductionDate(equipmentInfo.getProductionDate());
-        entity.setEquipmentType(equipmentInfo.getEquipmentType());
-        
-        // 处理经纬度
-        if (equipmentInfo.getEquipmentLng() != null) {
-            entity.setEquipmentLng(BigDecimal.valueOf(equipmentInfo.getEquipmentLng()));
-        }
-        if (equipmentInfo.getEquipmentLat() != null) {
-            entity.setEquipmentLat(BigDecimal.valueOf(equipmentInfo.getEquipmentLat()));
-        }
-        
-        // 处理功率
-        if (equipmentInfo.getPower() != null) {
-            entity.setPower(BigDecimal.valueOf(equipmentInfo.getPower()));
-        }
-        
-        entity.setEquipmentName(equipmentInfo.getEquipmentName());
-
-        // 插入或更新
-        if (existingEquipment == null) {
-            equipmentInfoMapper.insert(entity);
-        } else {
-            equipmentInfoMapper.updateById(entity);
-        }
-    }
-
-    /**
-     * 保存充电接口信息
-     */
-    private void saveConnectorInfo(ConnectorInfo connectorInfo, String equipmentId, String stationId) {
-        // 查询是否已存在
-        ThirdPartyConnectorInfo existingConnector = connectorInfoMapper.selectOne(
-                new LambdaQueryWrapper<ThirdPartyConnectorInfo>()
-                        .eq(ThirdPartyConnectorInfo::getConnectorId, connectorInfo.getConnectorID())
-        );
-
-        ThirdPartyConnectorInfo entity = new ThirdPartyConnectorInfo();
-        if (existingConnector != null) {
-            entity.setId(existingConnector.getId());
-        }
-
-        // 设置字段值
-        entity.setConnectorId(connectorInfo.getConnectorID());
-        entity.setEquipmentId(equipmentId);
-        entity.setStationId(stationId);
-        entity.setConnectorName(connectorInfo.getConnectorName());
-        entity.setConnectorType(connectorInfo.getConnectorType());
-        entity.setVoltageUpperLimits(connectorInfo.getVoltageUpperLimits());
-        entity.setVoltageLowerLimits(connectorInfo.getVoltageLowerLimits());
-        entity.setCurrent(connectorInfo.getCurrent());
-        
-        // 处理功率
-        if (connectorInfo.getPower() != null) {
-            entity.setPower(BigDecimal.valueOf(connectorInfo.getPower()));
-        }
-        
-        entity.setParkNo(connectorInfo.getParkNo());
-        entity.setNationalStandard(connectorInfo.getNationalStandard());
-
-        // 插入或更新
-        if (existingConnector == null) {
-            connectorInfoMapper.insert(entity);
-        } else {
-            connectorInfoMapper.updateById(entity);
-        }
-    }
-}

+ 0 - 57
src/main/java/com/zsElectric/boot/charging/service/impl/ThirdPartyStationInfoServiceImpl.java

@@ -1,57 +0,0 @@
-package com.zsElectric.boot.charging.service.impl;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zsElectric.boot.charging.entity.ThirdPartyStationInfo;
-import com.zsElectric.boot.charging.mapper.ThirdPartyStationInfoMapper;
-import com.zsElectric.boot.charging.model.query.ThirdPartyStationInfoQuery;
-import com.zsElectric.boot.charging.model.vo.ThirdPartyStationInfoVO;
-import com.zsElectric.boot.charging.service.ThirdPartyStationInfoService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-
-/**
- * 第三方充电站信息服务实现
- *
- * @author system
- * @since 2025-12-11
- */
-@Service
-@RequiredArgsConstructor
-public class ThirdPartyStationInfoServiceImpl implements ThirdPartyStationInfoService {
-
-    private final ThirdPartyStationInfoMapper stationInfoMapper;
-
-    @Override
-    public IPage<ThirdPartyStationInfoVO> getStationInfoPage(ThirdPartyStationInfoQuery queryParams) {
-        // 构建分页
-        Page<ThirdPartyStationInfo> page = new Page<>(queryParams.getPageNum(), queryParams.getPageSize());
-
-        // 构建查询条件
-        LambdaQueryWrapper<ThirdPartyStationInfo> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(StrUtil.isNotBlank(queryParams.getStationId()), ThirdPartyStationInfo::getStationId, queryParams.getStationId())
-                .like(StrUtil.isNotBlank(queryParams.getStationName()), ThirdPartyStationInfo::getStationName, queryParams.getStationName())
-                .eq(StrUtil.isNotBlank(queryParams.getAreaCode()), ThirdPartyStationInfo::getAreaCode, queryParams.getAreaCode())
-                .eq(StrUtil.isNotBlank(queryParams.getEquipmentOwnerId()), ThirdPartyStationInfo::getEquipmentOwnerId, queryParams.getEquipmentOwnerId())
-                .eq(queryParams.getStationStatus() != null && queryParams.getStationStatus() != 0, ThirdPartyStationInfo::getStationStatus, queryParams.getStationStatus())
-                .eq(queryParams.getStationType() != null && queryParams.getStationType() != 0, ThirdPartyStationInfo::getStationType, queryParams.getStationType())
-                .eq(StrUtil.isNotBlank(queryParams.getServiceTel()), ThirdPartyStationInfo::getServiceTel, queryParams.getServiceTel())
-                .orderByDesc(ThirdPartyStationInfo::getUpdateTime);
-
-        // 查询
-        Page<ThirdPartyStationInfo> stationPage = stationInfoMapper.selectPage(page, queryWrapper);
-
-        // 实体转换
-        Page<ThirdPartyStationInfoVO> voPage = new Page<>(stationPage.getCurrent(), stationPage.getSize(), stationPage.getTotal());
-        voPage.setRecords(stationPage.getRecords().stream().map(entity -> {
-            ThirdPartyStationInfoVO vo = new ThirdPartyStationInfoVO();
-            BeanUtils.copyProperties(entity, vo);
-            return vo;
-        }).toList());
-
-        return voPage;
-    }
-}

+ 2 - 2
src/main/resources/mapper/charging/ThirdPartyEquipmentInfoMapper.xml → src/main/resources/mapper/business/ThirdPartyEquipmentInfoMapper.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zsElectric.boot.charging.mapper.ThirdPartyEquipmentInfoMapper">
+<mapper namespace="com.zsElectric.boot.business.mapper.ThirdPartyEquipmentInfoMapper">
 
-    <select id="selectEquipmentInfoPage" resultType="com.zsElectric.boot.charging.model.vo.ThirdPartyEquipmentInfoVO">
+    <select id="selectEquipmentInfoPage" resultType="com.zsElectric.boot.business.model.vo.ThirdPartyEquipmentInfoVO">
         SELECT
             e.id,
             e.equipment_id,

+ 111 - 0
src/main/resources/mapper/business/ThirdPartyStationInfoMapper.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zsElectric.boot.business.mapper.ThirdPartyStationInfoMapper">
+
+    <resultMap id="StationInfoResultMap" type="com.zsElectric.boot.business.model.vo.ThirdPartyStationInfoVO">
+        <id property="id" column="id"/>
+        <result property="stationId" column="station_id"/>
+        <result property="stationName" column="station_name"/>
+        <result property="areaCode" column="area_code"/>
+        <result property="equipmentOwnerId" column="equipment_owner_id"/>
+        <result property="address" column="address"/>
+        <result property="construction" column="construction"/>
+        <result property="equipmentCount" column="equipment_count"/>
+        <result property="stationStatus" column="station_status"/>
+        <result property="serviceTel" column="service_tel"/>
+        <result property="stationType" column="station_type"/>
+        <result property="stationLng" column="station_lng"/>
+        <result property="stationLat" column="station_lat"/>
+        <result property="siteGuide" column="site_guide"/>
+    </resultMap>
+
+    <select id="selectStationInfoPage" resultMap="StationInfoResultMap">
+        SELECT
+            tpsi.id,
+            tpsi.station_id,
+            tpsi.station_name,
+            tpsi.area_code,
+            tpsi.equipment_owner_id,
+            tpsi.address,
+            tpsi.construction,
+            COUNT(DISTINCT tpei.id) AS equipment_count,
+            tpsi.station_status,
+            tpsi.service_tel,
+            tpsi.station_type,
+            tpsi.station_lng,
+            tpsi.station_lat,
+            tpsi.site_guide
+        FROM third_party_station_info tpsi
+        LEFT JOIN third_party_equipment_info tpei ON tpsi.station_id = tpei.station_id AND tpei.is_deleted = 0
+        WHERE tpsi.is_deleted = 0
+        <if test="query.stationId != null and query.stationId != ''">
+            AND tpsi.station_id = #{query.stationId}
+        </if>
+        <if test="query.stationName != null and query.stationName != ''">
+            AND tpsi.station_name LIKE CONCAT('%', #{query.stationName}, '%')
+        </if>
+        <if test="query.areaCode != null and query.areaCode != ''">
+            AND tpsi.area_code = #{query.areaCode}
+        </if>
+        <if test="query.equipmentOwnerId != null and query.equipmentOwnerId != ''">
+            AND tpsi.equipment_owner_id = #{query.equipmentOwnerId}
+        </if>
+        <if test="query.stationStatus != null and query.stationStatus != 0">
+            AND tpsi.station_status = #{query.stationStatus}
+        </if>
+        <if test="query.stationType != null and query.stationType != 0">
+            AND tpsi.station_type = #{query.stationType}
+        </if>
+        <if test="query.serviceTel != null and query.serviceTel != ''">
+            AND tpsi.service_tel = #{query.serviceTel}
+        </if>
+        GROUP BY tpsi.id
+        ORDER BY tpsi.update_time DESC
+    </select>
+
+    <select id="selectStationInfoPageByEquipment" resultMap="StationInfoResultMap">
+        SELECT
+            tpsi.id,
+            tpsi.station_id,
+            tpsi.station_name,
+            tpsi.area_code,
+            tpsi.equipment_owner_id,
+            tpsi.address,
+            tpsi.construction,
+            COUNT(DISTINCT tpei.id) AS equipment_count,
+            tpsi.station_status,
+            tpsi.service_tel,
+            tpsi.station_type,
+            tpsi.station_lng,
+            tpsi.station_lat,
+            tpsi.site_guide
+        FROM third_party_station_info tpsi
+        LEFT JOIN third_party_equipment_info tpei ON tpsi.station_id = tpei.station_id AND tpei.is_deleted = 0
+        WHERE tpsi.is_deleted = 0
+        AND tpsi.equipment_owner_id = 'MA6DP6BE7'
+        <if test="query.stationId != null and query.stationId != ''">
+            AND tpsi.station_id = #{query.stationId}
+        </if>
+        <if test="query.stationName != null and query.stationName != ''">
+            AND tpsi.station_name LIKE CONCAT('%', #{query.stationName}, '%')
+        </if>
+        <if test="query.areaCode != null and query.areaCode != ''">
+            AND tpsi.area_code = #{query.areaCode}
+        </if>
+        <if test="query.equipmentOwnerId != null and query.equipmentOwnerId != ''">
+            AND tpsi.equipment_owner_id = #{query.equipmentOwnerId}
+        </if>
+        <if test="query.stationStatus != null and query.stationStatus != 0">
+            AND tpsi.station_status = #{query.stationStatus}
+        </if>
+        <if test="query.stationType != null and query.stationType != 0">
+            AND tpsi.station_type = #{query.stationType}
+        </if>
+        <if test="query.serviceTel != null and query.serviceTel != ''">
+            AND tpsi.service_tel = #{query.serviceTel}
+        </if>
+        GROUP BY tpsi.id
+        ORDER BY tpsi.update_time DESC
+    </select>
+
+</mapper>