Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
0ac87eb273
|
@ -3,6 +3,7 @@ package org.jeecg.modules.system.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.google.common.collect.Multimap;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.entity.vo.NuclideLines;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -10,4 +11,6 @@ import java.util.Map;
|
|||
public interface IGardsNuclLinesLibService extends IService<GardsNuclLinesLib> {
|
||||
|
||||
Map<String,List<GardsNuclLinesLib>> mapLines(List<String> nuclideNames);
|
||||
|
||||
Map<String, NuclideLines> defaultLines(List<String> nuclideNames);
|
||||
}
|
||||
|
|
|
@ -2,17 +2,12 @@ package org.jeecg.modules.system.service.impl;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
import org.apache.commons.collections.MultiHashMap;
|
||||
import org.jeecg.common.util.ListUtils;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.entity.vo.NuclideLines;
|
||||
import org.jeecg.modules.system.mapper.GardsNuclLinesLibMapper;
|
||||
import org.jeecg.modules.system.service.IGardsNuclLibService;
|
||||
import org.jeecg.modules.system.service.IGardsNuclLinesLibService;
|
||||
|
@ -21,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -64,4 +60,40 @@ public class GardsNuclLinesLibServiceImpl extends ServiceImpl<GardsNuclLinesLibM
|
|||
result = allNuclide.stream().collect(Collectors.groupingBy(GardsNuclLinesLib::getName));
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public Map<String, NuclideLines> defaultLines(List<String> nuclideNames) {
|
||||
Map<String, NuclideLines> result = new HashMap<>();
|
||||
LambdaQueryWrapper<GardsNuclLinesLib> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(GardsNuclLinesLib::getName, nuclideNames);
|
||||
// 获取GardsNuclLinesLib核素数据
|
||||
List<GardsNuclLinesLib> allNuclide = list(wrapper);
|
||||
Map<String, Double> halfLife = nuclLibService.halfLife(nuclideNames);
|
||||
|
||||
// 按照 QT源代码 处理数据
|
||||
for (int i = 0; i < allNuclide.size(); i++) {
|
||||
NuclideLines nuclideLines;
|
||||
GardsNuclLinesLib lib = allNuclide.get(i);
|
||||
nuclideLines = result.containsKey(lib.getName()) ? result.get(lib.getName()) : new NuclideLines();
|
||||
|
||||
nuclideLines.getFullNames().add(lib.getFullName());
|
||||
nuclideLines.getVEnergy().add(lib.getEnergy());
|
||||
nuclideLines.getVUncertE().add(lib.getEnergyUncert());
|
||||
nuclideLines.getVYield().add(lib.getYield() / 100);
|
||||
nuclideLines.getVUncertY().add(lib.getYieldUncert());
|
||||
|
||||
int keyFlag = lib.getKeyFlag();
|
||||
if (keyFlag > 0){
|
||||
nuclideLines.setKey_flag(i);
|
||||
nuclideLines.setMaxYeildIdx(i);
|
||||
}
|
||||
|
||||
String name = lib.getName();
|
||||
Double day = halfLife.get(name);
|
||||
if (ObjectUtil.isNotNull(day))
|
||||
lib.setHalflife(day * 86400);
|
||||
|
||||
result.put(lib.getName(), nuclideLines);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.jeecg.common.constant.RedisConstant;
|
|||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||
import org.jeecg.modules.entity.vo.NuclideLines;
|
||||
import org.jeecg.modules.monitor.domain.RedisInfo;
|
||||
import org.jeecg.modules.system.mapper.SysDefaultNuclideMapper;
|
||||
import org.jeecg.modules.system.service.IGardsNuclLinesLibService;
|
||||
|
@ -24,10 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
@ -108,21 +106,27 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
|
|||
@PostConstruct
|
||||
@Override
|
||||
public void mapLines2Redis() {
|
||||
HashMap<String, NuclideLines> linesHashMap = new HashMap<>();
|
||||
|
||||
List<String> nuclideTypes = ListUtil.toList("G","P");
|
||||
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SysDefaultNuclide::getUseType,1);
|
||||
wrapper.in(SysDefaultNuclide::getNuclideType,nuclideTypes);
|
||||
// 获取自动处理需要的默认核素参数
|
||||
List<SysDefaultNuclide> nuclides = list(wrapper);
|
||||
// 根据核素类型分组
|
||||
Map<String, List<SysDefaultNuclide>> nuclideMap = nuclides.stream()
|
||||
.filter(nuclide -> StrUtil.isNotBlank(nuclide.getNuclideName()))
|
||||
.collect(Collectors.groupingBy(SysDefaultNuclide::getNuclideType));
|
||||
// 获取GardsNuclLinesLib核素数据
|
||||
for (Map.Entry<String, List<SysDefaultNuclide>> entry : nuclideMap.entrySet()) {
|
||||
List<String> nuclideNames = entry.getValue().stream()
|
||||
.map(SysDefaultNuclide::getNuclideName)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
String nuclideType = entry.getKey();
|
||||
String key = RedisConstant.NUCLIDE_LINES_LIB + nuclideType;
|
||||
Map<String,List<GardsNuclLinesLib>> mapLines = nuclLinesLibService.mapLines(nuclideNames);
|
||||
Map<String,NuclideLines> mapLines = nuclLinesLibService.defaultLines(nuclideNames);
|
||||
redisUtil.set(key,mapLines);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user