|
|
@ -17,6 +17,7 @@ import com.thing.thing.entity.dto.IotThingEntityDTO; |
|
|
import com.thing.thing.entity.service.IotThingEntityService; |
|
|
import com.thing.thing.entity.service.IotThingEntityService; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
@ -120,15 +121,31 @@ public class StationScreenServiceImpl implements StationScreenService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public StationMonthUsageAnalysis getMonthUsageAnalysis(String thingCode) { |
|
|
|
|
|
|
|
|
public StationMonthUsageAnalysis getMonthUsageAnalysis(String thingCode,String dateType) { |
|
|
Integer gunCount = |
|
|
Integer gunCount = |
|
|
connectorInfoService.getCountByStationIds(Collections.singletonList(thingCode)); |
|
|
connectorInfoService.getCountByStationIds(Collections.singletonList(thingCode)); |
|
|
|
|
|
String code = "A201mm"; |
|
|
|
|
|
Long startTs = DateTimeUtils.monthStartTs(); |
|
|
|
|
|
Long endTs = DateTimeUtils.monthStartTs(); |
|
|
|
|
|
if(StringUtils.equals(dateType,"yy")){ |
|
|
|
|
|
startTs = DateTimeUtils.yearStartTs(); |
|
|
|
|
|
endTs = DateTimeUtils.yearEndTs(); |
|
|
|
|
|
} else if (StringUtils.equals(dateType,"mm")) { |
|
|
|
|
|
startTs = DateTimeUtils.monthStartTs(); |
|
|
|
|
|
endTs = DateTimeUtils.monthEndTs(); |
|
|
|
|
|
code= "A201dd"; |
|
|
|
|
|
}else{ |
|
|
|
|
|
startTs = DateTimeUtils.todayStartTs(); |
|
|
|
|
|
endTs = DateTimeUtils.yearEndTs(); |
|
|
|
|
|
code= "A201hh"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<TsKvDTO> tskvList = |
|
|
List<TsKvDTO> tskvList = |
|
|
tsKvService.findTsKvByCodeAndAttr( |
|
|
tsKvService.findTsKvByCodeAndAttr( |
|
|
thingCode, |
|
|
thingCode, |
|
|
StationChargeStatus.DAILY_DURATION_CODE, |
|
|
|
|
|
DateTimeUtils.monthStartTs(), |
|
|
|
|
|
DateTimeUtils.todayStartTs(), |
|
|
|
|
|
|
|
|
code, |
|
|
|
|
|
startTs, |
|
|
|
|
|
endTs, |
|
|
true); |
|
|
true); |
|
|
return StationMonthUsageAnalysis.assemble(tskvList, gunCount); |
|
|
return StationMonthUsageAnalysis.assemble(tskvList, gunCount); |
|
|
} |
|
|
} |
|
|
|