|
|
@ -168,7 +168,7 @@ public class DataServiceImpl implements DataService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Map<String, String>> lastFirstBySignage(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signage) { |
|
|
|
public List<Map<String, String>> lastFirstBySignage(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signage) { |
|
|
|
ReductionDataDTO reduction = new ReductionDataDTO(); |
|
|
|
ReductionDataDTO reduction = new ReductionDataDTO(); |
|
|
|
reduction.setFull(1); |
|
|
|
reduction.setFull(0); |
|
|
|
reduction.setDeviceCode(deviceCode); |
|
|
|
reduction.setDeviceCode(deviceCode); |
|
|
|
reduction.setSaveTimeType(cycleType); |
|
|
|
reduction.setSaveTimeType(cycleType); |
|
|
|
reduction.setTimeInterval(1); |
|
|
|
reduction.setTimeInterval(1); |
|
|
@ -201,6 +201,57 @@ public class DataServiceImpl implements DataService { |
|
|
|
* @param cycleType 间隔周期 : 0-> 秒 1-> 分 2-> 小时 3->天 4-> 周 5-> 月 6-> 年 |
|
|
|
* @param cycleType 间隔周期 : 0-> 秒 1-> 分 2-> 小时 3->天 4-> 周 5-> 月 6-> 年 |
|
|
|
* @param deviceCode 设备编号 |
|
|
|
* @param deviceCode 设备编号 |
|
|
|
* @param ride 配电比 |
|
|
|
* @param ride 配电比 |
|
|
|
|
|
|
|
* @param signage 指标 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Float lastFirstByFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Double ride,String signage) { |
|
|
|
|
|
|
|
ReductionDataDTO reduction = new ReductionDataDTO(); |
|
|
|
|
|
|
|
reduction.setFull(0); |
|
|
|
|
|
|
|
reduction.setDeviceCode(deviceCode); |
|
|
|
|
|
|
|
reduction.setSaveTimeType(cycleType); |
|
|
|
|
|
|
|
reduction.setTimeInterval(1); |
|
|
|
|
|
|
|
reduction.setNeedPage(false); |
|
|
|
|
|
|
|
reduction.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); |
|
|
|
|
|
|
|
reduction.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME))); |
|
|
|
|
|
|
|
// 属性列表
|
|
|
|
|
|
|
|
List<ReductionAttrDataDTO> atts = new ArrayList<>(); |
|
|
|
|
|
|
|
ReductionAttrDataDTO attr = new ReductionAttrDataDTO(); |
|
|
|
|
|
|
|
attr.setAccessRules(accessRules); |
|
|
|
|
|
|
|
attr.setKeepFigures(4); |
|
|
|
|
|
|
|
attr.setSignage(signage); |
|
|
|
|
|
|
|
atts.add(attr); |
|
|
|
|
|
|
|
reduction.setDtos(atts); |
|
|
|
|
|
|
|
Result<ReductionDataVO> result = deviceDataClient.pageDeviceCodeAndSignages(reduction); |
|
|
|
|
|
|
|
if (!result.isSuccess() || ObjectUtil.isEmpty(result.getData())) { |
|
|
|
|
|
|
|
return 0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(MapUtils.isEmpty(result.getData().getFieldMap()) || CollectionUtil.isEmpty(result.getData().getDataList())){ |
|
|
|
|
|
|
|
return 0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Map<String, String>> dataList = result.getData().getDataList(); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(dataList)) { |
|
|
|
|
|
|
|
return 0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<String, String> data = dataList.get(0); |
|
|
|
|
|
|
|
if(MapUtils.isEmpty(data)){ |
|
|
|
|
|
|
|
return 0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String val = data.get(signage); |
|
|
|
|
|
|
|
if(StringUtil.isEmpty(val)){ |
|
|
|
|
|
|
|
return 0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Float.parseFloat(String.valueOf(Double.parseDouble(val) * ride)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
|
|
|
* 指标数据列表查询 |
|
|
|
|
|
|
|
* @param startTime 开始时间 |
|
|
|
|
|
|
|
* @param endTime 结束时间 |
|
|
|
|
|
|
|
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值 |
|
|
|
|
|
|
|
* @param cycleType 间隔周期 : 0-> 秒 1-> 分 2-> 小时 3->天 4-> 周 5-> 月 6-> 年 |
|
|
|
|
|
|
|
* @param deviceCode 设备编号 |
|
|
|
|
|
|
|
* @param ride 配电比 |
|
|
|
* @param signages 指标 |
|
|
|
* @param signages 指标 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|