diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java index ad90deb4..a802cabb 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java @@ -224,8 +224,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { int thisTimeValue = entry.getValue(); Map row = new HashMap<>(); row.put("stakeMark", stakeMark); - row.put("thisTimeList", thisTimeValue); - row.put("lastTimeList", lastTimeList.getOrDefault(stakeMark, 0)); + row.put(thisTime, thisTimeValue); + row.put(lastTime, lastTimeList.getOrDefault(stakeMark, 0)); sortedResult.add(row); } // 添加那些只在lastTimeList中的键 @@ -233,8 +233,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { if (!thisTimeList.containsKey(stakeMark)) { Map row = new HashMap<>(); row.put("stakeMark", stakeMark); - row.put("thisTimeList", 0); - row.put("lastTimeList", lastTimeList.get(stakeMark)); + row.put(thisTime, 0); + row.put(lastTime, lastTimeList.get(stakeMark)); sortedResult.add(row); } } @@ -315,8 +315,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { String thisTimeValue = entry.getValue(); Map row = new HashMap<>(); row.put("stakeMark", stakeMark); - row.put("thisTimeList", thisTimeValue); - row.put("lastTimeList", lastTimeList.getOrDefault(stakeMark, "0.00")); + row.put(thisTime, thisTimeValue); + row.put(lastTime, lastTimeList.getOrDefault(stakeMark, "0.00")); sortedResult.add(row); } // 添加那些只在lastTimeList中的键 @@ -324,8 +324,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { if (!thisTimeList.containsKey(stakeMark)) { Map row = new HashMap<>(); row.put("stakeMark", stakeMark); - row.put("thisTimeList", "0.00"); - row.put("lastTimeList", lastTimeList.get(stakeMark)); + row.put(thisTime, "0.00"); + row.put(lastTime, lastTimeList.get(stakeMark)); sortedResult.add(row); } } @@ -377,7 +377,7 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { Integer differenceInMinute = (int)differenceInMinutes; if (averageMap.get(groupKey)==null){ //事件还为存入map - averageMap.putIfAbsent(groupKey, UniversalEnum.ONE.getNumber());//事件类型不存在存1 + averageMap.putIfAbsent(groupKey, differenceInMinute);// }else { Integer currentSum = averageMap.get(groupKey); averageMap.put(groupKey, currentSum +differenceInMinute ); diff --git a/zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml index d59df22a..d46992bd 100644 --- a/zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcSdhsEventMapper.xml @@ -187,8 +187,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT e.event_subclass AS eventSubclass, - IFNULL(t1.num, 0) AS thisTimeList, - IFNULL(t2.num, 0) AS lastTimeList + IFNULL(t1.num, 0) as #{thisTime}, + IFNULL(t2.num, 0) as #{lastTime} FROM `dc_sdhs_event` e LEFT JOIN (SELECT event_subclass, COUNT(*) AS num FROM `dc_sdhs_event`