|
@@ -5,10 +5,13 @@ import com.persagy.apm.alarmservice.dependency.eqdiagnose.model.MonitorIndicator
|
|
|
import com.persagy.apm.alarmservice.dependency.eqdiagnose.model.QueryMonitorIndicatorRecordDTO;
|
|
|
import com.persagy.apm.common.response.CommonResult;
|
|
|
import com.persagy.apm.common.response.PageList;
|
|
|
+import com.persagy.apm.energyalarmstarter.alarmdata.utils.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -35,7 +38,7 @@ public class EqDiagnoseServiceImpl {
|
|
|
* @version V1.0 2021/5/19 3:36 下午
|
|
|
*/
|
|
|
public Map<Date, String> queryMonitorIndicatorRecord(
|
|
|
- QueryMonitorIndicatorRecordDTO queryMonitorIndicatorRecordDTO) {
|
|
|
+ QueryMonitorIndicatorRecordDTO queryMonitorIndicatorRecordDTO) throws ParseException {
|
|
|
// feign查询
|
|
|
CommonResult<PageList<MonitorIndicatorRecordListItemVO>> pageListCommonResult =
|
|
|
eqDiagnoseClient.queryMonitorIndicatorRecord(queryMonitorIndicatorRecordDTO);
|
|
@@ -52,12 +55,14 @@ public class EqDiagnoseServiceImpl {
|
|
|
if (CollectionUtils.isEmpty(records)) {
|
|
|
return new HashMap<>(0);
|
|
|
}
|
|
|
- return records.stream().filter(record -> record.getDate() != null).collect(
|
|
|
- Collectors.toMap(
|
|
|
- MonitorIndicatorRecordListItemVO::getDate,
|
|
|
- MonitorIndicatorRecordListItemVO::getValue
|
|
|
- )
|
|
|
- );
|
|
|
-
|
|
|
+ Map<Date, String> result = new HashMap<>();
|
|
|
+ SimpleDateFormat ft = new SimpleDateFormat(DateUtils.SDF_SECOND);
|
|
|
+ for (MonitorIndicatorRecordListItemVO record : records) {
|
|
|
+ if(record.getDate() != null){
|
|
|
+ Date date = ft.parse(record.getDate());
|
|
|
+ result.put(date,record.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|