|
@@ -180,6 +180,60 @@ public class EquipmentOnoffServiceImpl extends ServiceImpl<EquipmentOnoffMapper,
|
|
|
return Result.ok(historyList);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result<List<Map<String, Object>>> getEquipmentHistoryDataDefault(HistoryParamDayDto historyParamDayDto){
|
|
|
+ List<Map<String, Object>> historyList = new ArrayList<>();
|
|
|
+ List<Collectdata> orgDataList = new ArrayList<>();
|
|
|
+ //根据设备id找到设备编号
|
|
|
+ String equipmentcode;
|
|
|
+ try {
|
|
|
+ equipmentcode = (tpmEquipmentService.getById(historyParamDayDto.getEquipmentid())).getEquipmentcode();
|
|
|
+ }catch (NullPointerException e){
|
|
|
+ return Result.error("id为" + historyParamDayDto.getEquipmentid() + "的设备找不到设备编号,无法进行数据查询!");
|
|
|
+ }
|
|
|
+ //根据时间确定要查询哪一天的数据
|
|
|
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
|
|
+ sdf1.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置时区为UTC
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+// String dateStr = historyParamDayDto.getDate();
|
|
|
+ Date date;
|
|
|
+ String dateStr = historyParamDayDto.getDate().replace("\"", "");
|
|
|
+ try {
|
|
|
+ if(dateStr.contains("T")){
|
|
|
+ date = sdf1.parse(dateStr);
|
|
|
+ }else{
|
|
|
+ date = sdf2.parse(dateStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (ParseException e) {
|
|
|
+ return Result.error("日期类型转换失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Calendar dateCal = Calendar.getInstance();
|
|
|
+ dateCal.setTime(date);
|
|
|
+ dateCal.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
+ for(int i=0;i<100;i++){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("BSPEED1", 60);
|
|
|
+ map.put("BSPEED2", 60);
|
|
|
+ map.put("BSPEED3", 60);
|
|
|
+ map.put("BSPEED4", 60);
|
|
|
+ map.put("BPRESS1", 60);
|
|
|
+ map.put("BPRESS2", 60);
|
|
|
+ map.put("BPRESS3", 60);
|
|
|
+ map.put("BPRESS4", 60);
|
|
|
+ map.put("BDIST1", 60);
|
|
|
+ map.put("BDIST2", 60);
|
|
|
+ map.put("BDIST3", 60);
|
|
|
+ map.put("BDIST4", 60);
|
|
|
+ map.put("logtime", dateCal.getTime());
|
|
|
+ dateCal.add(Calendar.SECOND, 15);
|
|
|
+ historyList.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Result.ok(historyList);
|
|
|
+ }
|
|
|
+
|
|
|
//表格展示
|
|
|
public Result<List<Map<String, Object>>> getEquipHistoryDataList(HistoryParamDayDto historyParamDayDto){
|
|
|
List<Map<String, Object>> historyList = new ArrayList<>();
|