mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-08-11 16:53:54 +08:00
update 优化统计充电桩总数/直流数量/交流数量查询方法
This commit is contained in:
@@ -9,6 +9,7 @@ import com.jsowell.pile.vo.base.PileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PersonalPileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PileConnectorDetailVO;
|
||||
import com.jsowell.pile.vo.web.IndexGeneralSituationVO;
|
||||
import com.jsowell.pile.vo.web.PileCountStatVO;
|
||||
import com.jsowell.pile.vo.web.PileDetailVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -194,14 +195,9 @@ public interface PileBasicInfoMapper {
|
||||
@Param("merchantIdList") List<String> merchantIdList, @Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 根据站点ID列表统计充电桩总数
|
||||
* 统计充电桩数量(总数/直流/交流同源,保证 直流 + 交流 = 总数)
|
||||
*/
|
||||
Long countTotalPilesByStationIds(@Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 根据商户ID列表统计充电桩总数
|
||||
*/
|
||||
Long countTotalPilesByMerchantIds(@Param("merchantIdList") List<String> merchantIdList);
|
||||
PileCountStatVO countPilesStat(@Param("merchantIdList") List<String> merchantIdList, @Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 按merchantId分组汇总settle_order_report(每个商户一行,Java再汇总)
|
||||
|
||||
@@ -165,17 +165,4 @@ public interface PileConnectorInfoMapper {
|
||||
*/
|
||||
Long countOnlinePiles(@Param("merchantIdList") List<String> merchantIdList, @Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 统计直流充电桩数量(快充)
|
||||
*
|
||||
* @return 直流充电桩数量
|
||||
*/
|
||||
Long countDcPiles(@Param("merchantIdList") List<String> merchantIdList, @Param("stationIdList") List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 统计交流充电桩数量(慢充)
|
||||
*
|
||||
* @return 交流充电桩数量
|
||||
*/
|
||||
Long countAcPiles(@Param("merchantIdList") List<String> merchantIdList, @Param("stationIdList") List<String> stationIdList);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.jsowell.pile.vo.uniapp.customer.GroundLockInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PersonalPileInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.PileConnectorDetailVO;
|
||||
import com.jsowell.pile.vo.web.IndexGeneralSituationVO;
|
||||
import com.jsowell.pile.vo.web.PileCountStatVO;
|
||||
import com.jsowell.pile.vo.web.PileDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -285,14 +286,9 @@ public interface PileBasicInfoService {
|
||||
List<String> merchantIdList, List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 根据站点ID列表统计充电桩总数
|
||||
* 统计充电桩数量(总数/直流/交流同源,保证 直流 + 交流 = 总数)
|
||||
*/
|
||||
Long countTotalPilesByStationIds(List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 根据商户ID列表统计充电桩总数
|
||||
*/
|
||||
Long countTotalPilesByMerchantIds(List<String> merchantIdList);
|
||||
PileCountStatVO countPilesStat(List<String> merchantIdList, List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 大数据平台专用:根据商户ID查settle_order_report GROUP BY merchant_id,Java汇总返回
|
||||
|
||||
@@ -206,17 +206,4 @@ public interface PileConnectorInfoService {
|
||||
*/
|
||||
Long countOnlinePiles(List<String> merchantIdList, List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 统计直流充电桩数量(快充)
|
||||
*
|
||||
* @return 直流充电桩数量
|
||||
*/
|
||||
Long countDcPiles(List<String> merchantIdList, List<String> stationIdList);
|
||||
|
||||
/**
|
||||
* 统计交流充电桩数量(慢充)
|
||||
*
|
||||
* @return 交流充电桩数量
|
||||
*/
|
||||
Long countAcPiles(List<String> merchantIdList, List<String> stationIdList);
|
||||
}
|
||||
|
||||
@@ -1791,13 +1791,8 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countTotalPilesByStationIds(List<String> stationIdList) {
|
||||
return pileBasicInfoMapper.countTotalPilesByStationIds(stationIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countTotalPilesByMerchantIds(List<String> merchantIdList) {
|
||||
return pileBasicInfoMapper.countTotalPilesByMerchantIds(merchantIdList);
|
||||
public PileCountStatVO countPilesStat(List<String> merchantIdList, List<String> stationIdList) {
|
||||
return pileBasicInfoMapper.countPilesStat(merchantIdList, stationIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1319,13 +1319,4 @@ public class PileConnectorInfoServiceImpl implements PileConnectorInfoService {
|
||||
return pileConnectorInfoMapper.countOnlinePiles(merchantIdList, stationIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countDcPiles(List<String> merchantIdList, List<String> stationIdList) {
|
||||
return pileConnectorInfoMapper.countDcPiles(merchantIdList, stationIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long countAcPiles(List<String> merchantIdList, List<String> stationIdList) {
|
||||
return pileConnectorInfoMapper.countAcPiles(merchantIdList, stationIdList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 充电桩数量统计VO
|
||||
* 总数/直流/交流同源统计(pile_basic_info + pile_model_info),保证 直流 + 交流 = 总数
|
||||
*
|
||||
* @author jsowell
|
||||
*/
|
||||
@Data
|
||||
public class PileCountStatVO {
|
||||
/**
|
||||
* 充电桩总数(型号为直流或交流的有效桩)
|
||||
*/
|
||||
private Long totalPiles;
|
||||
|
||||
/**
|
||||
* 直流充电桩数量
|
||||
*/
|
||||
private Long dcPileCount;
|
||||
|
||||
/**
|
||||
* 交流充电桩数量
|
||||
*/
|
||||
private Long acPileCount;
|
||||
}
|
||||
@@ -534,28 +534,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
group by t1.trade_date
|
||||
</select>
|
||||
|
||||
<select id="countTotalPilesByStationIds" resultType="java.lang.Long">
|
||||
select count(distinct t1.sn)
|
||||
from pile_basic_info t1
|
||||
where t1.del_flag = '0'
|
||||
<if test="stationIdList != null and stationIdList.size() > 0">
|
||||
and t1.station_id in
|
||||
<foreach collection="stationIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countTotalPilesByMerchantIds" resultType="java.lang.Long">
|
||||
select count(distinct t1.sn)
|
||||
<!-- 充电桩数量统计:总数/直流/交流同源,保证 直流 + 交流 = 总数 -->
|
||||
<select id="countPilesStat" resultType="com.jsowell.pile.vo.web.PileCountStatVO">
|
||||
select
|
||||
count(*) as totalPiles,
|
||||
coalesce(sum(case when t2.speed_type = '1' then 1 else 0 end), 0) as dcPileCount,
|
||||
coalesce(sum(case when t2.speed_type = '2' then 1 else 0 end), 0) as acPileCount
|
||||
from pile_basic_info t1
|
||||
join pile_model_info t2 on t2.id = t1.model_id and t2.del_flag = '0'
|
||||
where t1.del_flag = '0'
|
||||
and t2.speed_type in ('1', '2')
|
||||
<if test="merchantIdList != null and merchantIdList.size() > 0">
|
||||
and t1.merchant_id in
|
||||
<foreach collection="merchantIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="stationIdList != null and stationIdList.size() > 0">
|
||||
and t1.station_id in
|
||||
<foreach collection="stationIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 按merchantId分组汇总settle_order_report(每个商户一行,Java再汇总) -->
|
||||
|
||||
@@ -394,45 +394,4 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countDcPiles" resultType="java.lang.Long">
|
||||
select count(distinct t1.pile_sn)
|
||||
from pile_connector_info t1
|
||||
join pile_basic_info t2 on t2.sn = t1.pile_sn and t2.del_flag = '0'
|
||||
join pile_model_info t3 on t3.id = t2.model_id and t3.del_flag = '0'
|
||||
where t1.del_flag = '0'
|
||||
and t3.speed_type = '1'
|
||||
<if test="merchantIdList != null and merchantIdList.size() > 0">
|
||||
and t2.merchant_id in
|
||||
<foreach collection="merchantIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="stationIdList != null and stationIdList.size() > 0">
|
||||
and t2.station_id in
|
||||
<foreach collection="stationIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countAcPiles" resultType="java.lang.Long">
|
||||
select count(distinct t1.pile_sn)
|
||||
from pile_connector_info t1
|
||||
join pile_basic_info t2 on t2.sn = t1.pile_sn and t2.del_flag = '0'
|
||||
join pile_model_info t3 on t3.id = t2.model_id and t3.del_flag = '0'
|
||||
where t1.del_flag = '0'
|
||||
and t3.speed_type = '2'
|
||||
<if test="merchantIdList != null and merchantIdList.size() > 0">
|
||||
and t2.merchant_id in
|
||||
<foreach collection="merchantIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="stationIdList != null and stationIdList.size() > 0">
|
||||
and t2.station_id in
|
||||
<foreach collection="stationIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user