Jelajahi Sumber

refactor(policy-fee): 用 periodFlag 替代 startTime 优化时段标识逻辑

- 将 AddPolicyFeeDTO 中的 timePeriod 改为 periodFlag,简化时段标识
- 调整 PolicyFee 实体,新增 periodFlag 字段,弃用 startTime
- 改造业务逻辑,全面使用 periodFlag 替代 startTime 关联价格策略
- 修改数据库查询条件和 mapper,支持根据 periodFlag 查询价格和费用
- 增加默认运营费字典配置读取,设置默认运营费为 0.2
- 更新综合销售费计算逻辑,改用 periodFlag 查询电价和服务费
- 移除 index.vue 中对 timePeriod 冒号的处理,适应新数据格式
- 修正相关日志、警告信息以体现 periodFlag 使用
- 保持企业价格映射和其他价费逻辑的一致性,确保功能正常
SheepHy 2 hari lalu
induk
melakukan
02e396c54a

+ 3 - 4
src/main/java/com/zsElectric/boot/business/model/dto/AddPolicyFeeDTO.java

@@ -10,16 +10,15 @@ import java.math.BigDecimal;
 @Data
 @Accessors(chain = true)
 public class AddPolicyFeeDTO {
-    @Schema(description = "时间段")
-    private String timePeriod;
-    
-    @Schema(description = "时段标志(1-尖 2-峰 3-平 4-谷),用于计算综合销售费")
+    @Schema(description = "时段标志(1-尖 2-峰 3-平 4-谷)")
     private Integer periodFlag;
     
     @Schema(description = "运营服务费(元)")
     private BigDecimal operationServiceFee;
+    
     @Schema(description = "站点信息ID(关联third_party_station_info表)")
     private Long stationInfoId;
+    
     @Schema(description = "销售类型(0-平台 1-企业 2-渠道方)")
     private Integer salesType;
 

+ 5 - 1
src/main/java/com/zsElectric/boot/business/model/entity/PolicyFee.java

@@ -40,7 +40,11 @@ public class PolicyFee implements Serializable {
      */
     private Long stationInfoId;
 
-    private String startTime;
+    /**
+     * 时段标志(1-尖,2-峰,3-平,4-谷)
+     */
+    private Integer periodFlag;
+
     /**
      * 运营费
      */

+ 39 - 13
src/main/java/com/zsElectric/boot/business/service/impl/AppletHomeServiceImpl.java

@@ -58,6 +58,11 @@ public class AppletHomeServiceImpl implements AppletHomeService {
      * 时间格式化器 HHmmss
      */
     private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HHmmss");
+    
+    /**
+     * 默认运营费字典编码
+     */
+    private static final String DEFAULT_OP_FEE_DICT_CODE = "default_op_fee";
 
     @Override
     public IPage<StationInfoVO> getStationInfoPage(StationInfoQuery queryParams) {
@@ -462,7 +467,7 @@ public class AppletHomeServiceImpl implements AppletHomeService {
         }
         
         // 4. 如果是企业用户,查询企业价格
-        Map<String, BigDecimal> enterprisePriceMap = new HashMap<>();
+        Map<Integer, BigDecimal> enterprisePriceMap = new HashMap<>();
         boolean hasEnterprisePrice = false;
         if (firmId != null) {
             List<PolicyFee> policyFeeList = policyFeeMapper.selectList(
@@ -481,11 +486,11 @@ public class AppletHomeServiceImpl implements AppletHomeService {
                 hasEnterprisePrice = true;
             }
             
-            // 构建企业价格映射 (startTime -> enterprisePrice)
+            // 构建企业价格映射 (periodFlag -> enterprisePrice)
             for (PolicyFee policyFee : policyFeeList) {
-                // 查找对应的时段价格信息
+                // 查找对应的时段价格信息(通过periodFlag匹配)
                 ThirdPartyPolicyInfo matchedPolicyInfo = policyInfoList.stream()
-                        .filter(info -> info.getStartTime().equals(policyFee.getStartTime()))
+                        .filter(info -> info.getPeriodFlag() != null && info.getPeriodFlag().equals(policyFee.getPeriodFlag()))
                         .findFirst()
                         .orElse(null);
                 
@@ -497,11 +502,11 @@ public class AppletHomeServiceImpl implements AppletHomeService {
                     BigDecimal compSalesFee = policyFee.getCompSalesFee() != null ? policyFee.getCompSalesFee() : BigDecimal.ZERO;
                     
                     BigDecimal enterprisePrice = elecPrice.add(servicePrice).add(opFee).add(compSalesFee);
-                    enterprisePriceMap.put(policyFee.getStartTime(), enterprisePrice);
-                    log.debug("企业价格计算 - 时段: {}, 电费: {}, 服务费: {}, 运营费: {}, 综合销售费: {}, 企业价: {}",
-                            policyFee.getStartTime(), elecPrice, servicePrice, opFee, compSalesFee, enterprisePrice);
+                    enterprisePriceMap.put(policyFee.getPeriodFlag(), enterprisePrice);
+                    log.debug("企业价格计算 - periodFlag: {}, 电费: {}, 服务费: {}, 运营费: {}, 综合销售费: {}, 企业价: {}",
+                            policyFee.getPeriodFlag(), elecPrice, servicePrice, opFee, compSalesFee, enterprisePrice);
                 } else {
-                    log.warn("未找到匹配的价格策略明细,startTime: {}", policyFee.getStartTime());
+                    log.warn("未找到匹配的价格策略明细,periodFlag: {}", policyFee.getPeriodFlag());
                 }
             }
         }
@@ -534,8 +539,8 @@ public class AppletHomeServiceImpl implements AppletHomeService {
             BigDecimal servicePrice = policyInfo.getServicePrice() != null ? policyInfo.getServicePrice() : BigDecimal.ZERO;
             priceItem.setTotalPrice(elecPrice.add(servicePrice));
             
-            // 设置企业价格(如果有)
-            BigDecimal enterprisePrice = enterprisePriceMap.get(policyInfo.getStartTime());
+            // 设置企业价格(如果有)- 通过periodFlag匹配
+            BigDecimal enterprisePrice = enterprisePriceMap.get(policyInfo.getPeriodFlag());
             priceItem.setEnterprisePrice(enterprisePrice);
             
             // 判断是否为当前时段
@@ -644,6 +649,27 @@ public class AppletHomeServiceImpl implements AppletHomeService {
         }
         return false;
     }
+    
+    /**
+     * 从字典表获取默认运营费
+     * @return 默认运营费,如果字典未配置则返回0.2
+     */
+    private BigDecimal getDefaultOpFee() {
+        DictItem dictItem = dictItemMapper.selectOne(
+                new LambdaQueryWrapper<DictItem>()
+                        .eq(DictItem::getDictCode, DEFAULT_OP_FEE_DICT_CODE)
+                        .eq(DictItem::getStatus, 1)
+                        .last("LIMIT 1")
+        );
+        if (dictItem != null && dictItem.getValue() != null) {
+            try {
+                return new BigDecimal(dictItem.getValue());
+            } catch (NumberFormatException e) {
+                log.warn("默认运营费字典值转换失败: {}", dictItem.getValue());
+            }
+        }
+        return new BigDecimal("0.2");
+    }
 
     @Override
     public AppChargingCostVO getCurrentChargingCost() {
@@ -857,7 +883,7 @@ public class AppletHomeServiceImpl implements AppletHomeService {
                 policyFee = policyFeeMapper.selectOne(
                         new LambdaQueryWrapper<PolicyFee>()
                                 .eq(PolicyFee::getStationInfoId, stationInfo.getId())
-                                .eq(PolicyFee::getStartTime, policyInfo.getStartTime())
+                                .eq(PolicyFee::getPeriodFlag, policyInfo.getPeriodFlag())
                                 .eq(PolicyFee::getSalesType, 1)
                                 .eq(PolicyFee::getFirmId, userFirm.getFirmId())
                                 .eq(PolicyFee::getIsDeleted, 0)
@@ -867,7 +893,7 @@ public class AppletHomeServiceImpl implements AppletHomeService {
                 policyFee = policyFeeMapper.selectOne(
                         new LambdaQueryWrapper<PolicyFee>()
                                 .eq(PolicyFee::getStationInfoId, stationInfo.getId())
-                                .eq(PolicyFee::getStartTime, policyInfo.getStartTime())
+                                .eq(PolicyFee::getPeriodFlag, policyInfo.getPeriodFlag())
                                 .eq(PolicyFee::getSalesType, 0)
                                 .eq(PolicyFee::getIsDeleted, 0)
                                 .last("LIMIT 1")
@@ -876,7 +902,7 @@ public class AppletHomeServiceImpl implements AppletHomeService {
 
             BigDecimal opFee = (policyFee != null && policyFee.getOpFee() != null)
                     ? policyFee.getOpFee()
-                    : BigDecimal.ZERO;
+                    : getDefaultOpFee();
 
             // 查询增值费用
             BigDecimal valueAddedFee = BigDecimal.ZERO;

+ 15 - 31
src/main/java/com/zsElectric/boot/business/service/impl/PolicyFeeServiceImpl.java

@@ -49,29 +49,16 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
 
     @Override
     public boolean addPolicyFee(AddPolicyFeeDTO addPolicyFeeDTO) {
-        // 先校验 third_party_policy_info 表中是否存在对应的价格策略数据
-        ThirdPartyPolicyInfo policyInfo = policyInfoMapper.selectElecAndServicePriceByStation(
-                addPolicyFeeDTO.getStationInfoId(), 
-                addPolicyFeeDTO.getTimePeriod()
-        );
-        
-        if (policyInfo == null) {
-            log.error("无法添加策略费用:third_party_policy_info表中不存在对应的价格策略数据。stationInfoId: {}, timePeriod: {}",
-                    addPolicyFeeDTO.getStationInfoId(), addPolicyFeeDTO.getTimePeriod());
-            throw new IllegalArgumentException(
-                    String.format("站点ID[%d]的时段[%s]未配置价格策略,请先配置third_party_policy_info表数据",
-                            addPolicyFeeDTO.getStationInfoId(), addPolicyFeeDTO.getTimePeriod())
-            );
+        // 校验 periodFlag 合法性
+        Integer periodFlag = addPolicyFeeDTO.getPeriodFlag();
+        if (periodFlag == null || periodFlag < 1 || periodFlag > 4) {
+            throw new IllegalArgumentException("时段标志必须为 1-尖、2-峰、3-平、4-谷");
         }
         
-        log.info("校验通过,找到对应的价格策略。stationInfoId: {}, timePeriod: {}, elecPrice: {}, servicePrice: {}",
-                addPolicyFeeDTO.getStationInfoId(), addPolicyFeeDTO.getTimePeriod(), 
-                policyInfo.getElecPrice(), policyInfo.getServicePrice());
-        
-        // 根据站点+时段+销售类型+企业/渠道方查询是否已存在
+        // 根据站点+时段标志+销售类型+企业/渠道方查询是否已存在
         PolicyFee existPolicyFee = policyFeeMapper.selectOne(Wrappers.<PolicyFee>lambdaQuery()
                 .eq(PolicyFee::getStationInfoId, addPolicyFeeDTO.getStationInfoId())
-                .eq(PolicyFee::getStartTime, addPolicyFeeDTO.getTimePeriod())
+                .eq(PolicyFee::getPeriodFlag, periodFlag)
                 .eq(PolicyFee::getSalesType, addPolicyFeeDTO.getSalesType())
                 .eq(addPolicyFeeDTO.getSalesType() == 1, PolicyFee::getFirmId, addPolicyFeeDTO.getFirmId())
                 .eq(addPolicyFeeDTO.getSalesType() == 2, PolicyFee::getThirdPartyId, addPolicyFeeDTO.getThirdPartyId())
@@ -84,8 +71,7 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
             // 计算并设置综合销售费
             BigDecimal compSalesFee = calculateCompSalesFee(
                     addPolicyFeeDTO.getStationInfoId(),
-                    addPolicyFeeDTO.getTimePeriod(),
-                    addPolicyFeeDTO.getPeriodFlag(),
+                    periodFlag,
                     addPolicyFeeDTO.getOperationServiceFee()
             );
             existPolicyFee.setCompSalesFee(compSalesFee);
@@ -94,13 +80,12 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
             // 不存在,执行新增
             PolicyFee policyFee = new PolicyFee();
             policyFee.setStationInfoId(addPolicyFeeDTO.getStationInfoId());
-            policyFee.setStartTime(addPolicyFeeDTO.getTimePeriod());
+            policyFee.setPeriodFlag(periodFlag);
             policyFee.setOpFee(addPolicyFeeDTO.getOperationServiceFee());
             // 计算并设置综合销售费
             BigDecimal compSalesFee = calculateCompSalesFee(
                     addPolicyFeeDTO.getStationInfoId(),
-                    addPolicyFeeDTO.getTimePeriod(),
-                    addPolicyFeeDTO.getPeriodFlag(),
+                    periodFlag,
                     addPolicyFeeDTO.getOperationServiceFee()
             );
             policyFee.setCompSalesFee(compSalesFee);
@@ -128,18 +113,17 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
      * 公式:compSalesFee = elec_price + service_price + 字典表值 + op_fee
      *
      * @param stationInfoId 站点信息ID
-     * @param timePeriod    时间段(HHmmss格式)
      * @param periodFlag    时段标志
      * @param opFee         运营费
      * @return 综合销售费
      */
-    private BigDecimal calculateCompSalesFee(Long stationInfoId, String timePeriod, Integer periodFlag, BigDecimal opFee) {
+    private BigDecimal calculateCompSalesFee(Long stationInfoId, Integer periodFlag, BigDecimal opFee) {
         BigDecimal elecPrice = BigDecimal.ZERO;
         BigDecimal servicePrice = BigDecimal.ZERO;
         
-        // 直接通过stationInfoId和timePeriod查询电价和服务费
-        ThirdPartyPolicyInfo policyInfo = policyInfoMapper.selectElecAndServicePriceByStation(stationInfoId, timePeriod);
-        log.info("计算compSalesFee - stationInfoId: {}, timePeriod: {}, policyInfo: {}", stationInfoId, timePeriod, policyInfo);
+        // 通过stationInfoId和periodFlag查询电价和服务费(取该时段标志的第一条记录)
+        ThirdPartyPolicyInfo policyInfo = policyInfoMapper.selectElecAndServicePriceByStationAndPeriodFlag(stationInfoId, periodFlag);
+        log.info("计算compSalesFee - stationInfoId: {}, periodFlag: {}, policyInfo: {}", stationInfoId, periodFlag, policyInfo);
         
         if (policyInfo != null) {
             elecPrice = policyInfo.getElecPrice() != null ? policyInfo.getElecPrice() : BigDecimal.ZERO;
@@ -153,8 +137,8 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
         BigDecimal opFeeValue = opFee != null ? opFee : BigDecimal.ZERO;
         BigDecimal compSalesFee = elecPrice.add(servicePrice).add(dictValue).add(opFeeValue);
         
-        log.info("计算综合销售费 - stationInfoId: {}, timePeriod: {}, elecPrice: {}, servicePrice: {}, dictValue: {}, opFee: {}, compSalesFee: {}",
-                stationInfoId, timePeriod, elecPrice, servicePrice, dictValue, opFeeValue, compSalesFee);
+        log.info("计算综合销售费 - stationInfoId: {}, periodFlag: {}, elecPrice: {}, servicePrice: {}, dictValue: {}, opFee: {}, compSalesFee: {}",
+                stationInfoId, periodFlag, elecPrice, servicePrice, dictValue, opFeeValue, compSalesFee);
         
         return compSalesFee;
     }

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

@@ -672,7 +672,7 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
                 log.debug("价格策略明细更新成功 - policyId: {}, startTime: {}", policyId, policyInfo.getStartTime());
                 
                 // 价格变化后,同步更新 c_policy_fee 表中的 comp_sales_fee
-                updateRelatedPolicyFeeCompSalesFee(policyId, policyInfo.getStartTime());
+                updateRelatedPolicyFeeCompSalesFee(policyId, policyInfo.getPeriodFlag());
             } else {
                 // 数据未变化,但仍更新同步时间
                 updateSyncTime(existing);
@@ -724,9 +724,9 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
      * 根据 pricePolicyId 查询对应的 stationInfoId,然后更新相关的 policy_fee 记录
      * 
      * @param policyId 价格策略ID
-     * @param startTime 时段开始时间
+     * @param periodFlag 时段标志(1-尖,2-峰,3-平,4-谷)
      */
-    private void updateRelatedPolicyFeeCompSalesFee(Long policyId, String startTime) {
+    private void updateRelatedPolicyFeeCompSalesFee(Long policyId, Integer periodFlag) {
         try {
             // 1. 通过 policyId 查询 connectorId
             ThirdPartyEquipmentPricePolicy pricePolicy = pricePolicyMapper.selectById(policyId);
@@ -759,16 +759,16 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
                 return;
             }
             
-            // 4. 查询该站点、该时段的所有 policy_fee 记录
+            // 4. 查询该站点、该时段标志的所有 policy_fee 记录
             List<PolicyFee> policyFees = policyFeeMapper.selectList(
                     Wrappers.<PolicyFee>lambdaQuery()
                             .eq(PolicyFee::getStationInfoId, station.getId())
-                            .eq(PolicyFee::getStartTime, startTime)
+                            .eq(PolicyFee::getPeriodFlag, periodFlag)
                             .eq(PolicyFee::getIsDeleted, 0)
             );
             
             if (policyFees.isEmpty()) {
-                log.debug("该站点该时段没有 policy_fee 记录,stationInfoId: {}, startTime: {}", station.getId(), startTime);
+                log.debug("该站点该时段标志没有 policy_fee 记录,stationInfoId: {}, periodFlag: {}", station.getId(), periodFlag);
                 return;
             }
             
@@ -776,19 +776,19 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
             for (PolicyFee policyFee : policyFees) {
                 BigDecimal newCompSalesFee = calculateCompSalesFeeForPolicyFee(
                         station.getId(), 
-                        startTime, 
+                        periodFlag, 
                         policyFee.getOpFee()
                 );
                 
                 policyFee.setCompSalesFee(newCompSalesFee);
                 policyFeeMapper.updateById(policyFee);
                 
-                log.info("更新 policy_fee 的 comp_sales_fee - id: {}, stationInfoId: {}, startTime: {}, salesType: {}, 新值: {}",
-                        policyFee.getId(), station.getId(), startTime, policyFee.getSalesType(), newCompSalesFee);
+                log.info("更新 policy_fee 的 comp_sales_fee - id: {}, stationInfoId: {}, periodFlag: {}, salesType: {}, 新值: {}",
+                        policyFee.getId(), station.getId(), periodFlag, policyFee.getSalesType(), newCompSalesFee);
             }
             
         } catch (Exception e) {
-            log.error("更新 policy_fee 的 comp_sales_fee 失败 - policyId: {}, startTime: {}", policyId, startTime, e);
+            log.error("更新 policy_fee 的 comp_sales_fee 失败 - policyId: {}, periodFlag: {}", policyId, periodFlag, e);
             // 不抛出异常,避免影响主流程
         }
     }
@@ -798,12 +798,12 @@ public class ThirdPartyChargingServiceImpl implements ThirdPartyChargingService
      * 公式:compSalesFee = elec_price + service_price + op_fee
      * 注意:这里不加字典值,与 PolicyFeeServiceImpl 中的计算逻辑保持一致
      */
-    private BigDecimal calculateCompSalesFeeForPolicyFee(Long stationInfoId, String timePeriod, BigDecimal opFee) {
+    private BigDecimal calculateCompSalesFeeForPolicyFee(Long stationInfoId, Integer periodFlag, BigDecimal opFee) {
         BigDecimal elecPrice = BigDecimal.ZERO;
         BigDecimal servicePrice = BigDecimal.ZERO;
         
         // 查询电价和服务费
-        ThirdPartyPolicyInfo policyInfo = policyInfoMapper.selectElecAndServicePriceByStation(stationInfoId, timePeriod);
+        ThirdPartyPolicyInfo policyInfo = policyInfoMapper.selectElecAndServicePriceByStationAndPeriodFlag(stationInfoId, periodFlag);
         
         if (policyInfo != null) {
             elecPrice = policyInfo.getElecPrice() != null ? policyInfo.getElecPrice() : BigDecimal.ZERO;

+ 10 - 0
src/main/java/com/zsElectric/boot/charging/mapper/ThirdPartyPolicyInfoMapper.java

@@ -23,4 +23,14 @@ public interface ThirdPartyPolicyInfoMapper extends BaseMapper<ThirdPartyPolicyI
      */
     ThirdPartyPolicyInfo selectElecAndServicePriceByStation(@Param("stationInfoId") Long stationInfoId,
                                                              @Param("startTime") String startTime);
+    
+    /**
+     * 根据stationInfoId和periodFlag查询电价和服务费(取该时段标志的第一条记录)
+     *
+     * @param stationInfoId 站点信息ID
+     * @param periodFlag    时段标志(1-尖,2-峰,3-平,4-谷)
+     * @return 价格策略明细(包含elec_price和service_price)
+     */
+    ThirdPartyPolicyInfo selectElecAndServicePriceByStationAndPeriodFlag(@Param("stationInfoId") Long stationInfoId,
+                                                                          @Param("periodFlag") Integer periodFlag);
 }

+ 22 - 3
src/main/resources/mapper/business/PolicyFeeMapper.xml

@@ -22,7 +22,16 @@
             tppi.elec_price,
             tppi.service_price,
             ROUND(tppi.elec_price + tppi.service_price, 4) AS settlement_total_price,
-            IFNULL(pf.op_fee, 0) AS op_fee,
+            IFNULL(pf.op_fee, 
+                IFNULL(
+                    (SELECT CAST(di.value AS DECIMAL(10,4))
+                     FROM sys_dict_item di
+                     WHERE di.dict_code = 'default_op_fee'
+                       AND di.status = 1
+                     LIMIT 1),
+                    0.2
+                )
+            ) AS op_fee,
             IFNULL(
                 (SELECT CAST(di.value AS DECIMAL(10,4))
                  FROM sys_dict_item di
@@ -39,7 +48,17 @@
                 0
             ) AS value_added_fees,
             ROUND(
-                tppi.elec_price + tppi.service_price + IFNULL(pf.op_fee, 0) +
+                tppi.elec_price + tppi.service_price + 
+                IFNULL(pf.op_fee, 
+                    IFNULL(
+                        (SELECT CAST(di.value AS DECIMAL(10,4))
+                         FROM sys_dict_item di
+                         WHERE di.dict_code = 'default_op_fee'
+                           AND di.status = 1
+                         LIMIT 1),
+                        0.2
+                    )
+                ) +
                 IFNULL(
                     (SELECT CAST(di.value AS DECIMAL(10,4))
                      FROM sys_dict_item di
@@ -70,7 +89,7 @@
             )
         INNER JOIN third_party_policy_info tppi ON tppi.price_policy_id = tpepp.id AND tppi.is_deleted = 0
         LEFT JOIN c_policy_fee pf ON pf.station_info_id = tpsi.id
-            AND pf.start_time = tppi.start_time
+            AND pf.period_flag = tppi.period_flag
             AND pf.is_deleted = 0
             AND pf.sales_type = #{salesType}
             <if test="salesType == 1">

+ 20 - 0
src/main/resources/mapper/charging/ThirdPartyPolicyInfoMapper.xml

@@ -21,5 +21,25 @@
             AND tppi.start_time = #{startTime}
         LIMIT 1
     </select>
+    
+    <!-- 根据stationInfoId和periodFlag查询电价和服务费 -->
+    <select id="selectElecAndServicePriceByStationAndPeriodFlag" resultType="com.zsElectric.boot.charging.entity.ThirdPartyPolicyInfo">
+        SELECT 
+            tppi.id,
+            tppi.elec_price,
+            tppi.service_price,
+            tppi.period_flag
+        FROM third_party_station_info tpsi
+        INNER JOIN third_party_connector_info tpci 
+            ON tpci.station_id = tpsi.station_id AND tpci.is_deleted = 0
+        INNER JOIN third_party_equipment_price_policy tpepp 
+            ON tpepp.connector_id = tpci.connector_id AND tpepp.is_deleted = 0
+        INNER JOIN third_party_policy_info tppi 
+            ON tppi.price_policy_id = tpepp.id AND tppi.is_deleted = 0
+        WHERE tpsi.id = #{stationInfoId}
+            AND tpsi.is_deleted = 0
+            AND tppi.period_flag = #{periodFlag}
+        LIMIT 1
+    </select>
 
 </mapper>