ai预警修改
This commit is contained in:
parent
bf52d51843
commit
bfe81b74a4
@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -75,9 +76,10 @@ public class SectorVo {
|
|||||||
*
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* @param dictionaryItems
|
* @param dictionaryItems
|
||||||
|
* @param sorted 是否倒序
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static SectorVo getSectorVoByDict(List<SectorOneVo> list, List<DictionaryItem> dictionaryItems) {
|
public static SectorVo getSectorVoByDict(List<SectorOneVo> list, List<DictionaryItem> dictionaryItems, Boolean sorted) {
|
||||||
SectorVo vo = new SectorVo();
|
SectorVo vo = new SectorVo();
|
||||||
List<SectorOneVo> rtList = new ArrayList<>();
|
List<SectorOneVo> rtList = new ArrayList<>();
|
||||||
Map<Integer, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEnumType, Function.identity()));
|
Map<Integer, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEnumType, Function.identity()));
|
||||||
@ -91,12 +93,19 @@ public class SectorVo {
|
|||||||
vo1.setEnumType(Integer.valueOf(type.getData()));
|
vo1.setEnumType(Integer.valueOf(type.getData()));
|
||||||
rtList.add(vo1);
|
rtList.add(vo1);
|
||||||
}
|
}
|
||||||
|
if (Objects.equals(sorted, true)) {
|
||||||
|
rtList = rtList.stream().sorted((o1, o2) -> Integer.valueOf(o2.getCount()).compareTo(Integer.valueOf(o1.getCount()))).collect(Collectors.toList());
|
||||||
|
}
|
||||||
vo.setData(rtList);
|
vo.setData(rtList);
|
||||||
vo.setCount(String.valueOf(rtList.stream().map(o -> Integer.parseInt(o.getCount())).mapToInt(value -> value).sum()));
|
vo.setCount(String.valueOf(rtList.stream().map(o -> Integer.parseInt(o.getCount())).mapToInt(value -> value).sum()));
|
||||||
calPercent(vo);
|
calPercent(vo);
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SectorVo getSectorVoByDict(List<SectorOneVo> list, List<DictionaryItem> dictionaryItems) {
|
||||||
|
return getSectorVoByDict(list, dictionaryItems, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算总count
|
* 计算总count
|
||||||
*
|
*
|
||||||
|
|||||||
@ -126,6 +126,7 @@
|
|||||||
</include>
|
</include>
|
||||||
where di.dictionary_encoding = 'ai_analyse_hard_ware_alarm_record_type'
|
where di.dictionary_encoding = 'ai_analyse_hard_ware_alarm_record_type'
|
||||||
group by di.data
|
group by di.data
|
||||||
|
order by count desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectAiAnalyseHardWareAlarmTypeCount" resultType="java.util.Map" parameterType="java.util.Map">
|
<select id="selectAiAnalyseHardWareAlarmTypeCount" resultType="java.util.Map" parameterType="java.util.Map">
|
||||||
SELECT w1.alarm_type alarmType,
|
SELECT w1.alarm_type alarmType,
|
||||||
|
|||||||
@ -193,7 +193,7 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
|
|||||||
@Override
|
@Override
|
||||||
public SectorVo getAiAnalyseHardWareAlarmTotal(Map<String, Object> map) {
|
public SectorVo getAiAnalyseHardWareAlarmTotal(Map<String, Object> map) {
|
||||||
List<SectorOneVo> list = aiAnalyseHardWareAlarmRecordMapper.getAiAnalyseHardWareAlarmTotal(map);
|
List<SectorOneVo> list = aiAnalyseHardWareAlarmRecordMapper.getAiAnalyseHardWareAlarmTotal(map);
|
||||||
return SectorVo.getSectorVoByDict(list, dictionaryItemService.getDictList(DictConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE));
|
return SectorVo.getSectorVoByDict(list, dictionaryItemService.getDictList(DictConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user