暂降模块调整
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.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.config.GeneralInfo;
|
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())))
|
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
|
||||||
);
|
);
|
||||||
|
|
||||||
HttpResult<List<DictData>> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName());
|
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
|
||||||
HttpResult<List<DictData>> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName());
|
Map<String,String> reasonData = reasonList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||||
List<DictData> reasonData = reason.getData();
|
Map<String, Integer> reasonMap = convertMap(reasonData);
|
||||||
List<DictData> typeData = type.getData();
|
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> reasonMap = new LinkedHashMap<>();
|
Map<String, Integer> typeMap = convertMap(advanceTypeData);
|
||||||
Map<String, Integer> typeMap = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
//添加detail
|
//添加detail
|
||||||
for (RmpEventDetailPO detail : info) {
|
for (RmpEventDetailPO detail : info) {
|
||||||
EventDetail details = null;
|
EventDetail details = BeanUtil.copyProperties(detail, EventDetail.class);
|
||||||
if (typeList.contains(detail.getEventType())) {
|
if(StrUtil.isNotBlank(detail.getAdvanceType())){
|
||||||
for (DictData data : reasonData) {
|
details.setAdvanceType(advanceTypeData.get(detail.getAdvanceType()));
|
||||||
reasonMap.put(data.getName(), 0);
|
}else {
|
||||||
if (detail.getAdvanceReason().equals(data.getId())) {
|
details.setAdvanceType(DicDataEnum.OTHER.getName());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
if(StrUtil.isNotBlank(detail.getAdvanceReason())){
|
||||||
|
details.setAdvanceReason(reasonData.get(detail.getAdvanceReason()));
|
||||||
|
}else {
|
||||||
|
details.setAdvanceReason(DicDataEnum.OTHER.getName());
|
||||||
|
}
|
||||||
|
list.add(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加reason到map
|
//添加reason到map
|
||||||
for (EventDetail data : list) {
|
for (EventDetail data : list) {
|
||||||
if (reasonMap.get(data.getAdvanceReason()) != null) {
|
if (reasonMap.get(data.getAdvanceReason()) != null) {
|
||||||
@@ -993,10 +985,29 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
|||||||
}
|
}
|
||||||
result.setTypes(typesVOS);
|
result.setTypes(typesVOS);
|
||||||
result.setReason(reasonsVOS);
|
result.setReason(reasonsVOS);
|
||||||
//result.setDetail(list);
|
|
||||||
return result;
|
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