From 8a01a386da08eab56e112926b91359e24a2f7117 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 11 九月 2024 09:29:16 +0800
Subject: [PATCH] 9.11

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java          |    5 
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java |   35 +++++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java          |   14 ++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java |   10 +
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java            |   14 ++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java            |    4 
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml                  |  217 +++++++++++++++++++++++++++++++
 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml                  |   37 +++++
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java    |   51 ++++++-
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java          |    6 
 10 files changed, 386 insertions(+), 7 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java
index 9086c3c..5f61a56 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/vo/TCharingUserEvaluateVO.java
@@ -14,5 +14,11 @@
     List<Map<String,Object>> evaluate;
     @ApiModelProperty("差评数量")
     Long blackCount;
+    @ApiModelProperty("好评标签")
+    List<Map<String,Object>> goodTop;
+    @ApiModelProperty("差评标签")
+    List<Map<String,Object>> badTop;
+    @ApiModelProperty("流量分析")
+    List<Map<String,Object>> flow;
 
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
index d12f4b6..f25b74d 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
@@ -849,18 +849,55 @@
         tCharingUserEvaluateVO.setBlackCount(count);
 
 
+        //好评标签
+       List<Map<String,Object>> goodTop = orderEvaluateService.goodTop(siteIds);
+       //差评标签
+        List<Map<String,Object>> badTop = orderEvaluateService.badTop(siteIds);
 
-        //标签
-        //查出好评ids
-//        orderEvaluateService.goodTop();
-
-
-
-
+        //流量分析
+        List<Map<String,Object>> sourceMap = chargingOrderService.countBySource(siteIds);
+        tCharingUserEvaluateVO.setGoodTop(goodTop);
+        tCharingUserEvaluateVO.setBadTop(badTop);
+        tCharingUserEvaluateVO.setFlow(sourceMap);
         //流量
         return R.ok(tCharingUserEvaluateVO);
     }
 
+    @ResponseBody
+    @PostMapping(value = "/charging/equipment")
+    @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"})
+    public R<TCharingUserEvaluateVO> equipment(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){
+        List<Integer> siteIds =new ArrayList<>();
+        if (statisticsQueryDto.getSiteId()==null) {
+            Long userId = SecurityUtils.getUserId();
+            //获取当前登录的siteIds
+            List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData();
+            for (GetSiteListDTO datum : data) {
+                siteIds.add(datum.getId());
+            }
+        }else {
+            siteIds.add(statisticsQueryDto.getSiteId());
+        }
+        //直流可用率
+        List<Map<String,Object>> equipmentMap1 = chargingOrderService.equipmentUserType1(siteIds,statisticsQueryDto);
+        //交流可用率
+        List<Map<String,Object>> equipmentMap2= chargingOrderService.equipmentUserType2(siteIds,statisticsQueryDto);
+        //直流故障率
+        List<Map<String,Object>> equipmentMapbroke1 = chargingOrderService.equipmentMapbroke1(siteIds,statisticsQueryDto);
+        //交流故障率
+        List<Map<String,Object>> equipmentMapbroke2 = chargingOrderService.equipmentMapbroke2(siteIds,statisticsQueryDto);
+        //直流离网率
+        List<Map<String,Object>> equipmentMapOut1 = chargingOrderService.equipmentMapOut1(siteIds,statisticsQueryDto);
+        //交流离网率
+        List<Map<String,Object>> equipmentMapOut2 = chargingOrderService.equipmentMapOut2(siteIds,statisticsQueryDto);
+
+
+        //需求电流满足率
+
+
+
+    }
+
     public static void main(String[] args) {
         // 示例数据
         List<TChargingOrder> list = getSampleData();
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
index e68041c..a08980c 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TChargingOrderMapper.java
@@ -107,4 +107,18 @@
     Long getAver(List<Integer> siteIds);
 
 	List<Map<String, Object>> getLevelEvaluate(List<Integer> siteIds);
+
+    List<Map<String, Object>> countBySource(List<Integer> siteIds);
+
+	List<Map<String, Object>> equipmentUserType1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentUserType2(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapbroke1(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapbroke2(@Param("siteIds") List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapOut1(@Param("siteIds")List<Integer> siteIds, @Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapOut2(@Param("siteIds")List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto);
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java
index e428668..8edbcfd 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/TOrderEvaluateMapper.java
@@ -49,4 +49,8 @@
      * @return
      */
     List<TOrderEvaluateVO> getOrderEvaluateBySiteId(@Param("siteId")Integer siteId);
+
+    List<Map<String, Object>> goodTop(List<Integer> siteIds);
+
+    List<Map<String, Object>> badTop(List<Integer> siteIds);
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
index 61aad66..0ab5dc4 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TChargingOrderService.java
@@ -200,4 +200,18 @@
 	PageInfo<TSettlementConfirm> settlementList(SettlementListQuery dto);
 
     SettlementTotalVO settlementTotal(String time);
+
+	List<Map<String, Object>> countBySource(List<Integer> siteIds);
+
+	List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentUserType2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapbroke1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapbroke2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapOut1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
+
+	List<Map<String, Object>> equipmentMapOut2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto);
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java
index 3098ba9..2aa61b3 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/TOrderEvaluateService.java
@@ -15,6 +15,7 @@
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -69,4 +70,8 @@
      * @return
      */
     OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType);
+
+    List<Map<String, Object>> goodTop(List<Integer> siteIds);
+
+    List<Map<String, Object>> badTop(List<Integer> siteIds);
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
index 3dbf5be..ef8647a 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java
@@ -2025,6 +2025,41 @@
 		return res;
 	}
 
+	@Override
+	public List<Map<String, Object>> countBySource(List<Integer> siteIds) {
+		return this.baseMapper.countBySource(siteIds);
+	}
+
+	@Override
+	public List<Map<String, Object>> equipmentUserType1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
+		return this.baseMapper.equipmentUserType1(siteIds,statisticsQueryDto);
+	}
+
+	@Override
+	public List<Map<String, Object>> equipmentUserType2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
+		return this.baseMapper.equipmentUserType2(siteIds,statisticsQueryDto);
+	}
+
+	@Override
+	public List<Map<String, Object>> equipmentMapbroke1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
+		return this.baseMapper.equipmentMapbroke1(siteIds,statisticsQueryDto);
+	}
+
+	@Override
+	public List<Map<String, Object>> equipmentMapbroke2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
+		return this.baseMapper.equipmentMapbroke2(siteIds,statisticsQueryDto);
+	}
+
+	@Override
+	public List<Map<String, Object>> equipmentMapOut1(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
+		return this.baseMapper.equipmentMapOut1(siteIds,statisticsQueryDto);
+	}
+
+	@Override
+	public List<Map<String, Object>> equipmentMapOut2(List<Integer> siteIds, ChargingStatisticsQueryDto statisticsQueryDto) {
+		return this.baseMapper.equipmentMapOut2(siteIds,statisticsQueryDto);
+	}
+
 	public static void main(String[] args) {
 //		String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss"));
 //		String format1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss"));
diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
index 5d772b8..2f05e87 100644
--- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
+++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java
@@ -309,4 +309,14 @@
         }
         return null;
     }
+
+    @Override
+    public List<Map<String, Object>> goodTop(List<Integer> siteIds) {
+        return this.baseMapper.goodTop(siteIds);
+    }
+
+    @Override
+    public List<Map<String, Object>> badTop(List<Integer> siteIds) {
+        return this.baseMapper.badTop(siteIds);
+    }
 }
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
index af8dd8f..e2202cb 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -852,4 +852,221 @@
             and (t1.end_time between #{endTime1} and #{endTime2})
         </if>
     </select>
+    <select id="countBySource" resultType="java.util.Map">
+            select
+                count(1) as counts,
+              source_name as source
+            from t_charging_order
+            where 1=1
+        del_flag = 0
+        AND recharge_payment_status = 2
+            <if test="siteIds != null and siteIds.size() > 0">
+                and site_id IN
+                <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
+                    #{siteId}
+                </foreach>
+            </if>
+            group by source_name
+
+
+    </select>
+    <select id="equipmentUserType1" resultType="java.util.Map">
+        SELECT
+            FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) /
+                       <if test="statisticsQueryDto.dayType == 1">
+                           86400
+                       </if>
+                   <if test="statisticsQueryDto.dayType == 2">
+                       604800
+                   </if>
+                   <if test="statisticsQueryDto.dayType == 3">
+                       2592000
+                   </if>
+                   <if test="statisticsQueryDto.dayType == 4">
+                       31536000
+                   </if>
+                   <if test="statisticsQueryDto.dayType == 5">
+                       (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
+                       ))
+                   </if>
+
+
+                   ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName
+        FROM
+            `charging_pile_order`.`t_charging_order` co
+                LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
+                LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
+        WHERE
+            co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1
+        <if test="siteIds != null and siteIds.size() > 0">
+            and co.site_id IN
+            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
+                #{siteId}
+            </foreach>
+        </if>
+        GROUP BY tc.name,cp.name,co.charging_gun_id
+
+
+
+
+    </select>
+    <select id="equipmentUserType2" resultType="java.util.Map">
+        SELECT
+        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) /
+        <if test="statisticsQueryDto.dayType == 1">
+            86400
+        </if>
+        <if test="statisticsQueryDto.dayType == 2">
+            604800
+        </if>
+        <if test="statisticsQueryDto.dayType == 3">
+            2592000
+        </if>
+        <if test="statisticsQueryDto.dayType == 4">
+            31536000
+        </if>
+        <if test="statisticsQueryDto.dayType == 5">
+            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
+            ))
+        </if>
+
+
+        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as siteName
+        FROM
+        `charging_pile_order`.`t_charging_order` co
+        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
+        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
+        WHERE
+        co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2
+        <if test="siteIds != null and siteIds.size() > 0">
+            and co.site_id IN
+            <foreach collection="siteIds" item="siteId" open="(" separator="," close=")">
+                #{siteId}
+            </foreach>
+        </if>
+        GROUP BY tc.name,cp.name,co.charging_gun_id
+
+
+    </select>
+    <select id="equipmentMapbroke1" resultType="java.util.Map">
+        SELECT
+            FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
+        <if test="statisticsQueryDto.dayType == 1">
+            86400
+        </if>
+        <if test="statisticsQueryDto.dayType == 2">
+            604800
+        </if>
+        <if test="statisticsQueryDto.dayType == 3">
+            2592000
+        </if>
+        <if test="statisticsQueryDto.dayType == 4">
+            31536000
+        </if>
+        <if test="statisticsQueryDto.dayType == 5">
+            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
+            ))
+        </if>
+
+                   ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
+        FROM
+            `charging_pile_service`.`t_fault_message` co
+                LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
+                LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
+        WHERE
+            co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2
+        GROUP BY tc.name,cp.name,co.charging_gun_id
+
+
+    </select>
+    <select id="equipmentMapbroke2" resultType="java.util.Map">
+        SELECT
+        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
+        <if test="statisticsQueryDto.dayType == 1">
+            86400
+        </if>
+        <if test="statisticsQueryDto.dayType == 2">
+            604800
+        </if>
+        <if test="statisticsQueryDto.dayType == 3">
+            2592000
+        </if>
+        <if test="statisticsQueryDto.dayType == 4">
+            31536000
+        </if>
+        <if test="statisticsQueryDto.dayType == 5">
+            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
+            ))
+        </if>
+
+        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
+        FROM
+        `charging_pile_service`.`t_fault_message` co
+        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
+        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
+        WHERE
+        co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =2
+        GROUP BY tc.name,cp.name,co.charging_gun_id
+
+
+    </select>
+    <select id="equipmentMapOut1" resultType="java.util.Map">
+        SELECT
+        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
+        <if test="statisticsQueryDto.dayType == 1">
+            86400
+        </if>
+        <if test="statisticsQueryDto.dayType == 2">
+            604800
+        </if>
+        <if test="statisticsQueryDto.dayType == 3">
+            2592000
+        </if>
+        <if test="statisticsQueryDto.dayType == 4">
+            31536000
+        </if>
+        <if test="statisticsQueryDto.dayType == 5">
+            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
+            ))
+        </if>
+
+        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
+        FROM
+        `charging_pile_service`.`t_fault_message` co
+        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
+        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
+        WHERE
+        co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1
+        GROUP BY tc.name,cp.name,co.charging_gun_id
+    </select>
+    <select id="equipmentMapOut2" resultType="java.util.Map">
+        SELECT
+        FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) /
+        <if test="statisticsQueryDto.dayType == 1">
+            86400
+        </if>
+        <if test="statisticsQueryDto.dayType == 2">
+            604800
+        </if>
+        <if test="statisticsQueryDto.dayType == 3">
+            2592000
+        </if>
+        <if test="statisticsQueryDto.dayType == 4">
+            31536000
+        </if>
+        <if test="statisticsQueryDto.dayType == 5">
+            (86400*(SELECT TIMESTAMPDIFF(DAY, statisticsQueryDto.startTime, statisticsQueryDto.endTime) AS days_difference
+            ))
+        </if>
+
+        ), 2) AS total_days,co.charging_gun_id,tc.name,cp.name as name1
+        FROM
+        `charging_pile_service`.`t_fault_message` co
+        LEFT JOIN  `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id
+        LEFT JOIN  `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id
+        WHERE
+        co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1
+        GROUP BY tc.name,cp.name,co.charging_gun_id
+
+    </select>
 </mapper>
diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
index 476d723..472e744 100644
--- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
+++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TOrderEvaluateMapper.xml
@@ -124,4 +124,41 @@
         </if>
         order by a.create_time desc
     </select>
+    <select id="goodTop" resultType="java.util.Map">
+        SELECT count(1) as counts ,ot.evaluation_tag_id
+        from t_order_evaluate_tag ot
+                 left join t_order_evaluate te on ot.order_evaluate_id = te.id
+                 left join t_charging_order co on te.order_id = co.id
+        WHERE ot.evaluation_tag_id in (
+            SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 1
+        ) <if test="null != siteIds">
+            and co.site_id in
+            <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY ot.evaluation_tag_id
+        ORDER BY counts desc
+            limit 5
+
+
+
+    </select>
+    <select id="badTop" resultType="java.util.Map">
+        SELECT count(1) as counts ,ot.evaluation_tag_id
+        from t_order_evaluate_tag ot
+        left join t_order_evaluate te on ot.order_evaluate_id = te.id
+        left join t_charging_order co on te.order_id = co.id
+        WHERE ot.evaluation_tag_id in (
+        SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 3
+        ) <if test="null != siteIds">
+        and co.site_id in
+        <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </if>
+        GROUP BY ot.evaluation_tag_id
+        ORDER BY counts desc
+        limit 5
+    </select>
 </mapper>

--
Gitblit v1.7.1