Quellcode durchsuchen

feat(business): 添加策略价格配置状态更新功能

- 在 ThirdPartyStationInfo 实体中新增 policyConfigured 字段
- 在插入 PolicyFee 后更新站点的策略配置状态为已配置
- 在查询已配置站点时增加 policyConfigured=1 的过滤条件
- 注入 ThirdPartyStationInfoMapper 以支持状态更新操作
SheepHy vor 20 Stunden
Ursprung
Commit
68b778f969

+ 13 - 1
src/main/java/com/zsElectric/boot/business/service/impl/PolicyFeeServiceImpl.java

@@ -3,6 +3,7 @@ package com.zsElectric.boot.business.service.impl;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.zsElectric.boot.business.mapper.PolicyFeeMapper;
 import com.zsElectric.boot.business.mapper.ThirdPartyEquipmentInfoMapper;
+import com.zsElectric.boot.business.mapper.ThirdPartyStationInfoMapper;
 import com.zsElectric.boot.business.model.dto.AddPolicyFeeDTO;
 import com.zsElectric.boot.business.model.entity.PolicyFee;
 import com.zsElectric.boot.business.model.vo.TimePeriodPriceVO;
@@ -10,6 +11,7 @@ import com.zsElectric.boot.business.service.PolicyFeeService;
 import com.zsElectric.boot.charging.entity.ThirdPartyEquipmentInfo;
 import com.zsElectric.boot.charging.entity.ThirdPartyEquipmentPricePolicy;
 import com.zsElectric.boot.charging.entity.ThirdPartyPolicyInfo;
+import com.zsElectric.boot.charging.entity.ThirdPartyStationInfo;
 import com.zsElectric.boot.charging.mapper.ThirdPartyEquipmentPricePolicyMapper;
 import com.zsElectric.boot.charging.mapper.ThirdPartyPolicyInfoMapper;
 import com.zsElectric.boot.system.model.entity.DictItem;
@@ -55,6 +57,8 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
 
     private final DictItemService dictItemService;
 
+    private final ThirdPartyStationInfoMapper stationInfoMapper;
+
     @Override
     public List<TimePeriodPriceVO> getPolicyFee(long stationId, int salesType, int thirdPartyId) {
         List<TimePeriodPriceVO> timePeriodPriceVOS = new ArrayList<>();
@@ -165,7 +169,15 @@ public class PolicyFeeServiceImpl implements PolicyFeeService {
             policyFee.setOpFee(addPolicyFeeDTO.getOperationServiceFee());
             policyFee.setSalesType(addPolicyFeeDTO.getSalesType());
             policyFee.setThirdPartyId(addPolicyFeeDTO.getThirdPartyId());
-            return policyFeeMapper.insert(policyFee) > 0;
+            boolean inserted = policyFeeMapper.insert(policyFee) > 0;
+            
+            // 新增成功后,更新站点的配置状态为已配置
+            if (inserted) {
+                stationInfoMapper.update(null, Wrappers.<ThirdPartyStationInfo>lambdaUpdate()
+                        .eq(ThirdPartyStationInfo::getId, addPolicyFeeDTO.getStationInfoId())
+                        .set(ThirdPartyStationInfo::getPolicyConfigured, 1));
+            }
+            return inserted;
         }
     }
 }

+ 5 - 0
src/main/java/com/zsElectric/boot/charging/entity/ThirdPartyStationInfo.java

@@ -141,6 +141,11 @@ public class ThirdPartyStationInfo extends BaseEntity {
      */
     private String remark;
 
+    /**
+     * 是否配置策略价格(0-未配置 1-已配置)
+     */
+    private Integer policyConfigured;
+
     /**
      * 创建人ID
      */

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

@@ -83,6 +83,7 @@
         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'
+        AND tpsi.policy_configured = 1
         <if test="query.stationId != null and query.stationId != ''">
             AND tpsi.station_id = #{query.stationId}
         </if>