| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/8 9:29 |
| | |
| | | private String address; |
| | | @ApiModelProperty(value = "站点电话") |
| | | private String phone; |
| | | @ApiModelProperty(value = "lon") |
| | | private String lon; |
| | | @ApiModelProperty(value = "lat") |
| | | private String lat; |
| | | @ApiModelProperty(value = "服务电话") |
| | | private String servicePhone; |
| | | @ApiModelProperty(value = "车位数") |
| | |
| | | private boolean authUpdate = true; |
| | | @ApiModelProperty(value = "删除权限") |
| | | private boolean authDelete = true; |
| | | @ApiModelProperty("超1") |
| | | private Long c1; |
| | | @ApiModelProperty("超2") |
| | | private Long c2; |
| | | @ApiModelProperty("快1") |
| | | private Long k1; |
| | | @ApiModelProperty("快2") |
| | | private Long k2; |
| | | @ApiModelProperty("慢1") |
| | | private Long m1; |
| | | @ApiModelProperty("慢2") |
| | | private Long m2; |
| | | |
| | | @ApiModelProperty("利用率") |
| | | private BigDecimal p1; |
| | | } |
| | |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.GeodesyUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | @GetMapping("/map/getSiteList") |
| | | @ApiOperation(value = "获取站点", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R<List<GetSiteListDTO>> getMapSiteList(GetSiteList siteList){ |
| | | |
| | | siteList.setPageCurr(1); |
| | | siteList.setPageCurr(99999); |
| | | siteList.setPageSize(99999); |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | for (GetSiteListDTO record : list.getRecords()) { |
| | | Long count = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); |
| | | record.setC1(count); |
| | | Long count1 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 1).eq(TChargingGun::getStatus, 2).count(); |
| | | record.setC2(count1); |
| | | Long count2 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); |
| | | record.setK1(count2); |
| | | Long count3 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 2).eq(TChargingGun::getStatus, 2).count(); |
| | | record.setK2(count3); |
| | | Long count4 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, new int[]{3, 4, 5, 6}).count(); |
| | | record.setM1(count4); |
| | | Long count5 = chargingGunService.lambdaQuery().eq(TChargingGun::getChargingPileId, record.getId()).eq(TChargingGun::getChargeMode, 3).eq(TChargingGun::getStatus, 2).count(); |
| | | record.setM2(count5); |
| | | |
| | | //利用率 |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | //获取该站点的总充电度数 |
| | | List<TChargingOrder> chargingOrders = chargingOrderClient.getList(record.getId()).getData(); |
| | | for (TChargingOrder chargingOrder : chargingOrders) { |
| | | bigDecimal = bigDecimal.add(chargingOrder.getChargingCapacity()); |
| | | } |
| | | //获取该站点的所有充电桩 |
| | | List<TChargingPile> chargingPiles = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, record.getId()).list(); |
| | | BigDecimal bigDecimal1 = new BigDecimal("0"); |
| | | for (TChargingPile chargingPile : chargingPiles) { |
| | | bigDecimal1 = bigDecimal1.add(chargingPile.getRatedPower()); |
| | | } |
| | | BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")); |
| | | |
| | | BigDecimal divide = bigDecimal.divide(multiply, 0, BigDecimal.ROUND_HALF_UP); |
| | | record.setP1(divide); |
| | | |
| | | } |
| | | return R.ok(list.getRecords()); |
| | | } |
| | | |
| | |
| | | List<GetSiteListDTO> records = siteService.getSiteList(siteList).getRecords(); |
| | | List<Integer> collect = records.stream().map(GetSiteListDTO::getId).collect(Collectors.toList()); |
| | | // 通过时间段获取和充电桩id获取各个充电站的充电订单 |
| | | List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); |
| | | List<ChargingOrderGroup> data = chargingOrderClient.getBySiteIdAndTime(chargingPercentProvinceDto).getData(); |
| | | // 计算利用率展示 |
| | | for (ChargingOrderGroup datum : data) { |
| | | List<TChargingPile> chargingPiles = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, datum.getSiteId()).list(); |
| | |
| | | DATE_FORMAT(a.establishment_time, '%Y-%m-%d %H:%i:%s') as establishmentTime, |
| | | c.num as chargingPileNumber, |
| | | a.sort, |
| | | a.lon, |
| | | a.lat, |
| | | a.accounting_strategy_id as accountingStrategyId, |
| | | if(a.accounting_strategy_id is null, 1, if(d.site_id is null, 1, 2)) as accountingStrategyType |
| | | from t_site a |
| | |
| | | |
| | | // 获取本月1号的日期 |
| | | YearMonth yearMonth = YearMonth.from(today); |
| | | start = yearMonth.atDay(1); |
| | | |
| | | System.out.println("本月1号是: " + start); |
| | | // start = yearMonth.atDay(1); |
| | | // |
| | | // System.out.println("本月1号是: " + start); |
| | | }else if (statisticsQueryDto.getDayType()==4){ |
| | | LocalDate today = LocalDate.now(); |
| | | // 获取当前年份 |
| | | int currentYear = today.getYear(); |
| | | // 获取今年1月1日的日期 |
| | | start = LocalDate.of(currentYear, 1, 1); |
| | | System.out.println("今年1月1日是: " + start); |
| | | start = statisticsQueryDto.getStartTime(); |
| | | end = statisticsQueryDto.getEndTime(); |
| | | }else if (statisticsQueryDto.getDayType()==5){ |
| | | |
| | | // 获取今年1月1日的日期 |
| | |
| | | @Data |
| | | public class SixVipDto { |
| | | private String month; |
| | | private String vipName; |
| | | private String name; |
| | | private Integer vipId; |
| | | private BigDecimal paymentAmount; |
| | | } |
| | |
| | | |
| | | List<Map<String, Object>> getSumByType(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | | List<Map<String, Object>> getDateData(List<Long> chargingOrderIds); |
| | | List<Map<String, Object>> getDateData(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | | List<Map<String, Object>> getWeekData(List<Long> chargingOrderIds); |
| | | List<Map<String, Object>> getWeekData(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | | List<Map<String, Object>> getMonthData(List<Long> chargingOrderIds); |
| | | List<Map<String, Object>> getMonthData(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | | List<Map<String, Object>> getYearData(List<Long> chargingOrderIds); |
| | | List<Map<String, Object>> getYearData(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | | List<ChargingOrderListVO> chargingList(@Param("pageInfo")PageInfo<ChargingOrderListVO> pageInfo, @Param("req") ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2); |
| | | List<ChargingOrderListVO> chargingListNoPage( @Param("req")ChargingListQuery dto, @Param("startTime1")String startTime1, @Param("startTime2")String startTime2, @Param("endTime1")String endTime1, @Param("endTime2")String endTime2); |
| | | |
| | | List<Map<String, Object>> getByDate(List<Long> chargingOrderIds); |
| | | List<Map<String, Object>> getByDate(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | | List<Map<String, Object>> queryPower(List<Integer> siteIds); |
| | | List<Map<String, Object>> queryPower(@Param("siteIds")List<Integer> siteIds); |
| | | |
| | | Map<String, Object> queryPowerLevel(@Param("siteIds") List<Integer> siteIds,@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | |
| | | |
| | | </select> |
| | | <select id="chargingOrderGroup" resultType="com.ruoyi.common.core.dto.ChargingOrderGroup"> |
| | | SELECT SUM(charging_capacity) ,site_id |
| | | FROM t_charging_order |
| | | GROUP BY site_id |
| | | SELECT SUM(tc.charging_capacity) as charging_capacity,tc.site_id |
| | | FROM t_charging_order tc |
| | | left join `charging_pile_service`.`t_site` ts on tc.site_id = ts.id |
| | | <where> |
| | | <if test="chargingPercentProvinceDto.date1 != null"> |
| | | AND create_time >= #{chargingPercentProvinceDto.date1} |
| | | AND tc.create_time >= #{chargingPercentProvinceDto.date1} |
| | | </if> |
| | | <if test="chargingPercentProvinceDto.date2 != null"> |
| | | AND create_time <= #{chargingPercentProvinceDto.date2} |
| | | AND tc.create_time <= #{chargingPercentProvinceDto.date2} |
| | | </if> |
| | | <if test="chargingPercentProvinceDto.provinceCode != null"> |
| | | AND province_code = #{chargingPercentProvinceDto.provinceCode} |
| | | AND ts.province_code = #{chargingPercentProvinceDto.provinceCode} |
| | | </if> |
| | | |
| | | </where> |
| | | GROUP BY site_id |
| | | |
| | | |
| | | |
| | | </select> |
| | |
| | | |
| | | </select> |
| | | <select id="countAll" resultType="java.util.Map"> |
| | | select sum(electrovalence),sum(service_charge),sum(commission_amount),sum(sharing_amount) |
| | | select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,sum(commission_amount) as commission_amount,sum(sharing_amount) as sharing_amount |
| | | from t_charging_order |
| | | where create_time >= #{sixBefore} and del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) |
| | | </select> |
| | |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | SUM(payment_amount) AS paymentAmount, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | SUM(payment_amount) AS paymentAmount, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | SUM(payment_amount) AS paymentAmount, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | SUM(payment_amount) AS paymentAmount, |
| | | |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | | <where> |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) and YEAR(createTime) = YEAR(NOW()) |
| | | del_flag = 0 and recharge_payment_status = 2 and ISNULL(refund_status) and YEAR(create_time) = YEAR(NOW()) |
| | | <if test="chargingOrderIds != null and chargingOrderIds.size() > 0"> |
| | | AND id IN |
| | | <foreach collection="chargingOrderIds" item="chargingOrderId" open="(" separator="," close=")"> |
| | |
| | | <select id="queryPower" resultType="java.util.Map"> |
| | | SELECT |
| | | 'today' AS data_type, |
| | | DATE_FORMAT(create_time, '%Y-%m-%d %H') AS TIME, |
| | | DATE_FORMAT(create_time, '%H') AS TIME, |
| | | SUM(power) AS power |
| | | FROM |
| | | t_charging_order |
| | |
| | | |
| | | SELECT |
| | | 'yesterday' AS data_type, |
| | | DATE_FORMAT(create_time, '%Y-%m-%d %H') AS TIME, |
| | | DATE_FORMAT(create_time, '%H') AS TIME, |
| | | SUM(power) AS power |
| | | FROM |
| | | t_charging_order |
| | |
| | | t_vip_order |
| | | <where> |
| | | del_flag = 0 AND |
| | | payment_status = 2 AND |
| | | payment_status = 2 |
| | | <if test="sixBefore != null"> |
| | | AND create_time > #{sixBefore} |
| | | </if> |
| | |
| | | LEFT JOIN `charging_pile_other`.`t_vip` tp on subquery.vip_id = tp.id |
| | | GROUP BY |
| | | DATE_FORMAT(subquery.create_time, '%Y-%m'), |
| | | tp.`name`; |
| | | tp.`name` |
| | | |
| | | |
| | | </select> |