暂降模块调整
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
@@ -940,37 +941,28 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
|
||||
);
|
||||
|
||||
HttpResult<List<DictData>> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName());
|
||||
HttpResult<List<DictData>> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName());
|
||||
List<DictData> reasonData = reason.getData();
|
||||
List<DictData> typeData = type.getData();
|
||||
|
||||
Map<String, Integer> reasonMap = new LinkedHashMap<>();
|
||||
Map<String, Integer> typeMap = new LinkedHashMap<>();
|
||||
|
||||
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
|
||||
Map<String,String> reasonData = reasonList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||
Map<String, Integer> reasonMap = convertMap(reasonData);
|
||||
List<DictData> advanceTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
|
||||
Map<String,String> advanceTypeData = advanceTypeList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||
Map<String, Integer> typeMap = convertMap(advanceTypeData);
|
||||
|
||||
//添加detail
|
||||
for (RmpEventDetailPO detail : info) {
|
||||
EventDetail details = null;
|
||||
if (typeList.contains(detail.getEventType())) {
|
||||
for (DictData data : reasonData) {
|
||||
reasonMap.put(data.getName(), 0);
|
||||
if (detail.getAdvanceReason().equals(data.getId())) {
|
||||
details = BeanUtil.copyProperties(detail, EventDetail.class);
|
||||
details.setAdvanceReason(data.getName());
|
||||
}
|
||||
}
|
||||
for (DictData data : typeData) {
|
||||
typeMap.put(data.getName(), 0);
|
||||
if (detail.getAdvanceType().equals(data.getId())) {
|
||||
// details = BeanUtil.copyProperties(detail, EventDetail.class);
|
||||
details.setAdvanceType(data.getName());
|
||||
}
|
||||
}
|
||||
list.add(details);
|
||||
EventDetail details = BeanUtil.copyProperties(detail, EventDetail.class);
|
||||
if(StrUtil.isNotBlank(detail.getAdvanceType())){
|
||||
details.setAdvanceType(advanceTypeData.get(detail.getAdvanceType()));
|
||||
}else {
|
||||
details.setAdvanceType(DicDataEnum.OTHER.getName());
|
||||
}
|
||||
if(StrUtil.isNotBlank(detail.getAdvanceReason())){
|
||||
details.setAdvanceReason(reasonData.get(detail.getAdvanceReason()));
|
||||
}else {
|
||||
details.setAdvanceReason(DicDataEnum.OTHER.getName());
|
||||
}
|
||||
list.add(details);
|
||||
}
|
||||
|
||||
//添加reason到map
|
||||
for (EventDetail data : list) {
|
||||
if (reasonMap.get(data.getAdvanceReason()) != null) {
|
||||
@@ -993,10 +985,29 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
}
|
||||
result.setTypes(typesVOS);
|
||||
result.setReason(reasonsVOS);
|
||||
//result.setDetail(list);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将原Map的value作为新Map的key,0作为新Map的value
|
||||
* @param originalMap 原始Map(key和value唯一)
|
||||
* @return 转换后的新Map
|
||||
*/
|
||||
public static <K, V> Map<V, Integer> convertMap(Map<K, V> originalMap) {
|
||||
// 创建新的HashMap存储结果
|
||||
Map<V, Integer> newMap = new HashMap<>();
|
||||
|
||||
// 遍历原始Map的所有entry
|
||||
for (Map.Entry<K, V> entry : originalMap.entrySet()) {
|
||||
// 原value作为新key,0作为新value
|
||||
V originalValue = entry.getValue();
|
||||
newMap.put(originalValue, 0);
|
||||
}
|
||||
|
||||
return newMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂降幅值的概率分布函数
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user