优化统计接口

This commit is contained in:
yuyang 2021-09-02 11:18:14 +08:00
parent 8a6a7ec9c3
commit 105b89746e
2 changed files with 24 additions and 70 deletions

View File

@ -20,19 +20,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
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){
if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>();
}
List<String> chargingPileId =new ArrayList<>();
@ -132,21 +120,9 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
}
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){
if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>();
}
List<String> chargingPileId =new ArrayList<>();
@ -159,18 +135,7 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@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){
if (getJudge(internetUserId, operatorId, type)){
return new ArrayList<>();
}
return xhpcStatisticsServiceMapper.getStationIntervalPage(stationName,operatorName,internetUserId,operatorId,startTime,endTime,type);
@ -178,34 +143,15 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@Override
public List<Map<String, Object>> getOperatorIntervalPage(String operatorName, Long operatorId, String startTime, String endTime, Long userId, Integer type) {
if(type==null){
if(getJudge(null,operatorId,type)){
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){
if(getJudge(internetUserId,null,type)){
return new ArrayList<>();
}
return xhpcStatisticsServiceMapper.getInternetUserIntervalPage(internetUserName, internetUserId, startTime, endTime, type);
@ -213,22 +159,30 @@ public class XhpcStatisticsServiceImpl implements IXhpcStatisticsService {
@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){
if(getJudge(null,operatorId,type)){
return new ArrayList<>();
}
return xhpcStatisticsServiceMapper.getTerminalIntervalPage(chargingStationName, terminalName, operatorId, startTime, endTime, type);
}
private boolean getJudge(Long internetUserId, Long operatorId, Integer type) {
if (type == null) {
return true;
}
if (type == 2) {
if (operatorId == null) {
return true;
}
} else if (type == 3) {
if (internetUserId == null) {
return true;
}
} else if (type != 1) {
return true;
}
return false;
}
private Map<String, Object> getStatistics(String time){
Map<String, Object> map =new HashMap<>();
map.put("chargingDegree",0.00);

View File

@ -110,7 +110,7 @@
sum(operation_commission) operationCommission,
sum(operation_svc_commission) operationSvcCommission,
DATE_FORMAT(create_time,'%Y-%m-%d') createTime
from xhpc_statistics_data
from xhpc_statistics_station
where del_flag=0 and type=1
<if test="chargingPileIds !=null and chargingPileIds.size()>0">
and charging_pile_id in