|
|
|
@ -34,6 +34,7 @@ import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
@ -59,6 +60,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@Slf4j |
|
|
|
|
public class WaterServiceImpl implements IWaterService { |
|
|
|
|
|
|
|
|
|
private final UseService useService; |
|
|
|
@ -257,25 +259,16 @@ public class WaterServiceImpl implements IWaterService {
|
|
|
|
|
List<String> signages = Collections.singletonList(signage); |
|
|
|
|
realData.setSignages(signages); |
|
|
|
|
// 调用fegin接口查询实时数据
|
|
|
|
|
R<List<FieldsData>> R; |
|
|
|
|
try { |
|
|
|
|
R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
throw new RuntimeException(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
R<List<FieldsData>> R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); |
|
|
|
|
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ |
|
|
|
|
return 0.0; |
|
|
|
|
} |
|
|
|
|
// 质量
|
|
|
|
|
if(!R.getData().get(0).getQ().equals(0)){ |
|
|
|
|
return 0.0; |
|
|
|
|
} |
|
|
|
|
// 时间限制
|
|
|
|
|
String time = R.getData().get(0).getTime(); |
|
|
|
|
if(StringUtil.isBlank(time)){ |
|
|
|
|
if(StringUtil.isEmpty(time) || "-".equals(time)){ |
|
|
|
|
return 0.0; |
|
|
|
|
} |
|
|
|
|
Date date = DateUtil.parse(time,DateUtil.DATETIME_FORMAT); |
|
|
|
|
Date date = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss.sss"); |
|
|
|
|
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){ |
|
|
|
|
return 0.0; |
|
|
|
|
} |
|
|
|
@ -548,7 +541,7 @@ public class WaterServiceImpl implements IWaterService {
|
|
|
|
|
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); |
|
|
|
|
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
// 当年用电量
|
|
|
|
|
return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
return analyseDataService.periodTargetFloat(start,end,5,6,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -571,7 +564,7 @@ public class WaterServiceImpl implements IWaterService {
|
|
|
|
|
private float getUsrPowerDay(EminfoAndEmParamVo device) { |
|
|
|
|
String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); |
|
|
|
|
// 当日用电量
|
|
|
|
|
return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",3,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -725,7 +718,7 @@ public class WaterServiceImpl implements IWaterService {
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
|
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION); |
|
|
|
|
if(CollectionUtil.isEmpty(records)){ |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|