|
@@ -44,6 +44,9 @@ public class CacheContext implements CommandLineRunner {
|
|
|
private IProBasicWindturbinePowerService proBasicWindturbinePowerService;
|
|
|
@Resource
|
|
|
private RedisService redisService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicModelPowerService proBasicModelPowerService;
|
|
|
+
|
|
|
@Value("${runWindpowerstation}")
|
|
|
private String runWindpowerstation;
|
|
|
|
|
@@ -55,7 +58,9 @@ public class CacheContext implements CommandLineRunner {
|
|
|
public static Map<String,ProBasicMeterPoint> meterpointMap = new HashMap<>();
|
|
|
public static Map<String,List<ProBasicProject>> wppromap = new HashMap<>();
|
|
|
public static Map<String,List<ProBasicLine>> prolinemap = new HashMap<>();
|
|
|
- public static Map<String,List<ProBasicWindturbine>> linewtmap = new HashMap<>();
|
|
|
+ public static Map<String,List<ProBasicWindturbine>> wpwtmap = new HashMap<>();
|
|
|
+ public static Map<String,List<ProBasicWindturbine>> pjwtmap = new HashMap<>();
|
|
|
+ public static Map<String,List<ProBasicWindturbine>> lnwtmap = new HashMap<>();
|
|
|
public static Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = new HashMap<>();
|
|
|
public static Map<String,Map<String, ProBasicWppoint>> linepointmap =new HashMap<>();
|
|
|
public static Map<String,Map<String, ProBasicWppoint>> propointmap =new HashMap<>();
|
|
@@ -66,37 +71,123 @@ public class CacheContext implements CommandLineRunner {
|
|
|
public static Map<String,ProEconEquipmentmodel> modelMap = new HashMap<>();
|
|
|
public static Map<String,Map<Double,Double>> zzsglMap = new HashMap<>();
|
|
|
public static Map<String,Double> modelpower = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String,String> wtstandardmap = new HashMap<>();
|
|
|
+ public static Map<String,ProBasicWindturbine> wtmap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String,Map<Double,ProBasicModelPower>> modelpowermap = new TreeMap<>();
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
logger.info("缓存开始------------------------------------------------------------");
|
|
|
List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
|
|
|
logger.info(runWpids.get(0)+"------------------"+runWpids.size());
|
|
|
|
|
|
+
|
|
|
List<ProEconEquipmentmodel> equipmentmodels = proEconEquipmentmodelService.list();
|
|
|
equipmentmodels.stream().forEach(e->{
|
|
|
modelMap.put(e.getId(),e);
|
|
|
});
|
|
|
+ List<ProBasicModelPower> mpls=proBasicModelPowerService.list();
|
|
|
+ mpls.sort(Comparator.comparing(ProBasicModelPower::getSpeed));
|
|
|
+ if(!mpls.isEmpty())
|
|
|
+ {
|
|
|
|
|
|
+ for(ProBasicModelPower mp:mpls)
|
|
|
+ {
|
|
|
+ if(modelpowermap.containsKey(mp.getModelId()))
|
|
|
+ {
|
|
|
+ Map<Double,ProBasicModelPower> tempmap=modelpowermap.get(mp.getModelId());
|
|
|
+ tempmap.put(mp.getSpeed(),mp);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ Map<Double,ProBasicModelPower> tempmap=new HashMap<>();
|
|
|
+ tempmap.put(mp.getSpeed(),mp);
|
|
|
+ modelpowermap.put(mp.getModelId(),tempmap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
wtls = proBasicWindturbineService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId())).collect(Collectors.toList());
|
|
|
logger.info(wtls.size()+"");
|
|
|
wtls.forEach(wt->{
|
|
|
ProEconEquipmentmodel equipmentmodel = modelMap.get(wt.getModelId());
|
|
|
modelpower.put(wt.getId(),equipmentmodel.getPowerProduction().doubleValue());
|
|
|
|
|
|
+ wtmap.put(wt.getId(),wt);
|
|
|
+
|
|
|
+ wtstandardmap.put(wt.getId(),wt.getId());
|
|
|
String wtString = redisService.get(wt.getId());
|
|
|
Map<String, ProBasicEquipmentPoint> stringWindturbinetestingpointnewMap = JSONObject.parseObject(wtString, new TypeReference<Map<String, ProBasicEquipmentPoint>>() {
|
|
|
});
|
|
|
wtpAimap.put(wt.getId(),stringWindturbinetestingpointnewMap);
|
|
|
|
|
|
- if (linewtmap.containsKey(wt.getLineId())){
|
|
|
- linewtmap.get(wt.getLineId()).add(wt);
|
|
|
+
|
|
|
+ if (wpwtmap.containsKey(wt.getWindpowerstationId())){
|
|
|
+ wpwtmap.get(wt.getWindpowerstationId()).add(wt);
|
|
|
+ }else {
|
|
|
+ List<ProBasicWindturbine> wps = new ArrayList<>();
|
|
|
+ wps.add(wt);
|
|
|
+ wpwtmap.put(wt.getWindpowerstationId(),wps);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pjwtmap.containsKey(wt.getProjectId())){
|
|
|
+ pjwtmap.get(wt.getProjectId()).add(wt);
|
|
|
+ }else {
|
|
|
+ List<ProBasicWindturbine> pjs = new ArrayList<>();
|
|
|
+ pjs.add(wt);
|
|
|
+ pjwtmap.put(wt.getProjectId(),pjs);
|
|
|
+ }
|
|
|
+ if (lnwtmap.containsKey(wt.getLineId())){
|
|
|
+ lnwtmap.get(wt.getLineId()).add(wt);
|
|
|
}else {
|
|
|
List<ProBasicWindturbine> lines = new ArrayList<>();
|
|
|
lines.add(wt);
|
|
|
- linewtmap.put(wt.getLineId(),lines);
|
|
|
+ lnwtmap.put(wt.getLineId(),lines);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ for(ProBasicWindturbine wt:wtls)
|
|
|
+ {
|
|
|
+ if(wpwtmap.containsKey(wt.getLineId()))
|
|
|
+ {
|
|
|
+ List<ProBasicWindturbine> wts=wpwtmap.get(wt.getLineId());
|
|
|
+ for(ProBasicWindturbine w:wts)
|
|
|
+ {
|
|
|
+ if(StringUtils.notEmp(w.getIsStandard()) && w.getIsStandard()!=0)
|
|
|
+ {
|
|
|
+ wtstandardmap.put(wt.getId(),w.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(pjwtmap.containsKey(wt.getLineId()))
|
|
|
+ {
|
|
|
+ List<ProBasicWindturbine> wts=pjwtmap.get(wt.getLineId());
|
|
|
+ for(ProBasicWindturbine w:wts)
|
|
|
+ {
|
|
|
+ if(StringUtils.notEmp(w.getIsStandard()) && w.getIsStandard()!=0)
|
|
|
+ {
|
|
|
+ wtstandardmap.put(wt.getId(),w.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(lnwtmap.containsKey(wt.getLineId()))
|
|
|
+ {
|
|
|
+ List<ProBasicWindturbine> wts=lnwtmap.get(wt.getLineId());
|
|
|
+ for(ProBasicWindturbine w:wts)
|
|
|
+ {
|
|
|
+ if(StringUtils.notEmp(w.getIsStandard()) && w.getIsStandard()!=0)
|
|
|
+ {
|
|
|
+ wtstandardmap.put(wt.getId(),w.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
projects = proBasicProjectService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId())).collect(Collectors.toList());
|
|
|
projects.stream().forEach(p->{
|
|
|
proMap.put(p.getId(),p);
|