| | |
| | | package com.iailab.module.data.point.collection.handler; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueDTO; |
| | |
| | | } |
| | | return CommonConstant.BAD_VALUE; |
| | | } |
| | | log.info("累计值:" + dto.getPointNo()); |
| | | |
| | | // 动态长度 |
| | | ApiPointDTO momentPoint = dataPointApi.getInfoByNo(dto.getMomentPoint()); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(collectTime); |
| | | calendar.add(Calendar.SECOND, -1 * DataPointFreqEnum.getEumByCode(dto.getMinfreqid()).getValue()); |
| | | calendar.add(Calendar.SECOND, -1 * DataPointFreqEnum.getEumByCode(momentPoint.getMinfreqid()).getValue()); |
| | | Date endTime = calendar.getTime(); |
| | | Date startTime = PointCumulateUnitEnum.getStartTime(calendar,dto.getLength(),dto.getCumulateUnit()); |
| | | |
| | | Date startTime = PointCumulateUnitEnum.getStartTime(calendar, dto.getLength(), dto.getCumulateUnit()); |
| | | |
| | | ApiPointValueQueryDTO queryDto = new ApiPointValueQueryDTO(); |
| | | queryDto.setStart(startTime); |
| | | queryDto.setEnd(endTime); |
| | | queryDto.setPointNo(dto.getMomentPoint()); |
| | | |
| | | log.info("queryDto=" + JSONObject.toJSONString(queryDto)); |
| | | List<ApiPointValueDTO> dataList = dataPointApi.queryPointHistoryValue(queryDto); |
| | | if (CollectionUtils.isEmpty(dataList)) { |
| | | log.info("dataList is empty"); |
| | | if (listGood != null) { |
| | | listGood.add(dto.getPointNo()); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } else if (dataList.size() < dto.getLength()) { |
| | | // 补全数据 |
| | | log.info("补全数据,dataList.size()=" + dataList.size()); |
| | | dataList = completionData(dto.getLength(), dataList, startTime, endTime, pointDTO); |
| | | } |
| | | double total = dataList.stream().mapToDouble(ApiPointValueDTO::getV).sum(); |