|
@@ -7,17 +7,23 @@ import com.hssx.cloudmodel.entity.vo.MouldHistoryVO;
|
|
|
import com.hssx.cloudmodel.mapper.*;
|
|
|
import com.hssx.cloudmodel.service.MouldHistoryService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.hssx.cloudmodel.util.ExcelUtil;
|
|
|
import com.hssx.cloudmodel.util.HttpRespMsg;
|
|
|
import com.hssx.cloudmodel.util.TimeAndCountUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author 吴涛涛
|
|
@@ -37,210 +43,179 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
|
|
|
private MouldEquipmentMapper mouldEquipmentMapper;
|
|
|
@Resource
|
|
|
private InjectionMoldingMapper injectionMoldingMapper;
|
|
|
+ @Value("${upload.path}")
|
|
|
+ private String downloadPath;
|
|
|
+
|
|
|
@Override
|
|
|
- public HttpRespMsg getOpeningAndClosingTimesChart(String equipmentNo, String time) {
|
|
|
+ public HttpRespMsg getOpeningAndClosingTimesChart(HttpServletResponse response, String equipmentNo, String startTime, String endTime, Integer type) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- 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();
|
|
|
-// Integer count = 0;
|
|
|
-// Map<String, List<MouldHistoryVO>> mapList = list.stream().collect(Collectors.groupingBy(MouldHistoryVO::getTime));
|
|
|
-// for(Map.Entry<String, List<MouldHistoryVO>> entry:mapList.entrySet()){
|
|
|
-// if("00".equals(entry.getKey())){
|
|
|
-// map.put("00:00-01:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("01".equals(entry.getKey())){
|
|
|
-// map.put("01:00-02:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("02".equals(entry.getKey())){
|
|
|
-// map.put("02:00-03:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("03".equals(entry.getKey())){
|
|
|
-// map.put("03:00-04:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("04".equals(entry.getKey())){
|
|
|
-// map.put("04:00-05:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("05".equals(entry.getKey())){
|
|
|
-// map.put("05:00-06:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("06".equals(entry.getKey())){
|
|
|
-// map.put("06:00-07:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("07".equals(entry.getKey())){
|
|
|
-// map.put("07:00-08:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("08".equals(entry.getKey())){
|
|
|
-// map.put("08:00-09:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("09".equals(entry.getKey())){
|
|
|
-// map.put("09:00-10:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("10".equals(entry.getKey())){
|
|
|
-// map.put("10:00-11:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("11".equals(entry.getKey())){
|
|
|
-// map.put("11:00-12:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("12".equals(entry.getKey())){
|
|
|
-// map.put("12:00-13:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("13".equals(entry.getKey())){
|
|
|
-// map.put("13:00-14:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("14".equals(entry.getKey())){
|
|
|
-// map.put("14:00-15:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("15".equals(entry.getKey())){
|
|
|
-// map.put("15:00-16:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("16".equals(entry.getKey())){
|
|
|
-// map.put("16:00-17:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("17".equals(entry.getKey())){
|
|
|
-// map.put("17:00-18:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("18".equals(entry.getKey())){
|
|
|
-// map.put("18:00-19:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("19".equals(entry.getKey())){
|
|
|
-// map.put("19:00-20:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("20".equals(entry.getKey())){
|
|
|
-// map.put("20:00-21:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("21".equals(entry.getKey())){
|
|
|
-// map.put("21:00-22:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("22".equals(entry.getKey())){
|
|
|
-// map.put("22:00-23:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }else if("23".equals(entry.getKey())){
|
|
|
-// map.put("23:00-24:00",entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt()
|
|
|
-// - entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// System.out.println("原来的map===>"+map);
|
|
|
-// Map<String, Integer> result = map.entrySet().stream()
|
|
|
-// .sorted(Map.Entry.comparingByKey())
|
|
|
-// .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;
|
|
|
+ if (type != null) {
|
|
|
+ if (type == 0) {
|
|
|
+ List<MouldCycleRuntime> cycleRuntimeList = mouldCycleRuntimeMapper.selectList(new QueryWrapper<MouldCycleRuntime>()
|
|
|
+ .eq("equipment_no", equipmentNo).between("date_str", startTime, endTime));
|
|
|
+ //给集合排序先按照日期,如果一样再按照时间段
|
|
|
+ cycleRuntimeList = cycleRuntimeList.stream().sorted(Comparator.comparing(MouldCycleRuntime::getDateStr).thenComparing(MouldCycleRuntime::getTimeSlot)).collect(Collectors.toList());
|
|
|
+ //数据已经查到,开始导出excel
|
|
|
+ List<List<String>> list = new ArrayList<List<String>>();
|
|
|
+ //标题
|
|
|
+ List<String> titleList = new ArrayList<String>();
|
|
|
+ titleList.add("设备编号");
|
|
|
+ titleList.add("日期");
|
|
|
+ titleList.add("时间段");
|
|
|
+ titleList.add("运行次数");
|
|
|
+ list.add(titleList);
|
|
|
+ SimpleDateFormat dateSdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat dateSdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat dateSdf2 = new SimpleDateFormat("yyyy年MM月dd+HH时mm分ss秒");
|
|
|
+ List<MouldOperationDynamics> mouldOperationDynamics = new ArrayList<>();
|
|
|
+ for (MouldCycleRuntime cycleRuntime : cycleRuntimeList) {
|
|
|
+ List<String> rowList = new ArrayList<String>();
|
|
|
+ //设备编号
|
|
|
+ rowList.add(cycleRuntime.getEquipmentNo());
|
|
|
+ //日期
|
|
|
+ rowList.add(cycleRuntime.getDateStr());
|
|
|
+ //时间段
|
|
|
+ rowList.add(cycleRuntime.getTimeSlot());
|
|
|
+ //运行次数
|
|
|
+ rowList.add(cycleRuntime.getRuntime() + "");
|
|
|
+// rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(dynamic.getIndate())
|
|
|
+ list.add(rowList);
|
|
|
+ }
|
|
|
+ String fileUrl = ExcelUtil.exportGeneralExcelByTitleAndList(response, equipmentNo + "-周期运行次数" + dateSdf2.format(new Date()), list, downloadPath);
|
|
|
+ msg.data = fileUrl;
|
|
|
+ }else if(type == 1){
|
|
|
+ List<MouldHistoryTime> mouldHistoryTimeList = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycleExcel(startTime, endTime, equipmentNo);
|
|
|
+ //数据已经查到,开始导出excel
|
|
|
+ List<List<String>> list = new ArrayList<List<String>>();
|
|
|
+ //标题
|
|
|
+ List<String> titleList = new ArrayList<String>();
|
|
|
+ titleList.add("设备编号");
|
|
|
+ titleList.add("开合次数");
|
|
|
+ titleList.add("合模时间");
|
|
|
+ titleList.add("开模时间");
|
|
|
+ titleList.add("开模周期");
|
|
|
+ list.add(titleList);
|
|
|
+ SimpleDateFormat dateSdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ SimpleDateFormat dateSdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat dateSdf2 = new SimpleDateFormat("yyyy年MM月dd+HH时mm分ss秒");
|
|
|
+ List<MouldOperationDynamics> mouldOperationDynamics = new ArrayList<>();
|
|
|
+ for (MouldHistoryTime mouldHistoryTime : mouldHistoryTimeList) {
|
|
|
+ List<String> rowList = new ArrayList<String>();
|
|
|
+ //设备编号
|
|
|
+ rowList.add(mouldHistoryTime.getEquipmentNo());
|
|
|
+ //开合次数
|
|
|
+ rowList.add(mouldHistoryTime.getSeq()+"");
|
|
|
+ //合模时间
|
|
|
+ rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(mouldHistoryTime.getCloseTime()));
|
|
|
+ //开模时间
|
|
|
+ rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(mouldHistoryTime.getOpenTime()));
|
|
|
+// rowList.add(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(dynamic.getIndate())
|
|
|
+ //开模周期
|
|
|
+ rowList.add(mouldHistoryTime.getTimeCost()+"");
|
|
|
+ list.add(rowList);
|
|
|
+ }
|
|
|
+ String fileUrl = ExcelUtil.exportGeneralExcelByTitleAndList(response, equipmentNo + "-开合数据" + dateSdf2.format(new Date()), list, downloadPath);
|
|
|
+ msg.data = fileUrl;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg openingAndClosingTimesChartCycle(String equipmentNo,String time) {
|
|
|
+ public HttpRespMsg openingAndClosingTimesChartCycle(String equipmentNo, String time) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ Map<String, Object> listMap = new HashMap<>();
|
|
|
MouldEquipment mouldEquipment = mouldEquipmentMapper.selectOne(new QueryWrapper<MouldEquipment>().eq("equipment_no", equipmentNo));
|
|
|
Mould mould = mouldMapper.selectOne(new QueryWrapper<Mould>().eq("equipment_id", mouldEquipment.getId()));
|
|
|
InjectionMolding molding = injectionMoldingMapper.selectOne(new QueryWrapper<InjectionMolding>().eq("mould_id", mould.getId()));
|
|
|
Integer cycle = 0;
|
|
|
- if(molding != null){
|
|
|
- cycle = (null == molding.getCycle())?40000:Integer.parseInt(molding.getCycle());
|
|
|
- }else{
|
|
|
- cycle = 40000;
|
|
|
+ if (molding != null) {
|
|
|
+ cycle = (null == molding.getCycle()) ? 40000 : Integer.parseInt(molding.getCycle());
|
|
|
+ } else {
|
|
|
+ cycle = 40000;
|
|
|
}
|
|
|
- Integer maxCycle = cycle+10000;
|
|
|
- Integer minCycle = cycle-10000;
|
|
|
- Map<String,MouldHistoryTimeVO> map = TimeAndCountUtil.getMap();
|
|
|
- List<MouldHistoryVO> list = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycle(time,equipmentNo,maxCycle,minCycle);
|
|
|
+ Integer maxCycle = cycle + 10000;
|
|
|
+ Integer minCycle = cycle - 10000;
|
|
|
+ Map<String, MouldHistoryTimeVO> map = TimeAndCountUtil.getMap();
|
|
|
+ List<MouldHistoryVO> list = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycle(time, equipmentNo, maxCycle, minCycle);
|
|
|
Integer count = 0;
|
|
|
Map<String, List<MouldHistoryVO>> mapList = list.stream().collect(Collectors.groupingBy(MouldHistoryVO::getTime));
|
|
|
- for(Map.Entry<String, List<MouldHistoryVO>> entry:mapList.entrySet()){
|
|
|
+ for (Map.Entry<String, List<MouldHistoryVO>> entry : mapList.entrySet()) {
|
|
|
MouldHistoryTimeVO vo = new MouldHistoryTimeVO();
|
|
|
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.setAvgCycle((int) entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
|
|
|
vo.setTheoryCycle(cycle);
|
|
|
- if("00".equals(entry.getKey())){
|
|
|
- map.put("00:00-01:00",vo);
|
|
|
- }else if("01".equals(entry.getKey())){
|
|
|
- map.put("01:00-02:00",vo);
|
|
|
- }else if("02".equals(entry.getKey())){
|
|
|
- map.put("02:00-03:00",vo);
|
|
|
- }else if("03".equals(entry.getKey())){
|
|
|
- map.put("03:00-04:00",vo);
|
|
|
- }else if("04".equals(entry.getKey())){
|
|
|
- map.put("04:00-05:00",vo);
|
|
|
- }else if("05".equals(entry.getKey())){
|
|
|
- map.put("05:00-06:00",vo);
|
|
|
- }else if("06".equals(entry.getKey())){
|
|
|
- map.put("06:00-07:00",vo);
|
|
|
- }else if("07".equals(entry.getKey())){
|
|
|
- map.put("07:00-08:00",vo);
|
|
|
- }else if("08".equals(entry.getKey())){
|
|
|
- map.put("08:00-09:00",vo);
|
|
|
- }else if("09".equals(entry.getKey())){
|
|
|
- map.put("09:00-10:00",vo);
|
|
|
- }else if("10".equals(entry.getKey())){
|
|
|
- map.put("10:00-11:00",vo);
|
|
|
- }else if("11".equals(entry.getKey())){
|
|
|
- map.put("11:00-12:00",vo);
|
|
|
- }else if("12".equals(entry.getKey())){
|
|
|
- map.put("12:00-13:00",vo);
|
|
|
- }else if("13".equals(entry.getKey())){
|
|
|
- map.put("13:00-14:00",vo);
|
|
|
- }else if("14".equals(entry.getKey())){
|
|
|
- map.put("14:00-15:00",vo);
|
|
|
- }else if("15".equals(entry.getKey())){
|
|
|
- map.put("15:00-16:00",vo);
|
|
|
- }else if("16".equals(entry.getKey())){
|
|
|
- map.put("16:00-17:00",vo);
|
|
|
- }else if("17".equals(entry.getKey())){
|
|
|
- map.put("17:00-18:00",vo);
|
|
|
- }else if("18".equals(entry.getKey())){
|
|
|
- map.put("18:00-19:00",vo);
|
|
|
- }else if("19".equals(entry.getKey())){
|
|
|
- map.put("19:00-20:00",vo);
|
|
|
- }else if("20".equals(entry.getKey())){
|
|
|
- map.put("20:00-21:00",vo);
|
|
|
- }else if("21".equals(entry.getKey())){
|
|
|
- map.put("21:00-22:00",vo);
|
|
|
- }else if("22".equals(entry.getKey())){
|
|
|
- map.put("22:00-23:00",vo);
|
|
|
- }else if("23".equals(entry.getKey())){
|
|
|
- map.put("23:00-24:00",vo);
|
|
|
+ if ("00".equals(entry.getKey())) {
|
|
|
+ map.put("00:00-01:00", vo);
|
|
|
+ } else if ("01".equals(entry.getKey())) {
|
|
|
+ map.put("01:00-02:00", vo);
|
|
|
+ } else if ("02".equals(entry.getKey())) {
|
|
|
+ map.put("02:00-03:00", vo);
|
|
|
+ } else if ("03".equals(entry.getKey())) {
|
|
|
+ map.put("03:00-04:00", vo);
|
|
|
+ } else if ("04".equals(entry.getKey())) {
|
|
|
+ map.put("04:00-05:00", vo);
|
|
|
+ } else if ("05".equals(entry.getKey())) {
|
|
|
+ map.put("05:00-06:00", vo);
|
|
|
+ } else if ("06".equals(entry.getKey())) {
|
|
|
+ map.put("06:00-07:00", vo);
|
|
|
+ } else if ("07".equals(entry.getKey())) {
|
|
|
+ map.put("07:00-08:00", vo);
|
|
|
+ } else if ("08".equals(entry.getKey())) {
|
|
|
+ map.put("08:00-09:00", vo);
|
|
|
+ } else if ("09".equals(entry.getKey())) {
|
|
|
+ map.put("09:00-10:00", vo);
|
|
|
+ } else if ("10".equals(entry.getKey())) {
|
|
|
+ map.put("10:00-11:00", vo);
|
|
|
+ } else if ("11".equals(entry.getKey())) {
|
|
|
+ map.put("11:00-12:00", vo);
|
|
|
+ } else if ("12".equals(entry.getKey())) {
|
|
|
+ map.put("12:00-13:00", vo);
|
|
|
+ } else if ("13".equals(entry.getKey())) {
|
|
|
+ map.put("13:00-14:00", vo);
|
|
|
+ } else if ("14".equals(entry.getKey())) {
|
|
|
+ map.put("14:00-15:00", vo);
|
|
|
+ } else if ("15".equals(entry.getKey())) {
|
|
|
+ map.put("15:00-16:00", vo);
|
|
|
+ } else if ("16".equals(entry.getKey())) {
|
|
|
+ map.put("16:00-17:00", vo);
|
|
|
+ } else if ("17".equals(entry.getKey())) {
|
|
|
+ map.put("17:00-18:00", vo);
|
|
|
+ } else if ("18".equals(entry.getKey())) {
|
|
|
+ map.put("18:00-19:00", vo);
|
|
|
+ } else if ("19".equals(entry.getKey())) {
|
|
|
+ map.put("19:00-20:00", vo);
|
|
|
+ } else if ("20".equals(entry.getKey())) {
|
|
|
+ map.put("20:00-21:00", vo);
|
|
|
+ } else if ("21".equals(entry.getKey())) {
|
|
|
+ map.put("21:00-22:00", vo);
|
|
|
+ } else if ("22".equals(entry.getKey())) {
|
|
|
+ map.put("22:00-23:00", vo);
|
|
|
+ } else if ("23".equals(entry.getKey())) {
|
|
|
+ map.put("23:00-24:00", vo);
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("原来的map===>"+map);
|
|
|
+ System.out.println("原来的map===>" + map);
|
|
|
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));
|
|
|
- System.out.println("排序后的map===>"+result);
|
|
|
+ System.out.println("排序后的map===>" + result);
|
|
|
+ listMap.put("cycle", result);
|
|
|
//模具运行次数
|
|
|
- List<MouldCycleRuntime> cycleRuntime = mouldCycleRuntimeMapper.selectList(new QueryWrapper<MouldCycleRuntime>().eq("equipment_no", equipmentNo).eq("date_str",time));
|
|
|
- cycleRuntime = list.stream().sorted(Comparator.comparing(MouldCycleRuntime::getTimeSlot)).collect(Collectors.toList());
|
|
|
-// mouldHistoryTimeVO.setStartTime(mouldHistoryTimeVO.getStartTime()+" 00:00:00");
|
|
|
-// mouldHistoryTimeVO.setEndTime(mouldHistoryTimeVO.getEndTime()+" 23:59:59");
|
|
|
-// List<MouldHistoryTimeVO> list = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycle(mouldHistoryTimeVO.getStartTime(),mouldHistoryTimeVO.getEndTime(),mouldHistoryTimeVO.getEquipmentNo());
|
|
|
-// Map<String, List<MouldHistoryTimeVO>> map = list.stream().collect(Collectors.groupingBy(MouldHistoryTimeVO::getTime));
|
|
|
-// List<MouldHistoryTimeVO> resultList = new ArrayList<>();
|
|
|
-// for(Map.Entry<String, List<MouldHistoryTimeVO>> entry : map.entrySet()){
|
|
|
-// String mapKey = entry.getKey();
|
|
|
-// MouldHistoryTimeVO vo = new MouldHistoryTimeVO();
|
|
|
-// vo.setTime(mapKey);
|
|
|
-// List<MouldHistoryTimeVO> mapValue = entry.getValue();
|
|
|
-// vo.setMinCycle(mapValue.stream().mapToInt(MouldHistoryTimeVO::getTimeCost).min().getAsInt());
|
|
|
-// vo.setMinCycle(mapValue.stream().mapToInt(MouldHistoryTimeVO::getTimeCost).max().getAsInt());
|
|
|
-// vo.setAvgCycle(0.1*(mapValue.stream().mapToInt(MouldHistoryTimeVO::getTimeCost).sum()/(mapValue.size()-1)));
|
|
|
-// resultList.add(vo);
|
|
|
-// }
|
|
|
-// System.out.println("原来的resultList===>"+resultList);
|
|
|
-// resultList = resultList.stream().sorted(Comparator.comparing(MouldHistoryTimeVO::getTime)).collect(Collectors.toList());
|
|
|
-// System.out.println("排序后的resultList===>"+resultList);
|
|
|
-// msg.data = resultList;
|
|
|
- msg.data = result;
|
|
|
+ List<MouldCycleRuntime> cycleRuntime = mouldCycleRuntimeMapper.selectList(new QueryWrapper<MouldCycleRuntime>().eq("equipment_no", equipmentNo).eq("date_str", time));
|
|
|
+ cycleRuntime = cycleRuntime.stream().sorted(Comparator.comparing(MouldCycleRuntime::getTimeSlot)).collect(Collectors.toList());
|
|
|
+ listMap.put("runtime", cycleRuntime);
|
|
|
+ msg.data = map;
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- List<Integer> primes = Arrays.asList(1,2,5,6,7,3,4,8,9,10);
|
|
|
- primes = primes.stream().sorted(Comparator.comparing(x -> x)).collect(Collectors.toList());
|
|
|
+ List<Integer> primes = Arrays.asList(1, 2, 5, 6, 7, 3, 4, 8, 9, 10);
|
|
|
+ primes = primes.stream().sorted(Comparator.comparing(x -> x)).collect(Collectors.toList());
|
|
|
System.out.println(primes);
|
|
|
}
|
|
|
}
|