|
@@ -41,7 +41,7 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
|
|
|
List<MouldCycleRuntime> list = mouldCycleRuntimeMapper.selectList(new QueryWrapper<MouldCycleRuntime>().eq("equipment_no", equipmentNo).eq("date_str",time));
|
|
|
// List<MouldHistoryVO> list = mouldHistoryMapper.selectOpeningAndClosingTimesChart(equipmentNo,time);
|
|
|
// Set<MouldHistoryVO> set = TimeAndCountUtil.getSet();
|
|
|
- Map<String, Integer> map = TimeAndCountUtil.getMap();
|
|
|
+// Map<String, Integer> map = TimeAndCountUtil.getMap();
|
|
|
// Integer count = 0;
|
|
|
// Map<String, List<MouldHistoryVO>> mapList = list.stream().collect(Collectors.groupingBy(MouldHistoryVO::getTime));
|
|
|
// for(Map.Entry<String, List<MouldHistoryVO>> entry:mapList.entrySet()){
|
|
@@ -125,6 +125,7 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
|
|
|
// .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
// (oleValue, newValue) -> oleValue, LinkedHashMap::new));
|
|
|
// System.out.println("排序后的map===>"+result);
|
|
|
+ list = list.stream().sorted(Comparator.comparing(MouldCycleRuntime::getTimeSlot)).collect(Collectors.toList());
|
|
|
msg.data=list;
|
|
|
return msg;
|
|
|
}
|
|
@@ -132,64 +133,68 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
|
|
|
@Override
|
|
|
public HttpRespMsg openingAndClosingTimesChartCycle(String equipmentNo,String time) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- Map<String, Integer> map = TimeAndCountUtil.getMap();
|
|
|
- List<MouldHistoryVO> list = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycle(equipmentNo,time);
|
|
|
+ Map<String,MouldHistoryTimeVO> map = TimeAndCountUtil.getMap();
|
|
|
+ List<MouldHistoryVO> list = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycle(time,equipmentNo);
|
|
|
Integer count = 0;
|
|
|
Map<String, List<MouldHistoryVO>> mapList = list.stream().collect(Collectors.groupingBy(MouldHistoryVO::getTime));
|
|
|
+ MouldHistoryTimeVO vo = new MouldHistoryTimeVO();
|
|
|
for(Map.Entry<String, List<MouldHistoryVO>> entry:mapList.entrySet()){
|
|
|
+ vo.setMinCycle(entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
+ vo.setMaxCycle(entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt());
|
|
|
+ vo.setAvgCycle((int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ vo.setTheoryCycle(40000);
|
|
|
if("00".equals(entry.getKey())){
|
|
|
- map.put("00:00-01:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble()
|
|
|
- );
|
|
|
+ map.put("00:00-01:00",vo);
|
|
|
}else if("01".equals(entry.getKey())){
|
|
|
- map.put("01:00-02:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("01:00-02:00",vo);
|
|
|
}else if("02".equals(entry.getKey())){
|
|
|
- map.put("02:00-03:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("02:00-03:00",vo);
|
|
|
}else if("03".equals(entry.getKey())){
|
|
|
- map.put("03:00-04:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("03:00-04:00",vo);
|
|
|
}else if("04".equals(entry.getKey())){
|
|
|
- map.put("04:00-05:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("04:00-05:00",vo);
|
|
|
}else if("05".equals(entry.getKey())){
|
|
|
- map.put("05:00-06:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("05:00-06:00",vo);
|
|
|
}else if("06".equals(entry.getKey())){
|
|
|
- map.put("06:00-07:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("06:00-07:00",vo);
|
|
|
}else if("07".equals(entry.getKey())){
|
|
|
- map.put("07:00-08:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("07:00-08:00",vo);
|
|
|
}else if("08".equals(entry.getKey())){
|
|
|
- map.put("08:00-09:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("08:00-09:00",vo);
|
|
|
}else if("09".equals(entry.getKey())){
|
|
|
- map.put("09:00-10:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("09:00-10:00",vo);
|
|
|
}else if("10".equals(entry.getKey())){
|
|
|
- map.put("10:00-11:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("10:00-11:00",vo);
|
|
|
}else if("11".equals(entry.getKey())){
|
|
|
- map.put("11:00-12:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("11:00-12:00",vo);
|
|
|
}else if("12".equals(entry.getKey())){
|
|
|
- map.put("12:00-13:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("12:00-13:00",vo);
|
|
|
}else if("13".equals(entry.getKey())){
|
|
|
- map.put("13:00-14:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("13:00-14:00",vo);
|
|
|
}else if("14".equals(entry.getKey())){
|
|
|
- map.put("14:00-15:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("14:00-15:00",vo);
|
|
|
}else if("15".equals(entry.getKey())){
|
|
|
- map.put("15:00-16:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("15:00-16:00",vo);
|
|
|
}else if("16".equals(entry.getKey())){
|
|
|
- map.put("16:00-17:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("16:00-17:00",vo);
|
|
|
}else if("17".equals(entry.getKey())){
|
|
|
- map.put("17:00-18:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("17:00-18:00",vo);
|
|
|
}else if("18".equals(entry.getKey())){
|
|
|
- map.put("18:00-19:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("18:00-19:00",vo);
|
|
|
}else if("19".equals(entry.getKey())){
|
|
|
- map.put("19:00-20:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("19:00-20:00",vo);
|
|
|
}else if("20".equals(entry.getKey())){
|
|
|
- map.put("20:00-21:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("20:00-21:00",vo);
|
|
|
}else if("21".equals(entry.getKey())){
|
|
|
- map.put("21:00-22:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("21:00-22:00",vo);
|
|
|
}else if("22".equals(entry.getKey())){
|
|
|
- map.put("22:00-23:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("22:00-23:00",vo);
|
|
|
}else if("23".equals(entry.getKey())){
|
|
|
- map.put("23:00-24:00",(int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
+ map.put("23:00-24:00",vo);
|
|
|
}
|
|
|
}
|
|
|
System.out.println("原来的map===>"+map);
|
|
|
- Map<String, Integer> result = map.entrySet().stream()
|
|
|
+ Map<String, MouldHistoryTimeVO> result = map.entrySet().stream()
|
|
|
.sorted(Map.Entry.comparingByKey())
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
|
|
(oleValue, newValue) -> oleValue, LinkedHashMap::new));
|