123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- package com.gyee.impala.common.spring;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.gyee.impala.mapper.decision.CollectorwireprojectMapper;
- import com.gyee.impala.mapper.decision.EnumMenuItemMapper;
- import com.gyee.impala.mapper.decision.WindplantprojectMapper;
- import com.gyee.impala.mapper.decision.WturMapper;
- import com.gyee.impala.mapper.master.WindturbineMapper;
- import com.gyee.impala.mapper.slave.LineMapper;
- import com.gyee.impala.mapper.slave.ProjectMapper;
- import com.gyee.impala.model.decision.Collectorwireproject;
- import com.gyee.impala.model.decision.EnumMenuItem;
- import com.gyee.impala.model.decision.Windplantproject;
- import com.gyee.impala.model.decision.Wtur;
- import com.gyee.impala.model.master.Windturbine;
- import com.gyee.impala.model.slave.Line;
- import com.gyee.impala.model.slave.Project;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.stream.Collectors;
- @Service
- public class DecisionConvert {
- @Resource
- private WindplantprojectMapper windplantprojectMapper;
- @Resource
- private CollectorwireprojectMapper collectorwireprojectMapper;
- @Resource
- private WturMapper wturMapper;
- @Resource
- private WindturbineMapper windturbineMapper;
- @Resource
- private ProjectMapper projectMapper;
- @Resource
- private LineMapper lineMapper;
- @Resource
- private EnumMenuItemMapper enumMenuItemMapper;
- //网源id,英文名称
- private Map<Short, String> stationIdMap;
- //网源id,汉字名称
- private Map<Short, String> stationNameMap;
- private Map<Short, String> projectIdMap;
- private Map<Short, String> projectNameMap;
- private Map<Short, String> lineIdMap;
- private Map<Short, String> lineNameMap;
- private Map<Short, String> windturbineIdMap;
- private Map<Short, String> windturbineNameMap;
- //超短期模型
- private Map<Integer, String> spModelNameMap;
- //短期模型
- private Map<Integer, String> modelNameMap;
- private List<Collectorwireproject> collectorwireprojects;
- private List<Windplantproject> windplantprojects;
- public Map<Integer, String> getSpModelNameMap() {
- if (spModelNameMap == null) {
- QueryWrapper<EnumMenuItem> wrapper = new QueryWrapper<>();
- wrapper.eq("MENU_NO", 123);
- spModelNameMap = enumMenuItemMapper.selectList(wrapper).stream().collect(Collectors.toMap(EnumMenuItem::getItemNo, EnumMenuItem::getItemName));
- }
- return spModelNameMap;
- }
- public Map<Integer, String> getModelNameMap() {
- if (modelNameMap == null) {
- QueryWrapper<EnumMenuItem> wrapper = new QueryWrapper<>();
- wrapper.eq("MENU_NO", 120);
- modelNameMap = enumMenuItemMapper.selectList(wrapper).stream().collect(Collectors.toMap(EnumMenuItem::getItemNo, EnumMenuItem::getItemName));
- }
- return modelNameMap;
- }
- public Map<Short, String> getStationIdMap() {
- if (stationIdMap == null) {
- stationIdMap = new HashMap<>();
- stationIdMap.put((short) 1, "NSS_FDC");
- stationIdMap.put((short) 2, "QS_FDC");
- stationIdMap.put((short) 3, "SBQ_FDC");
- stationIdMap.put((short) 4, "XS_FDC");
- stationIdMap.put((short) 5, "MHS_FDC");
- }
- return stationIdMap;
- }
- public Map<Short, String> getStationNameMap() {
- if (stationNameMap == null) {
- stationNameMap = new HashMap<>();
- stationNameMap.put((short) 1, "牛首山风电场");
- stationNameMap.put((short) 2, "青山风电场");
- stationNameMap.put((short) 3, "石板泉风电场");
- stationNameMap.put((short) 4, "香山风电场");
- stationNameMap.put((short) 5, "麻黄山风电场");
- }
- return stationNameMap;
- }
- public Map<Short, String> getProjectIdMap() {
- if (projectNameMap == null) {
- Map<String, String> pm = projectMapper.selectList(Wrappers.emptyWrapper()).stream().collect(
- Collectors.toMap(Project::getName, Project::getId));
- getProjectNameMap();
- projectNameMap = new HashMap<>();
- projectIdMap.forEach((wyid, wyname) -> projectNameMap.put(wyid, pm.get(wyname)));
- }
- return projectNameMap;
- }
- public Map<Short, String> getProjectNameMap() {
- if (projectIdMap == null) {
- getWindplantprojects();
- projectIdMap = windplantprojects.stream().collect(Collectors.toMap(Windplantproject::getProjectNo, Windplantproject::getProjectName));
- }
- return projectIdMap;
- }
- public Map<Short, String> getLineIdMap() {
- if (lineNameMap == null) {
- Map<String, String> lm = lineMapper.selectList(Wrappers.emptyWrapper()).stream().collect(
- Collectors.toMap(Line::getName, Line::getId));
- getLineNameMap();
- lineNameMap = new HashMap<>();
- lineIdMap.forEach((wyid, wynm) -> lineNameMap.put(wyid, lm.get(wynm)));
- }
- return lineNameMap;
- }
- public Map<Short, String> getLineNameMap() {
- if (lineIdMap == null) {
- getCollectorwireprojects();
- lineIdMap = collectorwireprojects.stream().collect(Collectors.toMap(Collectorwireproject::getCollectorwireNo, Collectorwireproject::getWireName));
- }
- return lineIdMap;
- }
- public Map<Short, String> getWindturbineIdMap() {
- if (windturbineIdMap == null) {
- QueryWrapper<Wtur> wrapper = new QueryWrapper();
- wrapper.lt("WINDPLANT_NO", 6).lt("WTG_TYPE", 15);
- List<Wtur> wturs = wturMapper.selectList(wrapper);
- wturs.forEach(wtur -> wtur.setName(wtur.getName().replaceFirst("G", "G01_")));
- windturbineIdMap = wturs.stream().collect(Collectors.toMap(Wtur::getWturNo, Wtur::getName));
- }
- return windturbineIdMap;
- }
- public Map<Short, String> getWindturbineNameMap() {
- if (windturbineNameMap == null) {
- Map<String, String> wm = windturbineMapper.selectList(Wrappers.emptyWrapper()).stream().collect(
- Collectors.toMap(Windturbine::getId, Windturbine::getName));
- getWindturbineIdMap();
- windturbineNameMap = new HashMap<>();
- windturbineIdMap.forEach((wyid, fjid) -> windturbineNameMap.put(wyid, wm.get("fjid")));
- }
- return windturbineNameMap;
- }
- public List<Collectorwireproject> getCollectorwireprojects() {
- if (collectorwireprojects == null) {
- QueryWrapper<Collectorwireproject> wrapper = new QueryWrapper();
- wrapper.lt("WP_NO", 6);
- collectorwireprojects = collectorwireprojectMapper.selectList(wrapper);
- }
- return collectorwireprojects;
- }
- public List<Windplantproject> getWindplantprojects() {
- if (windplantprojects == null) {
- QueryWrapper<Windplantproject> wrapper = new QueryWrapper();
- wrapper.gt("PROJECT_NO", 0);
- windplantprojects = windplantprojectMapper.selectList(wrapper);
- }
- return windplantprojects;
- }
- }
|