增加订单统计
This commit is contained in:
parent
2c92b82d0e
commit
8a6a7ec9c3
@ -351,7 +351,7 @@
|
||||
xr.power_fee as powerFee,
|
||||
xr.service_fee as serviceFee
|
||||
from xhpc_rate_time as xrt
|
||||
left join xhpc_rate as xr on xr.rate_id = xrt.rate_id
|
||||
left join xhpc_rate as xr on xr.rate_id = xrt.rate_id
|
||||
where xrt.charging_station_id = #{chargingStationId}
|
||||
and xrt.status = 0
|
||||
and xrt.del_flag = 0
|
||||
@ -366,7 +366,7 @@
|
||||
te.serial_number as serialNumber,
|
||||
cp.input_voltage as inputVoltage
|
||||
from xhpc_terminal as te
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||
left join xhpc_charging_pile as cp on cp.charging_pile_id = te.charging_pile_id
|
||||
where te.charging_station_id = #{chargingStationId}
|
||||
and te.status = 0
|
||||
and te.del_flag = 0
|
||||
@ -793,7 +793,7 @@
|
||||
ra.power_fee as powerFee,
|
||||
ra.service_fee as serviceFee
|
||||
from xhpc_rate_time as rt
|
||||
left join xhpc_rate as ra on ra.rate_id = rt.rate_id
|
||||
left join xhpc_rate as ra on ra.rate_id = rt.rate_id
|
||||
where rt.charging_station_id = #{chargingStationId}
|
||||
and rt.del_flag = 0
|
||||
</select>
|
||||
|
||||
@ -3,13 +3,14 @@ package com.xhpc.order.controller;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.order.service.IXhpcStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,17 +24,119 @@ import java.util.Map;
|
||||
@Api(value = "统计接口", tags = "统计接口")
|
||||
public class XhpcStatisticsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcStatisticsService xhpcStatisticsService;
|
||||
/**
|
||||
* 小时统计
|
||||
* @param chargingPileIds 电站id集合
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTimeIntervalPage")
|
||||
public TableDataInfo getTimeIntervalPage(String phone, String transactionNumber, @RequestParam("status")Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, @RequestParam("userId") Long userId, Integer type)
|
||||
public TableDataInfo getTimeIntervalPage(String chargingPileIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
//List<Map<String, Object>> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type);
|
||||
return getDataTable(new ArrayList<>());
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getTimeIntervalPage(chargingPileIds,internetUserId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期统计
|
||||
* @param chargingPileIds 电站id集合
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getDateIntervalPage")
|
||||
public TableDataInfo getDateIntervalPage(String chargingPileIds,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getDateIntervalPage(chargingPileIds,internetUserId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 电站统计
|
||||
* @param stationName 电站名称
|
||||
* @param operatorName 运营商名称
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getStationIntervalPage")
|
||||
public TableDataInfo getStationIntervalPage(String stationName,String operatorName,Long internetUserId, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getStationIntervalPage(stationName,operatorName,internetUserId,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 运营商统计
|
||||
* @param operatorName 运营商名称
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getOperatorIntervalPage")
|
||||
public TableDataInfo getOperatorIntervalPage(String operatorName, Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getOperatorIntervalPage(operatorName,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流量方统计
|
||||
* @param internetUserName 流量方名称
|
||||
* @param internetUserId 流量方id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getInternetUserIntervalPage")
|
||||
public TableDataInfo getInternetUserIntervalPage(String internetUserName,Long internetUserId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getInternetUserIntervalPage(internetUserName,internetUserId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 终端统计
|
||||
* @param chargingStationName 电站名称
|
||||
* @param terminalName 电桩名称
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTerminalIntervalPage")
|
||||
public TableDataInfo getTerminalIntervalPage(String chargingStationName,String terminalName,Long operatorId,String startTime, String endTime, @RequestParam("userId") Long userId, @RequestParam("type")Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getTerminalIntervalPage(chargingStationName,terminalName,operatorId,startTime,endTime,userId,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public class XhpcStatisticsTimeInterval extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal platformSvcCommisssion;
|
||||
/**
|
||||
* 运维总抽成
|
||||
* 运维总金额抽成
|
||||
*/
|
||||
private BigDecimal operationCommission;
|
||||
/**
|
||||
@ -86,13 +86,19 @@ public class XhpcStatisticsTimeInterval extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal operationSvcCommission;
|
||||
/**
|
||||
* 0 平台 1 运营商 2流量方
|
||||
* 流量方id
|
||||
*/
|
||||
private Integer type;
|
||||
private Long internetUserId;
|
||||
/**
|
||||
* 运营商和流量方id
|
||||
* 运营商id
|
||||
*/
|
||||
private BigDecimal operatorInternetId;
|
||||
private Long operatorId;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
private Long chargingPileId;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@ -279,24 +285,24 @@ public class XhpcStatisticsTimeInterval extends BaseEntity {
|
||||
this.operationSvcCommission = operationSvcCommission;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
public Long getInternetUserId() {
|
||||
|
||||
return type;
|
||||
return internetUserId;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
public void setInternetUserId(Long internetUserId) {
|
||||
|
||||
this.type = type;
|
||||
this.internetUserId = internetUserId;
|
||||
}
|
||||
|
||||
public BigDecimal getOperatorInternetId() {
|
||||
public Long getOperatorId() {
|
||||
|
||||
return operatorInternetId;
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
public void setOperatorInternetId(BigDecimal operatorInternetId) {
|
||||
public void setOperatorId(Long operatorId) {
|
||||
|
||||
this.operatorInternetId = operatorInternetId;
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public Integer getDelFlag() {
|
||||
@ -309,4 +315,14 @@ public class XhpcStatisticsTimeInterval extends BaseEntity {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public Long getChargingPileId() {
|
||||
|
||||
return chargingPileId;
|
||||
}
|
||||
|
||||
public void setChargingPileId(Long chargingPileId) {
|
||||
|
||||
this.chargingPileId = chargingPileId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
package com.xhpc.order.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/9/1 10:00
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface XhpcStatisticsServiceMapper {
|
||||
|
||||
/**
|
||||
* 小时统计
|
||||
* @param chargingPileIds 电站id集合
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getTimeIntervalPage(@Param("chargingPileIds") List<String> chargingPileIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 日期统计
|
||||
* @param chargingPileIds 电站id集合
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getDateIntervalPage(@Param("chargingPileIds") List<String> chargingPileIds,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 电站统计
|
||||
* @param stationName 电站名称
|
||||
* @param operatorName 运营商名称
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getStationIntervalPage(@Param("stationName") String stationName,@Param("operatorName") String operatorName,@Param("internetUserId") Long internetUserId,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 运营商统计
|
||||
* @param operatorName 运营商名称
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getOperatorIntervalPage(@Param("operatorName") String operatorName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* 流量方统计
|
||||
* @param internetUserName 流量方名称
|
||||
* @param internetUserId 流量方id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getInternetUserIntervalPage(@Param("internetUserName") String internetUserName,@Param("internetUserId") Long internetUserId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 终端统计
|
||||
* @param chargingStationName 电站名称
|
||||
* @param terminalName 电桩名称
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getTerminalIntervalPage(@Param("chargingStationName") String chargingStationName,@Param("terminalName") String terminalName,@Param("operatorId") Long operatorId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.xhpc.order.service;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/31 16:21
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface IStatisticsService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.xhpc.order.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/31 16:21
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface IXhpcStatisticsService {
|
||||
|
||||
/**
|
||||
* 小时统计
|
||||
* @param chargingPileIds 电站id集合
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getTimeIntervalPage(String chargingPileIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 日期统计
|
||||
* @param chargingPileIds 电站id集合
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getDateIntervalPage(String chargingPileIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
|
||||
|
||||
/**
|
||||
* 电站统计
|
||||
* @param stationName 电站名称
|
||||
* @param operatorName 运营商名称
|
||||
* @param internetUserId 流量方id
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getStationIntervalPage(String stationName,String operatorName, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type);
|
||||
|
||||
/**
|
||||
* 运营商统计
|
||||
* @param operatorName 运营商名称
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getOperatorIntervalPage(String operatorName,Long operatorId, String startTime, String endTime, Long userId, Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 流量方统计
|
||||
* @param internetUserName 流量方名称
|
||||
* @param internetUserId 流量方id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getInternetUserIntervalPage(String internetUserName, Long internetUserId, String startTime, String endTime, Long userId, Integer type);
|
||||
|
||||
|
||||
/**
|
||||
* 终端统计
|
||||
* @param chargingStationName 电站名称
|
||||
* @param terminalName 电桩名称
|
||||
* @param operatorId 运营商id
|
||||
* @param startTime 订单开始时间
|
||||
* @param endTime 订单结束时间
|
||||
* @param userId 用户id
|
||||
* @param type 1 平台 2 运营商 3流量方
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getTerminalIntervalPage(String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime, Long userId, Integer type);
|
||||
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
import com.xhpc.order.service.IStatisticsService;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/31 16:22
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class StatisticsServiceImpl implements IStatisticsService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,256 @@
|
||||
package com.xhpc.order.service.impl;
|
||||
|
||||
|
||||
import com.xhpc.order.mapper.XhpcStatisticsServiceMapper;
|
||||
import com.xhpc.order.service.IXhpcStatisticsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2021/8/31 16:22
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
|
||||
|
||||
@Autowired
|
||||
private XhpcStatisticsServiceMapper xhpcStatisticsServiceMapper;
|
||||
@Override
|
||||
public List<Map<String, Object>> getTimeIntervalPage(String chargingPileIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
|
||||
|
||||
if(type==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(type==2){
|
||||
if(operatorId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type==3){
|
||||
if(internetUserId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type!=1){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> chargingPileId =new ArrayList<>();
|
||||
if(!"".equals(chargingPileIds) && chargingPileIds !=null){
|
||||
chargingPileId= Arrays.asList(chargingPileIds.split(","));
|
||||
}
|
||||
List<Map<String, Object>> list = xhpcStatisticsServiceMapper.getTimeIntervalPage(chargingPileId, internetUserId, operatorId, startTime, endTime, type);
|
||||
List<Map<String, Object>> page =new ArrayList<>();
|
||||
if(list !=null && list.size()>0){
|
||||
for (int i = 1; i <=24 ; i++) {
|
||||
boolean fan = true;
|
||||
for (Map<String, Object> map:list) {
|
||||
int status = (int)map.get("status");
|
||||
if(status==i){
|
||||
page.add(map);
|
||||
fan=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(fan){
|
||||
if(i==1){
|
||||
page.add(getStatistics("00:00-01:00"));
|
||||
}else if(i==2){
|
||||
page.add(getStatistics("01:00-02:00"));
|
||||
}else if(i==3){
|
||||
page.add(getStatistics("02:00-03:00"));
|
||||
}else if(i==4){
|
||||
page.add(getStatistics("03:00-04:00"));
|
||||
}else if(i==5){
|
||||
page.add(getStatistics("04:00-05:00"));
|
||||
}else if(i==6){
|
||||
page.add(getStatistics("05:00-06:00"));
|
||||
}else if(i==7){
|
||||
page.add(getStatistics("06:00-07:00"));
|
||||
}else if(i==8){
|
||||
page.add(getStatistics("07:00-08:00"));
|
||||
}else if(i==9){
|
||||
page.add(getStatistics("08:00-09:00"));
|
||||
}else if(i==10){
|
||||
page.add(getStatistics("09:00-10:00"));
|
||||
}else if(i==11){
|
||||
page.add(getStatistics("10:00-11:00"));
|
||||
}else if(i==12){
|
||||
page.add(getStatistics("11:00-12:00"));
|
||||
}else if(i==13){
|
||||
page.add(getStatistics("12:00-13:00"));
|
||||
}else if(i==14){
|
||||
page.add(getStatistics("13:00-14:00"));
|
||||
}else if(i==15){
|
||||
page.add(getStatistics("14:00-15:00"));
|
||||
}else if(i==16){
|
||||
page.add(getStatistics("15:00-16:00"));
|
||||
}else if(i==17){
|
||||
page.add(getStatistics("16:00-17:00"));
|
||||
}else if(i==18){
|
||||
page.add(getStatistics("17:00-18:00"));
|
||||
}else if(i==19){
|
||||
page.add(getStatistics("18:00-19:00"));
|
||||
}else if(i==20){
|
||||
page.add(getStatistics("19:00-20:00"));
|
||||
}else if(i==21){
|
||||
page.add(getStatistics("20:00-21:00"));
|
||||
}else if(i==22){
|
||||
page.add(getStatistics("21:00-22:00"));
|
||||
}else if(i==23){
|
||||
page.add(getStatistics("22:00-23:00"));
|
||||
}else if(i==24){
|
||||
page.add(getStatistics("23:00-24:00"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
page.add(getStatistics("00:00-01:00"));
|
||||
page.add(getStatistics("01:00-02:00"));
|
||||
page.add(getStatistics("02:00-03:00"));
|
||||
page.add(getStatistics("03:00-04:00"));
|
||||
page.add(getStatistics("04:00-05:00"));
|
||||
page.add(getStatistics("05:00-06:00"));
|
||||
page.add(getStatistics("06:00-07:00"));
|
||||
page.add(getStatistics("07:00-08:00"));
|
||||
page.add(getStatistics("08:00-09:00"));
|
||||
page.add(getStatistics("09:00-10:00"));
|
||||
page.add(getStatistics("10:00-11:00"));
|
||||
page.add(getStatistics("11:00-12:00"));
|
||||
page.add(getStatistics("12:00-13:00"));
|
||||
page.add(getStatistics("13:00-14:00"));
|
||||
page.add(getStatistics("14:00-15:00"));
|
||||
page.add(getStatistics("15:00-16:00"));
|
||||
page.add(getStatistics("16:00-17:00"));
|
||||
page.add(getStatistics("17:00-18:00"));
|
||||
page.add(getStatistics("18:00-19:00"));
|
||||
page.add(getStatistics("19:00-20:00"));
|
||||
page.add(getStatistics("20:00-21:00"));
|
||||
page.add(getStatistics("21:00-22:00"));
|
||||
page.add(getStatistics("22:00-23:00"));
|
||||
page.add(getStatistics("23:00-24:00"));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDateIntervalPage(String chargingPileIds, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
|
||||
if(type==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(type==2){
|
||||
if(operatorId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type==3){
|
||||
if(internetUserId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type!=1){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> chargingPileId =new ArrayList<>();
|
||||
if(!"".equals(chargingPileIds) && chargingPileIds !=null){
|
||||
chargingPileId= Arrays.asList(chargingPileIds.split(","));
|
||||
}
|
||||
|
||||
return xhpcStatisticsServiceMapper.getDateIntervalPage(chargingPileId, internetUserId, operatorId, startTime, endTime, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getStationIntervalPage(String stationName, String operatorName, Long internetUserId, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
|
||||
if(type==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(type==2){
|
||||
if(operatorId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type==3){
|
||||
if(internetUserId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type!=1){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return xhpcStatisticsServiceMapper.getStationIntervalPage(stationName,operatorName,internetUserId,operatorId,startTime,endTime,type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getOperatorIntervalPage(String operatorName, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
|
||||
if(type==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(type==2){
|
||||
if(operatorId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type==3){
|
||||
return new ArrayList<>();
|
||||
}else if(type!=1){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return xhpcStatisticsServiceMapper.getOperatorIntervalPage(operatorName, operatorId, startTime, endTime, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getInternetUserIntervalPage(String internetUserName, Long internetUserId, String startTime, String endTime, Long userId, Integer type) {
|
||||
if(type==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(type==2){
|
||||
return new ArrayList<>();
|
||||
}else if(type==3){
|
||||
if(internetUserId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type!=1){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetUserName, internetUserId, startTime, endTime, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getTerminalIntervalPage(String chargingStationName, String terminalName, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
|
||||
if(type==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if(type==2){
|
||||
if(operatorId==null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if(type==3){
|
||||
return new ArrayList<>();
|
||||
}else if(type!=1){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationName, terminalName, operatorId, startTime, endTime, type);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> getStatistics(String time){
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("chargingDegree",0.00);
|
||||
map.put("chargingTime",0.00);
|
||||
map.put("chargingNumber",0);
|
||||
map.put("powerPrice",0.00);
|
||||
map.put("servicePrice",0.00);
|
||||
map.put("totalPrice",0.00);
|
||||
map.put("promotionDiscount",0.00);
|
||||
map.put("actPrice",0.00);
|
||||
map.put("actPowerPrice",0.00);
|
||||
map.put("actServicePrice",0.00);
|
||||
map.put("internetCommission",0.00);
|
||||
map.put("internetSvcCommission",0.00);
|
||||
map.put("platformCommission",0.00);
|
||||
map.put("platformSvcCommisssion",0.00);
|
||||
map.put("operationCommission",0.00);
|
||||
map.put("operationSvcCommission",0.00);
|
||||
map.put("time",time);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,282 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.order.mapper.XhpcStatisticsServiceMapper">
|
||||
|
||||
<resultMap type="com.xhpc.order.domain.XhpcStatisticsTimeInterval" id="StatisticsTimeIntervalResult">
|
||||
<result column="statistics_time_interval_id" property="statisticsTimeIntervalId"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="charging_degree" property="chargingDegree"/>
|
||||
<result column="charging_time" property="chargingTime"/>
|
||||
<result column="charging_number" property="chargingNumber"/>
|
||||
<result column="power_price" property="powerPrice"/>
|
||||
<result column="service_price" property="servicePrice"/>
|
||||
<result column="total_price" property="totalPrice"/>
|
||||
<result column="promotion_discount" property="promotionDiscount"/>
|
||||
<result column="internet_commission" property="internetCommission"/>
|
||||
<result column="internet_svc_commission" property="internetSvcCommission"/>
|
||||
<result column="platform_commission" property="platformCommission"/>
|
||||
<result column="platform_svc_commisssion" property="platformSvcCommisssion"/>
|
||||
<result column="operation_commission" property="operationCommission"/>
|
||||
<result column="operation_svc_commission" property="operationSvcCommission"/>
|
||||
<result column="operator_id" property="operatorId"/>
|
||||
<result column="internet_user_id" property="internetUserId"/>
|
||||
<result column="charging_pile_id" property="chargingPileId"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getTimeIntervalPage" resultType="map">
|
||||
select
|
||||
sum(charging_degree) chargingDegree,
|
||||
sum(charging_time) chargingTime,
|
||||
sum(charging_number) chargingNumber,
|
||||
sum(power_price) powerPrice,
|
||||
sum(service_price) servicePrice,
|
||||
sum(total_price) totalPrice,
|
||||
sum(promotion_discount) promotionDiscount,
|
||||
sum(internet_commission) internetCommission,
|
||||
sum(internet_svc_commission) internetSvcCommission,
|
||||
sum(platform_commission) platformCommission,
|
||||
sum(platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(operation_commission) operationCommission,
|
||||
sum(operation_svc_commission) operationSvcCommission,
|
||||
status,
|
||||
case when status=1 then "00:00-01:00"
|
||||
when status=2 then "01:00-02:00"
|
||||
when status=3 then "02:00-03:00"
|
||||
when status=4 then "03:00-04:00"
|
||||
when status=5 then "04:00-05:00"
|
||||
when status=6 then "05:00-06:00"
|
||||
when status=7 then "06:00-07:00"
|
||||
when status=8 then "07:00-08:00"
|
||||
when status=9 then "08:00-09:00"
|
||||
when status=10 then "09:00-10:00"
|
||||
when status=11 then "10:00-11:00"
|
||||
when status=12 then "11:00-12:00"
|
||||
when status=13 then "12:00-13:00"
|
||||
when status=14 then "13:00-14:00"
|
||||
when status=15 then "14:00-15:00"
|
||||
when status=16 then "15:00-16:00"
|
||||
when status=17 then "16:00-17:00"
|
||||
when status=18 then "17:00-18:00"
|
||||
when status=19 then "18:00-19:00"
|
||||
when status=20 then "19:00-20:00"
|
||||
when status=21 then "20:00-21:00"
|
||||
when status=22 then "21:00-22:00"
|
||||
when status=23 then "22:00-23:00"
|
||||
when status=24 then "23:00-24:00"
|
||||
end time
|
||||
from xhpc_statistics_time_interval
|
||||
where del_flag=0
|
||||
<if test="chargingPileIds !=null and chargingPileIds.size()>0">
|
||||
and charging_pile_id in
|
||||
<foreach collection="chargingPileIds" open="(" item="chargingPileId" separator="," close=")" >
|
||||
#{chargingPileId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
|
||||
and #{startTime} <=create_time
|
||||
and create_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and operator_id=#{operatorId}
|
||||
</if>
|
||||
<if test="type==3">
|
||||
and internet_user_id=#{internetUserId}
|
||||
</if>
|
||||
group by status
|
||||
order by status
|
||||
</select>
|
||||
|
||||
<select id="getDateIntervalPage" resultType="map">
|
||||
select
|
||||
sum(charging_degree) chargingDegree,
|
||||
sum(charging_time) chargingTime,
|
||||
sum(charging_number) chargingNumber,
|
||||
sum(power_price) powerPrice,
|
||||
sum(service_price) servicePrice,
|
||||
sum(total_price) totalPrice,
|
||||
sum(promotion_discount) promotionDiscount,
|
||||
sum(internet_commission) internetCommission,
|
||||
sum(internet_svc_commission) internetSvcCommission,
|
||||
sum(platform_commission) platformCommission,
|
||||
sum(platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(operation_commission) operationCommission,
|
||||
sum(operation_svc_commission) operationSvcCommission,
|
||||
DATE_FORMAT(create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_data
|
||||
where del_flag=0 and type=1
|
||||
<if test="chargingPileIds !=null and chargingPileIds.size()>0">
|
||||
and charging_pile_id in
|
||||
<foreach collection="chargingPileIds" open="(" item="chargingPileId" separator="," close=")" >
|
||||
#{chargingPileId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
|
||||
and #{startTime} <=create_time
|
||||
and create_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and operator_id=#{operatorId}
|
||||
</if>
|
||||
<if test="type==3">
|
||||
and internet_user_id=#{internetUserId}
|
||||
</if>
|
||||
group by create_time
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getStationIntervalPage" resultType="map">
|
||||
select
|
||||
sum(ss.charging_degree) chargingDegree,
|
||||
sum(ss.charging_time) chargingTime,
|
||||
sum(ss.charging_number) chargingNumber,
|
||||
sum(ss.power_price) powerPrice,
|
||||
sum(ss.service_price) servicePrice,
|
||||
sum(ss.total_price) totalPrice,
|
||||
sum(ss.promotion_discount) promotionDiscount,
|
||||
sum(ss.internet_commission) internetCommission,
|
||||
sum(ss.internet_svc_commission) internetSvcCommission,
|
||||
sum(ss.platform_commission) platformCommission,
|
||||
sum(ss.platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(ss.operation_commission) operationCommission,
|
||||
sum(ss.operation_svc_commission) operationSvcCommission,
|
||||
cs.name chargingStationName,
|
||||
op.name operatorName,
|
||||
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_station as ss
|
||||
left join xhpc_charging_station as cs on cs.charging_station_id = ss.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ss.operator_id
|
||||
where ss.del_flag=0 and ss.type=2
|
||||
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
|
||||
and #{startTime} <=ss.create_time
|
||||
and ss.create_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and ss.operator_id=#{operatorId}
|
||||
</if>
|
||||
<if test="type==3">
|
||||
and ss.internet_user_id=#{internetUserId}
|
||||
</if>
|
||||
<if test="stationName !=null and stationName !=''">
|
||||
and cs.name like concat('%', #{stationName}, '%')
|
||||
</if>
|
||||
<if test="operatorName !=null and operatorName !=''">
|
||||
and op.name like concat('%', #{operatorName}, '%')
|
||||
</if>
|
||||
group by ss.charging_station_id
|
||||
</select>
|
||||
|
||||
<select id="getOperatorIntervalPage" resultType="map">
|
||||
select
|
||||
sum(ss.charging_degree) chargingDegree,
|
||||
sum(ss.charging_time) chargingTime,
|
||||
sum(ss.charging_number) chargingNumber,
|
||||
sum(ss.power_price) powerPrice,
|
||||
sum(ss.service_price) servicePrice,
|
||||
sum(ss.total_price) totalPrice,
|
||||
sum(ss.promotion_discount) promotionDiscount,
|
||||
sum(ss.internet_commission) internetCommission,
|
||||
sum(ss.internet_svc_commission) internetSvcCommission,
|
||||
sum(ss.platform_commission) platformCommission,
|
||||
sum(ss.platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(ss.operation_commission) operationCommission,
|
||||
sum(ss.operation_svc_commission) operationSvcCommission,
|
||||
op.name operatorName,
|
||||
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_station as ss
|
||||
left join xhpc_operator as op on op.operator_id = ss.operator_id
|
||||
where ss.del_flag=0 and ss.type=2
|
||||
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
|
||||
and #{startTime} <=ss.create_time
|
||||
and ss.create_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and ss.operator_id=#{operatorId}
|
||||
</if>
|
||||
<if test="type==3">
|
||||
and ss.internet_user_id=#{internetUserId}
|
||||
</if>
|
||||
<if test="operatorName !=null and operatorName !=''">
|
||||
and op.name like concat('%', #{operatorName}, '%')
|
||||
</if>
|
||||
group by ss.operator_id
|
||||
</select>
|
||||
|
||||
<select id="getInternetUserIntervalPage" resultType="map">
|
||||
select
|
||||
sum(ss.charging_degree) chargingDegree,
|
||||
sum(ss.charging_time) chargingTime,
|
||||
sum(ss.charging_number) chargingNumber,
|
||||
sum(ss.power_price) powerPrice,
|
||||
sum(ss.service_price) servicePrice,
|
||||
sum(ss.total_price) totalPrice,
|
||||
sum(ss.promotion_discount) promotionDiscount,
|
||||
sum(ss.internet_commission) internetCommission,
|
||||
sum(ss.internet_svc_commission) internetSvcCommission,
|
||||
sum(ss.platform_commission) platformCommission,
|
||||
sum(ss.platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(ss.operation_commission) operationCommission,
|
||||
sum(ss.operation_svc_commission) operationSvcCommission,
|
||||
iu.name internetUserName,
|
||||
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_station as ss
|
||||
left join xhpc_internet_user as iu on iu.internet_user_id = ss.internet_user_id
|
||||
where ss.del_flag=0 and ss.type=2
|
||||
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
|
||||
and #{startTime} <=ss.create_time
|
||||
and ss.create_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type==3">
|
||||
and ss.internet_user_id=#{internetUserId}
|
||||
</if>
|
||||
<if test="internetUserName !=null and internetUserName !=''">
|
||||
and iu.name like concat('%', #{internetUserName}, '%')
|
||||
</if>
|
||||
group by ss.internet_user_id
|
||||
</select>
|
||||
|
||||
<select id="getTerminalIntervalPage" resultType="map">
|
||||
select
|
||||
sum(ss.charging_degree) chargingDegree,
|
||||
sum(ss.charging_time) chargingTime,
|
||||
sum(ss.charging_number) chargingNumber,
|
||||
sum(ss.power_price) powerPrice,
|
||||
sum(ss.service_price) servicePrice,
|
||||
sum(ss.total_price) totalPrice,
|
||||
sum(ss.promotion_discount) promotionDiscount,
|
||||
sum(ss.internet_commission) internetCommission,
|
||||
sum(ss.internet_svc_commission) internetSvcCommission,
|
||||
sum(ss.platform_commission) platformCommission,
|
||||
sum(ss.platform_svc_commisssion) platformSvcCommisssion,
|
||||
sum(ss.operation_commission) operationCommission,
|
||||
sum(ss.operation_svc_commission) operationSvcCommission,
|
||||
cs.name chargingStationName,
|
||||
te.name terminalName,
|
||||
DATE_FORMAT(ss.create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_station as ss
|
||||
left join xhpc_charging_station as cs on cs.charging_station_id = ss.charging_station_id
|
||||
left join xhpc_terminal as te on te.terminal_id = ss.terminal_id
|
||||
where ss.del_flag=0 and ss.type=3
|
||||
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
|
||||
and #{startTime} <=ss.create_time
|
||||
and ss.create_time <=#{endTime}
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and ss.operator_id=#{operatorId}
|
||||
</if>
|
||||
<if test="chargingStationName !=null and chargingStationName !=''">
|
||||
and cs.name like concat('%', #{chargingStationName}, '%')
|
||||
</if>
|
||||
<if test="terminalName !=null and terminalName !=''">
|
||||
and te.name like concat('%', #{terminalName}, '%')
|
||||
</if>
|
||||
group by ss.terminal_id
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user