From bea016d61c5f37a92508de5ce4386e2d849cb831 Mon Sep 17 00:00:00 2001
From: 18650502300 <18650502300@163.com>
Date: Tue, 3 Sep 2024 16:49:47 +0800
Subject: [PATCH] =?UTF-8?q?1.=20=E4=BC=98=E6=83=A0=E5=88=B8=E8=B0=83?=
 =?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../com/ruoyi/system/domain/EtFeeRule.java    |  3 +++
 .../service/impl/EtFeeRuleServiceImpl.java    | 24 ++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java b/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java
index dd9bc23..6790162 100644
--- a/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java
+++ b/electripper-system/src/main/java/com/ruoyi/system/domain/EtFeeRule.java
@@ -172,4 +172,7 @@ public class EtFeeRule extends BaseEntity
     /** 是否已删除*/
     @Excel(name = "是否已删除")
     private String isDeleted;
+
+    @Excel(name = "描述")
+    private String description;
 }
diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java
index 24c7169..6727361 100644
--- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java
+++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/EtFeeRuleServiceImpl.java
@@ -3,13 +3,17 @@ package com.ruoyi.system.service.impl;
 import java.util.List;
 
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.constant.ServiceConstants;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.EtAreaRule;
 import com.ruoyi.system.domain.EtOperatingArea;
+import com.ruoyi.system.domain.vo.IntervalRuleVo;
+import com.ruoyi.system.domain.vo.StartingRuleVo;
 import com.ruoyi.system.mapper.EtAreaRuleMapper;
 import com.ruoyi.system.service.IEtOperatingAreaService;
 import com.ruoyi.system.service.IWxPayService;
@@ -86,7 +90,25 @@ public class EtFeeRuleServiceImpl implements IEtFeeRuleService
             SysDept sysDept = wxPayService.getDeptObjByAreaId(etFeeRule.getAreaId());
             etFeeRule.setDeptId(sysDept.getDeptId());
         }
-        return etFeeRuleMapper.selectEtFeeRuleList(etFeeRule);
+        List<EtFeeRule> etFeeRules = etFeeRuleMapper.selectEtFeeRuleList(etFeeRule);
+        for (EtFeeRule rule:etFeeRules) {
+            StringBuilder sb = new StringBuilder();
+            String ridingRuleJson = rule.getRidingRuleJson();
+            String unit = "";
+            if(rule.getRidingRule().equals("1")){
+                StartingRuleVo startingRule = JSONObject.parseObject(ridingRuleJson, StartingRuleVo.class);
+                String rentalUnit = rule.getRentalUnit();
+                if(rentalUnit.equals(ServiceConstants.RENTAL_UNIT_MINUTES)){
+                    unit = "分钟";
+                }else if(rentalUnit.equals(ServiceConstants.RENTAL_UNIT_HOURS)){
+                    unit = "小时";
+                }
+                sb.append("起步价:"+startingRule.getStartingPrice()+"元(含"+startingRule.getStartingTime()+unit+"),");
+                sb.append("超出价:"+startingRule.getTimeoutPrice()+"元/"+startingRule.getTimeoutTime()+unit);
+            }
+            rule.setDescription(sb.toString());
+        }
+        return etFeeRules;
     }
 
     /**