Commit e034546f authored by wujiang's avatar wujiang

修改level_为level

parent 710033a2
......@@ -2,7 +2,7 @@ spring.application.name=AMOS-HYGF-CZ
server.servlet.context-path=/hygf
server.port=33330
server.uri-encoding=UTF-8
spring.profiles.active=kingbase8
spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
logging.config=classpath:logback-${spring.profiles.active}.xml
......
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectentity.StdUserEmpower;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
......@@ -13,7 +15,7 @@ import java.util.Map;
* @createDate: 2023/11/9
*/
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> {
@Select("select company_name as companyName , level_ from privilege_company where org_code = #{orgCode}")
Map<String,String> getCompanyInfoByOrgCode(String orgCode);
@Select("select company_name as companyName , level from privilege_company where org_code = #{orgCode}")
CompanyModel getCompanyInfoByOrgCode(String orgCode);
}
......@@ -21,6 +21,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectentity.StdUserEmpower;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
@Service
public class IPermissionServiceImpl implements IPermissionService {
......@@ -44,8 +45,8 @@ public class IPermissionServiceImpl implements IPermissionService {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_").toString();
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
return null;
}
......@@ -76,8 +77,8 @@ public class IPermissionServiceImpl implements IPermissionService {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_");
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
List<StationBasic> stationBasics = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
......@@ -110,8 +111,8 @@ public class IPermissionServiceImpl implements IPermissionService {
return rootNodeName+"_111";
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_").toString();
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
return "all";
}
......
......@@ -31,7 +31,7 @@ public class RegionDto {
private Long parentId;
@ApiModelProperty(value = "等级")
@TableField("LEVEL_")
@TableField("LEVEL")
private String level;
@ApiModelProperty(value = "上级编码")
......
......@@ -34,7 +34,7 @@ public class Region {
/**
* 等级
*/
@TableField("LEVEL_")
@TableField("LEVEL")
private String level;
/**
......
......@@ -2,7 +2,7 @@ spring.application.name=AMOS-JXIOP-BIGSCREEN-WJ
server.servlet.context-path=/jxiop-bigscreen
server.port=33300
server.uri-encoding=UTF-8
spring.profiles.active=kingbase8
spring.profiles.active=dev1
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
logging.config=classpath:logback-${spring.profiles.active}.xml
......
......@@ -10,7 +10,7 @@ import java.util.Map;
public interface PrivilegeCompanyMapper extends BaseMapper<PrivilegeCompany> {
@Select("select SEQUENCE_NBR as sequenceNbr,ORG_CODE as orgCode,COMPANY_NAME as companyName ,LEVEL_ as level_ from privilege_company where COMPANY_TYPE = 'region' and IS_DELETED = 0 ")
@Select("select SEQUENCE_NBR as sequenceNbr,ORG_CODE as orgCode,COMPANY_NAME as companyName ,LEVEL from privilege_company where COMPANY_TYPE = 'region' and IS_DELETED = 0 ")
public List<PrivilegeCompany> getAreaCompany();
......
......@@ -17,8 +17,8 @@ import java.util.Map;
* @createDate: 2023/11/9
*/
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> {
@Select("select company_name as companyName , level_ from privilege_company where org_code = #{orgCode}")
Map<String,String> getCompanyInfoByOrgCode(String orgCode);
@Select("select company_name as companyName , level from privilege_company where org_code = #{orgCode}")
CompanyModel getCompanyInfoByOrgCode(String orgCode);
List<CompanyModel> getCompanyBoList(@Param("companyType") String companyType,
@Param("level") String level,
......
......@@ -138,14 +138,14 @@ public class PrivilegeController extends BaseController {
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
Map<String, String> companyInfo = new HashMap<String, String>();
CompanyModel companyInfo;
if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!");
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level_").toString();
companyName = companyInfo.get("companyName").toString();
companyLevel = companyInfo.getLevel();
companyName = companyInfo.getCompanyName();
}
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(qgCompanyId);
List<CompanyModel> list = new ArrayList<>();
......
......@@ -22,7 +22,7 @@ public class PrivilegeCompany extends BaseEntity {
private Long parentId;
@TableField("REGION_SEQ")
private String regionSeq;
@TableField("LEVEL_")
@TableField("LEVEL")
private String level;
@TableField("EMAIL")
private String email;
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -12,17 +24,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.PrivilegeCompany
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.PrivilegeCompany;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.StdUserEmpower;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
@Service
public class IPermissionServiceImpl implements IPermissionService {
......@@ -52,8 +54,8 @@ public class IPermissionServiceImpl implements IPermissionService {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_");
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
List<StationBasic> stationBasics = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
......@@ -89,8 +91,8 @@ public class IPermissionServiceImpl implements IPermissionService {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_");
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
List<StationBasic> stationBasics = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
......@@ -139,8 +141,8 @@ public class IPermissionServiceImpl implements IPermissionService {
map.put("isStation","false");
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_");
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
map.put("isStation","false");
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RegionDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IRegionService;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RegionDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 服务实现类
......@@ -37,6 +40,6 @@ public class RegionServiceImpl extends BaseService<RegionDto,Region,RegionMapper
}
//根据regionName获取regionCode
public Region getRegionCodeByRegionName(String regionName) {
return this.getOne(new QueryWrapper<Region>().like("REGION_NAME",regionName).eq("LEVEL_",1));
return this.getOne(new LambdaQueryWrapper<Region>().like(Region::getRegionName,regionName).eq(Region::getLevel,1));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.api.amosprojectmapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StdUserEmpower;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StdUserEmpower;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
/**
* @description:
......@@ -12,7 +12,7 @@ import java.util.Map;
* @createDate: 2023/11/9
*/
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> {
@Select("select company_name as companyName , level_ from privilege_company where org_code = #{orgCode}")
Map<String,String> getCompanyInfoByOrgCode(String orgCode);
@Select("select company_name as companyName , level from privilege_company where org_code = #{orgCode}")
CompanyModel getCompanyInfoByOrgCode(String orgCode);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
......@@ -385,7 +387,7 @@ public class CommonServiceImpl {
*/
public List<StationCacheInfoDto> getListStationCacheInfoDto() {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL_", 1));
List<Region> regionList = regionMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
//.isNotNull("fan_gateway_id"));
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jxiop.api.amosprojectmapper.UserEmpowerMapper;
......@@ -8,13 +14,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.context.ThemeSource;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.Map;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
@Service
public class JxiopMonitorMapPermissionServiceImpl {
......@@ -40,15 +40,15 @@ public class JxiopMonitorMapPermissionServiceImpl {
return result;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level_").toString();
CompanyModel companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.getLevel();
if (companyLevel.equals("categroy_leve2")) {
result.put("showType", "all");
return result;
}
if(companyLevel.equals("area")){
result.put("showType","area");
String areaName =companyInfo.get("companyName").replace("片区","").replace("区域","");
String areaName =companyInfo.getCompanyName().replace("片区","").replace("区域","");
result.put("areaName",areaName);
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name",areaName));
if(!ObjectUtils.isEmpty(mapRegion)){
......
......@@ -89,6 +89,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
......@@ -308,8 +309,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// throw new BadRequest("您当前未配置数据权限!");
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level_").toString();
CompanyModel companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.getLevel();
}
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.dto.*;
......@@ -45,47 +46,60 @@ public class MonitorServiceImpl implements MonitorService {
private final MapRegionMapper mapRegionMapper;
private final HttpRequestUtil httpRequestUtil;
@Override
public void getTotalData() {
//获取所有的场站数据
// 获取所有的场站数据
// List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().contains("GFDZ")).collect(Collectors.toList());
List<StationBasic> cnList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().contains("GFDZ")).collect(Collectors.toList());
List<StationBasic> cnList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
//----------------装机容量开始-----------------------
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list = new ArrayList<>();
//装机容量
// 装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null).mapToDouble(StationBasic::getInstalledCapacity).sum());
BigDecimal totalInstall = new BigDecimal(
stationBasicListAll.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null)
.mapToDouble(StationBasic::getInstalledCapacity).sum());
stringHashMap.put("title", totalInstall.toString());
stringHashMap.put("data", "");
list.add(stringHashMap);
//风电站
// 风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(fdzList.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null).mapToDouble(StationBasic::getInstalledCapacity).sum());
BigDecimal fdzInstall = new BigDecimal(
fdzList.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null)
.mapToDouble(StationBasic::getInstalledCapacity).sum());
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
//光伏电站
// 光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal gfInstall = new BigDecimal(gfList.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null).mapToDouble(StationBasic::getInstalledCapacity).sum());
BigDecimal gfInstall = new BigDecimal(
gfList.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null)
.mapToDouble(StationBasic::getInstalledCapacity).sum());
stringHashMap2.put("title", gfInstall.toString());
stringHashMap2.put("data", String.valueOf(gfList.size()));
list.add(stringHashMap2);
//储能站
// 储能站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal cnInstall = new BigDecimal(cnList.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null).mapToDouble(StationBasic::getInstalledCapacity).sum());
BigDecimal cnInstall = new BigDecimal(
cnList.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null)
.mapToDouble(StationBasic::getInstalledCapacity).sum());
stringHashMap3.put("title", cnInstall.toString());
stringHashMap3.put("data", String.valueOf(cnList.size()));
list.add(stringHashMap3);
page.setRecords(list);
BigDecimal gFInstall = new BigDecimal(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null).mapToDouble(StationBasic::getInstalledCapacity).sum());
BigDecimal gFInstall = new BigDecimal(
stationBasicListAll.stream().filter(stationBasic -> stationBasic.getInstalledCapacity() != null)
.mapToDouble(StationBasic::getInstalledCapacity).sum());
//----------------------装机容量结束----------------------------------------
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list1 = new ArrayList<>();
......@@ -106,15 +120,18 @@ public class MonitorServiceImpl implements MonitorService {
Double completeRateOfAnnualGF = 0.00;
Double useHoursOfAnnualGF = 0.00;
//获取全国数据
// 获取全国数据
String nationalUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url;
//获取风电
// 获取风电
String nationalFanUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&type=fan";
//获取光伏
// 获取光伏
String nationalPVUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&type=pv";
List<BuDunGenDto> nationalGendto = httpRequestUtil.getResPonse(nationalUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> fanGendto = httpRequestUtil.getResPonse(nationalFanUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> pvGendto = httpRequestUtil.getResPonse(nationalPVUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> nationalGendto = httpRequestUtil.getResPonse(nationalUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> fanGendto = httpRequestUtil.getResPonse(nationalFanUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> pvGendto = httpRequestUtil.getResPonse(nationalPVUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
if (nationalGendto.size() > 0) {
BuDunGenDto buDunGenDto = nationalGendto.get(0);
powerOfDay = buDunGenDto.getDay();
......@@ -169,19 +186,24 @@ public class MonitorServiceImpl implements MonitorService {
// }
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/"
+ String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfMonthGF));
stringHashMap5.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD) + "/"
+ String.format(CommonConstans.Fourdecimalplaces, powerOfMonthGF));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualGF));
stringHashMap6.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD) + "/"
+ String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualGF));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, useHoursOfAnnualFD) + "/" + String.format(CommonConstans.Twodecimalplaces, useHoursOfAnnualGF));
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, useHoursOfAnnualFD) + "/"
+ String.format(CommonConstans.Twodecimalplaces, useHoursOfAnnualGF));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, completeRateOfAnnualFD) + "/" + String.format(CommonConstans.Twodecimalplaces, completeRateOfAnnualGF));
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, completeRateOfAnnualFD) + "/"
+ String.format(CommonConstans.Twodecimalplaces, completeRateOfAnnualGF));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
......@@ -198,9 +220,12 @@ public class MonitorServiceImpl implements MonitorService {
list2.add(stringHashMap12);
page2.setRecords(list2);
try {
emqKeeper.getMqttClient().publish("total_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1,
true);
} catch (Exception ex) {
}
......@@ -210,16 +235,26 @@ public class MonitorServiceImpl implements MonitorService {
public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
List<StationCacheInfoDto> stationCacheInfoDtoList = this.getListStationCacheInfoDto();
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level_", 1));
List<Region> regionList = this.regionMapper
.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
List<StationCacheInfoDto> list = new ArrayList<>();
if ((!ObjectUtils.isEmpty(type) && type.equals("gis")) && (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
if ((!ObjectUtils.isEmpty(type) && type.equals("gis"))
&& (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
for (int i = 0; i < regionList.size(); i++) {
RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
Region region = regionList.get(i);
list = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(region.getRegionName())).collect(Collectors.toList());
List<StationCacheInfoDto> fdlist = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> gflist = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().contains("GFDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> cnlist = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("CNDZ")).collect(Collectors.toList());
list = stationCacheInfoDtoList.stream().filter(
stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(region.getRegionName()))
.collect(Collectors.toList());
List<StationCacheInfoDto> fdlist = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
List<StationCacheInfoDto> gflist = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().contains("GFDZ"))
.collect(Collectors.toList());
List<StationCacheInfoDto> cnlist = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("CNDZ"))
.collect(Collectors.toList());
if (list.size() > 0) {
regionNationWideDto.setJsJoin(true);
} else {
......@@ -228,9 +263,18 @@ public class MonitorServiceImpl implements MonitorService {
regionNationWideDto.setFengdian(String.valueOf(fdlist.size()));
regionNationWideDto.setGuangfu(String.valueOf(gflist.size()));
regionNationWideDto.setChuneng(String.valueOf(cnlist.size()));
regionNationWideDto.setGuangfuMW(String.format(CommonConstans.Twodecimalplaces, gflist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setFengdianMV(String.format(CommonConstans.Twodecimalplaces, fdlist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setChunengMV(String.format(CommonConstans.Twodecimalplaces, cnlist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setGuangfuMW(String.format(CommonConstans.Twodecimalplaces,
gflist.stream().mapToDouble(
stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()))
.sum()));
regionNationWideDto.setFengdianMV(String.format(CommonConstans.Twodecimalplaces,
fdlist.stream().mapToDouble(
stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()))
.sum()));
regionNationWideDto.setChunengMV(String.format(CommonConstans.Twodecimalplaces,
cnlist.stream().mapToDouble(
stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()))
.sum()));
regionNationWideDto.setName(region.getRegionName());
regionNationWideDtoList.add(regionNationWideDto);
}
......@@ -242,16 +286,21 @@ public class MonitorServiceImpl implements MonitorService {
}
}
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&provinceName" + provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&provinceName"
+ provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl,
Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
String finalProvinceName = provinceName;
if (!ObjectUtils.isEmpty(type) && type.equals("station")) {
list = stationCacheInfoDtoList;
} else {
list = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(finalProvinceName)).collect(Collectors.toList());
list = stationCacheInfoDtoList.stream().filter(
stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(finalProvinceName))
.collect(Collectors.toList());
}
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(
new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
for (int i = 0; i < list.size(); i++) {
HashMap<String, Double> hashMap = new HashMap<>();
StationCacheInfoDto stationCacheInfoDto = list.get(i);
......@@ -261,32 +310,61 @@ public class MonitorServiceImpl implements MonitorService {
regionNationWideDto.setStaitionType(stationCacheInfoDto.getStationType());
String speendOrirradiate = "0.00";
regionNationWideDto.setStationCapacity(stationCacheInfoDto.getInstalledCapacity());
if (stationCacheInfoDto.getStationType().equals("FDZ") && stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName()) || coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName())).collect(Collectors.toList());
if (stationCacheInfoDto.getStationType().equals("FDZ")
&& stationCacheInfoDto.getStationCoreName() != null
&& stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(
coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName())
|| coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName()))
.collect(Collectors.toList());
if (coreValuesDtoList != null && coreValuesDtoList.size() > 0) {
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.WIND_SPEED_THIRTY_SECONDS));
}else {
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream().filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(stationCacheInfoDto.getStationName().replace("电站","").replace("电场",""))).findFirst().get();
speendOrirradiate =String.format(CommonConstans.Twodecimalplaces, buDunStationDetailInfo.getWind_as_irradiance());
}
} else if (stationCacheInfoDto.getStationType().contains("GFDZ") && stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName()) || coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName())).collect(Collectors.toList());
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService
.getAverageOfByPointName(coreValuesDtoList, CommonConstans.WIND_SPEED_THIRTY_SECONDS));
} else {
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream()
.filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(
stationCacheInfoDto.getStationName().replace("电站", "").replace("电场", "")))
.findFirst().get();
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces,
buDunStationDetailInfo.getWind_as_irradiance());
}
} else if (stationCacheInfoDto.getStationType().contains("GFDZ")
&& stationCacheInfoDto.getStationCoreName() != null
&& stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(
coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName())
|| coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName()))
.collect(Collectors.toList());
if (coreValuesDtoList != null && coreValuesDtoList.size() > 0) {
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService.getAverageOfByPointName(coreValuesDtoList, CommonConstans.TOTAL_RADIATION));
}else {
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream().filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(stationCacheInfoDto.getStationName().replace("电站","").replace("电场",""))).findFirst().get();
speendOrirradiate =String.format(CommonConstans.Twodecimalplaces,buDunStationDetailInfo.getWind_as_irradiance());
}
}
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream().filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(stationCacheInfoDto.getStationName().replace("风电站","").replace("风电场","").replace("光伏电站",""))).findFirst().orElse(null);
if(!ObjectUtils.isEmpty(buDunStationDetailInfo)&&!ObjectUtils.isEmpty(buDunStationDetailInfo.getWind_as_irradiance())){
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService
.getAverageOfByPointName(coreValuesDtoList, CommonConstans.TOTAL_RADIATION));
} else {
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream()
.filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(
stationCacheInfoDto.getStationName().replace("电站", "").replace("电场", "")))
.findFirst().get();
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces,
buDunStationDetailInfo.getWind_as_irradiance());
}
}
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream()
.filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name()
.contains(stationCacheInfoDto.getStationName().replace("风电站", "").replace("风电场", "")
.replace("光伏电站", "")))
.findFirst().orElse(null);
if (!ObjectUtils.isEmpty(buDunStationDetailInfo)
&& !ObjectUtils.isEmpty(buDunStationDetailInfo.getWind_as_irradiance())) {
speendOrirradiate = buDunStationDetailInfo.getWind_as_irradiance().toString();
if(ObjectUtils.isEmpty(regionNationWideDto.getStationCapacity())&&!ObjectUtils.isEmpty(buDunStationDetailInfo.getActual_installed_capacity())){
regionNationWideDto.setStationCapacity(buDunStationDetailInfo.getActual_installed_capacity().toString());
if (ObjectUtils.isEmpty(regionNationWideDto.getStationCapacity())
&& !ObjectUtils.isEmpty(buDunStationDetailInfo.getActual_installed_capacity())) {
regionNationWideDto
.setStationCapacity(buDunStationDetailInfo.getActual_installed_capacity().toString());
}
}
regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> String.valueOf(stationCoordinate1.getStationId()).equals(stationCacheInfoDto.getStationId())).collect(Collectors.toList()).get(0);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> String
.valueOf(stationCoordinate1.getStationId()).equals(stationCacheInfoDto.getStationId()))
.collect(Collectors.toList()).get(0);
hashMap.put("lng", Double.valueOf(stationCoordinate.getLongitude()));
hashMap.put("lat", Double.valueOf(stationCoordinate.getLaitude()));
regionNationWideDto.setPosition(hashMap);
......@@ -302,7 +380,8 @@ public class MonitorServiceImpl implements MonitorService {
return regionNationWideDtoList;
}
public void getCompletionOfPowerIndicatorsByCurrentData(List<StationCacheInfoDto> stationBasicList, String provinceName) {
public void getCompletionOfPowerIndicatorsByCurrentData(List<StationCacheInfoDto> stationBasicList,
String provinceName) {
String provinceNameTopic = "";
if (provinceName.contains("黑龙江") || provinceName.contains("内蒙古")) {
provinceNameTopic = provinceName.substring(0, 3);
......@@ -312,7 +391,8 @@ public class MonitorServiceImpl implements MonitorService {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("title", provinceNameTopic + "区域");
try {
emqKeeper.getMqttClient().publish(provinceName + "_proviceName_topic", JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_proviceName_topic",
JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
log.info("----------------------------------推送省份名称消息成功败--------------------------------");
} catch (Exception e) {
log.info("----------------------------------推送省份名称消息失败--------------------------------");
......@@ -323,13 +403,20 @@ public class MonitorServiceImpl implements MonitorService {
List<ColModel> colModels = new ArrayList<>();
List<CompletionOfPowerIndicatorsDto> completionOfPowerIndicatorsDtoList = new ArrayList<>();
ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid", "stationName");
ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量", "dataGrid", "installCapactity");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance", "风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid", "activePower");
ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid", "dailyPower");
ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid", "monthlyPower");
ColModel colModelAnnualPower = new ColModel("annualPower", "annualPower", "年发电量", "年发电量", "dataGrid", "annualPower");
ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid",
"stationName");
ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量",
"dataGrid", "installCapactity");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance",
"风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid",
"activePower");
ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid",
"dailyPower");
ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid",
"monthlyPower");
ColModel colModelAnnualPower = new ColModel("annualPower", "annualPower", "年发电量", "年发电量", "dataGrid",
"annualPower");
colModels.add(colModelStatitonName);
colModels.add(colModelInstallCapactity);
colModels.add(colModelWindSpeedOrIrradiance);
......@@ -338,52 +425,74 @@ public class MonitorServiceImpl implements MonitorService {
colModels.add(colModelMonthlyPower);
colModels.add(colModelAnnualPower);
List<StationCacheInfoDto> stationCacheInfoDtoList = this.getListStationCacheInfoDto();
List<StationCacheInfoDto> stationCacheInfoDtos = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(provinceName)).collect(Collectors.toList());
List<StationCacheInfoDto> stationCacheInfoDtos = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(provinceName))
.collect(Collectors.toList());
if (ObjectUtils.isEmpty(stationCacheInfoDtos)) {
DataGridMock dataGridMock = new DataGridMock(current, 0, false, 1, null);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
return resultsData;
}
//日发电量
// 日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
// 年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
// 年发电量完成比例
String completionRatio = "0.00";
//年利用小时数
// 年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.0);
AtomicReference<Double> installCapacity = new AtomicReference<>(0.0);
AtomicReference<Double> fdzInstallCapacity = new AtomicReference<>(0.0);
AtomicReference<Double> gfzinstallCapacity = new AtomicReference<>(0.0);
//年发电量
// 年发电量
AtomicReference<Double> fdzannualPower = new AtomicReference<>(0.0);
AtomicReference<Double> gfzannualPower = new AtomicReference<>(0.0);
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&provinceName=" + provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
String requestUrl = Constants.BASE_URL + "?" + Constants.get_province_station_item + "&provinceName="
+ provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl,
Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
if (buDunStationDetailInfos.size() > 0) {
buDunStationDetailInfos.forEach(buDunStationDetailInfo -> {
CompletionOfPowerIndicatorsDto completionOfPowerIndicatorsDto = new CompletionOfPowerIndicatorsDto();
completionOfPowerIndicatorsDto.setStationName(buDunStationDetailInfo.getStation_name());
completionOfPowerIndicatorsDto.setInstallCapactity(String.valueOf(buDunStationDetailInfo.getActual_installed_capacity()));
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(!ObjectUtils.isEmpty(buDunStationDetailInfo.getWind_as_irradiance())?String.format(CommonConstans.Twodecimalplaces, buDunStationDetailInfo.getWind_as_irradiance()):"--");
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, buDunStationDetailInfo.getDay()));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, buDunStationDetailInfo.getMonth()));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, buDunStationDetailInfo.getYear()));
StationCacheInfoDto stationCacheInfoDto = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto1 -> stationCacheInfoDto1.getStationName().contains(buDunStationDetailInfo.getStation_name().replace("电场","").replace("电站","").replace("光伏电站",""))).findFirst().orElse(null);
if (!ObjectUtils.isEmpty(stationCacheInfoDto)&&stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName()) || coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName())).collect(Collectors.toList());
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (coreCommonService.getSumOfByPointName(coreValuesDtoList, CommonConstans.ACTIVE_POWER))));
}else {
completionOfPowerIndicatorsDto
.setInstallCapactity(String.valueOf(buDunStationDetailInfo.getActual_installed_capacity()));
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(
!ObjectUtils.isEmpty(buDunStationDetailInfo.getWind_as_irradiance()) ? String
.format(CommonConstans.Twodecimalplaces, buDunStationDetailInfo.getWind_as_irradiance())
: "--");
completionOfPowerIndicatorsDto.setDailyPower(
String.format(CommonConstans.Fourdecimalplaces, buDunStationDetailInfo.getDay()));
completionOfPowerIndicatorsDto.setMonthlyPower(
String.format(CommonConstans.Fourdecimalplaces, buDunStationDetailInfo.getMonth()));
completionOfPowerIndicatorsDto.setAnnualPower(
String.format(CommonConstans.Fourdecimalplaces, buDunStationDetailInfo.getYear()));
StationCacheInfoDto stationCacheInfoDto = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto1 -> stationCacheInfoDto1.getStationName()
.contains(buDunStationDetailInfo.getStation_name().replace("电场", "").replace("电站", "")
.replace("光伏电站", "")))
.findFirst().orElse(null);
if (!ObjectUtils.isEmpty(stationCacheInfoDto) && stationCacheInfoDto.getStationCoreName() != null
&& stationCacheInfoDto.getBoosterCoreName() != null) {
List<CoreValuesDto> coreValuesDtoList = coreValuesDtos.stream().filter(
coreValuesDto -> coreValuesDto.getName().equals(stationCacheInfoDto.getStationCoreName())
|| coreValuesDto.getName().equals(stationCacheInfoDto.getBoosterCoreName()))
.collect(Collectors.toList());
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces,
(coreCommonService.getSumOfByPointName(coreValuesDtoList, CommonConstans.ACTIVE_POWER))));
} else {
completionOfPowerIndicatorsDto.setActivePower("--");
}
completionOfPowerIndicatorsDtoList.add(completionOfPowerIndicatorsDto);
});
}
String provincelUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&provinceName=" + provinceName;
List<BuDunGenDto> provinceDtos = httpRequestUtil.getResPonse(provincelUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
String provincelUrl = Constants.BASE_URL + "?" + Constants.get_province_item_url + "&provinceName="
+ provinceName;
List<BuDunGenDto> provinceDtos = httpRequestUtil.getResPonse(provincelUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
if (provinceDtos.size() > 0) {
BuDunGenDto buDunGenDto = provinceDtos.get(0);
dailyPower.set(buDunGenDto.getDay());
......@@ -415,12 +524,16 @@ public class MonitorServiceImpl implements MonitorService {
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
Integer allsize = completionOfPowerIndicatorsDtoList.size();
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1, completionOfPowerIndicatorsDtoList);
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1,
completionOfPowerIndicatorsDtoList);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
try {
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_list_topic", JSON.toJSON(resultsData).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
log.info("-----------------发送区域实时生产数据消息=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_list_topic",
JSON.toJSON(resultsData).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_topic",
JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
log.info("-----------------发送区域实时生产数据消息=================== 成功!"
+ JSON.toJSONString(socialContributionDtoPage));
} catch (Exception exception) {
log.error("-----------------发送区域实时生产数据消息=================== 失败!");
}
......@@ -434,24 +547,34 @@ public class MonitorServiceImpl implements MonitorService {
*/
public List<StationCacheInfoDto> getListStationCacheInfoDto() {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL_", 1));
List<Region> regionList = regionMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
for (int i = 0; i < stationBasicList.size(); i++) {
StationBasic stationBasic = stationBasicList.get(i);
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName());
stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongProvince(regionList.stream()
.filter(region -> region.getRegionCode().toString()
.equals(stationBasic.getBelongArea().replace("[", "").split(",")[0]))
.map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince()
.contains(stationCacheInfoDto.getBelongProvince().substring(0, 2))
|| mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3)))
.map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
Double installedCapacity = 0.0d;
if (!ObjectUtils.isEmpty(stationBasic.getInstalledCapacity())) {
installedCapacity = stationBasic.getInstalledCapacity();
}
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", installedCapacity));
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince()
.contains(stationCacheInfoDto.getBelongProvince().substring(0, 2))
|| mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3)))
.map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDto.setBoosterCoreName(stationBasic.getBoosterCoreName());
stationCacheInfoDto.setStationCoreName(stationBasic.getStationCoreName());
......@@ -467,14 +590,22 @@ public class MonitorServiceImpl implements MonitorService {
HashMap<String, String> hashMap = new HashMap<>();
Double total = 0.00;
if (!ObjectUtils.isEmpty(areaName)) {
stationCacheInfoDtoList = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName) && stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null).collect(Collectors.toList());
stationCacheInfoDtoList = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName)
&& stationCacheInfoDto.getStationCoreName() != null
&& stationCacheInfoDto.getBoosterCoreName() != null)
.collect(Collectors.toList());
List<String> stationNames = new ArrayList<>();
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getStationCoreName).collect(Collectors.toList()));
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getBoosterCoreName).collect(Collectors.toList()));
coreValuesDtos = coreValuesDtos.stream().filter(coreValuesDto -> stationNames.contains(coreValuesDto.getName())).collect(Collectors.toList());
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getStationCoreName)
.collect(Collectors.toList()));
stationNames.addAll(stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getBoosterCoreName)
.collect(Collectors.toList()));
coreValuesDtos = coreValuesDtos.stream()
.filter(coreValuesDto -> stationNames.contains(coreValuesDto.getName()))
.collect(Collectors.toList());
}
total = coreCommonService.getSumOfByPointName(coreValuesDtos, CommonConstans.ACTIVE_POWER);
//有功功率换算
// 有功功率换算
hashMap.put("title", String.format(CommonConstans.Twodecimalplaces, total));
return hashMap;
}
......@@ -487,20 +618,22 @@ public class MonitorServiceImpl implements MonitorService {
String requestUrl = Constants.BASE_URL + "?" + Constants.get_area_item_url;
if (!ObjectUtils.isEmpty(areaName)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName =areaName+ Constants.areaChinese;
areaName = areaName + Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
//日发电量
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// 日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
// 年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
AtomicReference<Double> totalPower = new AtomicReference<>(0.0);
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
if (buDunGenDtos.size() > 0) {
BuDunGenDto buDunGenDto = buDunGenDtos.get(0);
dailyPower.set(buDunGenDto.getDay());
......@@ -536,7 +669,8 @@ public class MonitorServiceImpl implements MonitorService {
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunGenDto.class);
if (buDunGenDtos.size() > 0) {
BuDunGenDto buDunGenDto = buDunGenDtos.get(0);
total.set(buDunGenDto.getCumulative());
......@@ -549,9 +683,12 @@ public class MonitorServiceImpl implements MonitorService {
List<StationCacheInfoDto> stationCacheInfoDtoList = this.getListStationCacheInfoDto();
Double total = 0.0;
if (!ObjectUtils.isEmpty(areaName)) {
stationCacheInfoDtoList = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName)).collect(Collectors.toList());
stationCacheInfoDtoList = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName))
.collect(Collectors.toList());
}
total = stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getInstalledCapacity).collect(Collectors.toList()).stream().mapToDouble(Double::parseDouble).sum();
total = stationCacheInfoDtoList.stream().map(StationCacheInfoDto::getInstalledCapacity)
.collect(Collectors.toList()).stream().mapToDouble(Double::parseDouble).sum();
hashMap.put("title", String.format(CommonConstans.Twodecimalplaces, total));
return hashMap;
}
......@@ -563,12 +700,14 @@ public class MonitorServiceImpl implements MonitorService {
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
// 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
// 变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL_", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
Region region = regionMapper.selectOne(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1)
.like(Region::getRegionName, stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
return stationBasicListAll;
......@@ -584,7 +723,8 @@ public class MonitorServiceImpl implements MonitorService {
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
List<BudunStationValueDto> budunStationValueDtoList = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BudunStationValueDto.class);
List<BudunStationValueDto> budunStationValueDtoList = httpRequestUtil.getResPonse(requestUrl,
Constants.REQUEST_GET, "", Constants.resovleRule_data, BudunStationValueDto.class);
HashMap<String, List<String>> hashMap = new HashMap<>();
budunStationValueDtoList.forEach(budunStationValueDto -> {
HashMap<String, String> hashMap1 = new HashMap<>();
......@@ -601,25 +741,22 @@ public class MonitorServiceImpl implements MonitorService {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
//获取所有网关id不为空的数据
// 获取所有网关id不为空的数据
//二氧化碳贡献数
// 二氧化碳贡献数
SocialContributionDto co2 = new SocialContributionDto();
//标准煤贡献度
// 标准煤贡献度
SocialContributionDto coal = new SocialContributionDto();
//碳粉尘计算公式
// 碳粉尘计算公式
SocialContributionDto toner = new SocialContributionDto();
//二氧化硫贡献度
// 二氧化硫贡献度
SocialContributionDto so2 = new SocialContributionDto();
/** 社会贡献原始计算公式,后边的数据已经经过处理
发电量完成率=(月/年)发电量/(月/年)发电量指标
小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
二氧化碳减排量(万t)=发电量(万kW·h)*0.79
节约标准煤(万t)=发电量(万kW·h)*0.29
炭粉尘减排量(t)=发电量(万kW·h)*0.30
二氧化硫减排量(t)=发电量(万kW·h)*1.51
氮氧化物减排量(t)=发电量(万kW·h)*1.69
/**
* 社会贡献原始计算公式,后边的数据已经经过处理 发电量完成率=(月/年)发电量/(月/年)发电量指标
* 小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标 可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
* 二氧化碳减排量(万t)=发电量(万kW·h)*0.79 节约标准煤(万t)=发电量(万kW·h)*0.29
* 炭粉尘减排量(t)=发电量(万kW·h)*0.30 二氧化硫减排量(t)=发电量(万kW·h)*1.51
* 氮氧化物减排量(t)=发电量(万kW·h)*1.69
*/
co2.setUnit(CommonConstans.ER_YANG_HUA_TAN_JIANPAILIANG);
co2.setTitle(String.format("%.2f", totalSocialContribution * CommonConstans.carbonDioxide));
......@@ -639,7 +776,8 @@ public class MonitorServiceImpl implements MonitorService {
return socialContributionDtoPage;
}
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue,
String areaName) {
Page<HashMap<String, String>> page = new Page<>(1, 3);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> fdzList = new ArrayList<>();
......@@ -651,10 +789,12 @@ public class MonitorServiceImpl implements MonitorService {
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
List<BuDunPvFanDto> buDunPvFanDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunPvFanDto.class);
List<BuDunPvFanDto> buDunPvFanDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "",
Constants.resovleRule_data, BuDunPvFanDto.class);
if (buDunPvFanDtos.size() > 0) {
BuDunPvFanDto buDunPvFanDto = buDunPvFanDtos.get(0);
int length = buDunPvFanDto.getFan().size() >= buDunPvFanDto.getPv().size() ? buDunPvFanDto.getFan().size() : buDunPvFanDto.getPv().size();
int length = buDunPvFanDto.getFan().size() >= buDunPvFanDto.getPv().size() ? buDunPvFanDto.getFan().size()
: buDunPvFanDto.getPv().size();
for (int i = 0; i < length; i++) {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("sortNumber", String.valueOf(i + 1));
......@@ -679,9 +819,8 @@ public class MonitorServiceImpl implements MonitorService {
}
page.setRecords(mapList);
//组装数据
// 组装数据
return page;
}
}
......@@ -120,7 +120,7 @@ public class MonitoringServiceIMQTTmpl {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level_", 1).eq("region_name", "江西省"));
Region region = this.regionMapper.selectOne(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1).eq(Region::getRegionName, "江西省"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()).isNotNull("fan_gateway_id"));
int year = Calendar.getInstance().get(Calendar.YEAR);
List<Long> fdz = stationBasicList.stream().map(StationBasic::getSequenceNbr).collect(Collectors.toList());
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RegionDto;
......@@ -38,6 +39,6 @@ public class RegionServiceImpl extends BaseService<RegionDto,Region,RegionMapper
}
//根据regionName获取regionCode
public Region getRegionCodeByRegionName(String regionName) {
return this.getOne(new QueryWrapper<Region>().like("REGION_NAME",regionName).eq("LEVEL_",1));
return this.getOne(new LambdaQueryWrapper<Region>().like(Region::getRegionName,regionName).eq(Region::getLevel,1));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
......@@ -386,7 +388,7 @@ public class CommonServiceImpl {
*/
public List<StationCacheInfoDto> getListStationCacheInfoDto() {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL_", 1));
List<Region> regionList = regionMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
for (int i = 0; i < stationBasicList.size(); i++) {
......
......@@ -30,7 +30,6 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
public class MonitoringServiceImpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
......@@ -60,11 +59,10 @@ public class MonitoringServiceImpl {
@Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
//维护的接口信息
// 维护的接口信息
@Autowired
MapRegionMapper mapRegionMapper;
......@@ -75,7 +73,6 @@ public class MonitoringServiceImpl {
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
* 根据场站编号获取该场站的装机容量
*
......@@ -91,17 +88,25 @@ public class MonitoringServiceImpl {
public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
List<StationCacheInfoDto> stationCacheInfoDtoList = commonServiceImpl.getListStationCacheInfoDto();
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level_", 1));
List<Region> regionList = this.regionMapper
.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
List<StationCacheInfoDto> list = new ArrayList<>();
//如果 provinceName 为空则表示当前为全国地图 否则则为省份地图
// 如果 provinceName 为空则表示当前为全国地图 否则则为省份地图
// if (ObjectUtils.isEmpty(provinceName) || provinceName.equals("")) {
if ((!ObjectUtils.isEmpty(type) && type.equals("gis")) && (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
if ((!ObjectUtils.isEmpty(type) && type.equals("gis"))
&& (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
for (int i = 0; i < regionList.size(); i++) {
RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
Region region = regionList.get(i);
list = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(region.getRegionName())).collect(Collectors.toList());
List<StationCacheInfoDto> fdlist = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> gflist = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
list = stationCacheInfoDtoList.stream().filter(
stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(region.getRegionName()))
.collect(Collectors.toList());
List<StationCacheInfoDto> fdlist = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
List<StationCacheInfoDto> gflist = list.stream()
.filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
if (list.size() > 0) {
regionNationWideDto.setJsJoin(true);
} else {
......@@ -109,8 +114,14 @@ public class MonitoringServiceImpl {
}
regionNationWideDto.setFengdian(String.valueOf(fdlist.size()));
regionNationWideDto.setGuangfu(String.valueOf(gflist.size()));
regionNationWideDto.setGuangfuMW(String.format(CommonConstans.Twodecimalplaces, gflist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setFengdianMV(String.format(CommonConstans.Twodecimalplaces, fdlist.stream().mapToDouble(stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())).sum()));
regionNationWideDto.setGuangfuMW(String.format(CommonConstans.Twodecimalplaces,
gflist.stream().mapToDouble(
stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()))
.sum()));
regionNationWideDto.setFengdianMV(String.format(CommonConstans.Twodecimalplaces,
fdlist.stream().mapToDouble(
stationCacheInfoDto -> Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()))
.sum()));
regionNationWideDto.setName(region.getRegionName());
regionNationWideDtoList.add(regionNationWideDto);
}
......@@ -126,9 +137,12 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(type) && type.equals("station")) {
list = stationCacheInfoDtoList;
} else {
list = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(finalProvinceName)).collect(Collectors.toList());
list = stationCacheInfoDtoList.stream().filter(
stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(finalProvinceName))
.collect(Collectors.toList());
}
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(
new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
for (int i = 0; i < list.size(); i++) {
HashMap<String, Double> hashMap = new HashMap<>();
......@@ -140,21 +154,30 @@ public class MonitoringServiceImpl {
String speendOrirradiate = "";
regionNationWideDto.setStationCapacity(stationCacheInfoDto.getInstalledCapacity());
if (stationCacheInfoDto.getStationType().equals("FDZ")) {
//用于组装-es查询条件
// 用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, "WTX-801_25_WTX-801_总辐射"));
}
regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> String.valueOf(stationCoordinate1.getStationId()).equals(stationCacheInfoDto.getStationId())).collect(Collectors.toList()).get(0);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> String
.valueOf(stationCoordinate1.getStationId()).equals(stationCacheInfoDto.getStationId()))
.collect(Collectors.toList()).get(0);
hashMap.put("lng", Double.valueOf(stationCoordinate.getLongitude()));
hashMap.put("lat", Double.valueOf(stationCoordinate.getLaitude()));
regionNationWideDto.setPosition(hashMap);
......@@ -175,13 +198,20 @@ public class MonitoringServiceImpl {
List<ColModel> colModels = new ArrayList<>();
List<CompletionOfPowerIndicatorsDto> completionOfPowerIndicatorsDtoList = new ArrayList<>();
ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid", "stationName");
ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量", "dataGrid", "installCapactity");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance", "风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid", "activePower");
ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid", "dailyPower");
ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid", "monthlyPower");
ColModel colModelAnnualPower = new ColModel("annualPower", "annualPower", "年发电量", "年发电量", "dataGrid", "annualPower");
ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid",
"stationName");
ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量",
"dataGrid", "installCapactity");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance",
"风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid",
"activePower");
ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid",
"dailyPower");
ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid",
"monthlyPower");
ColModel colModelAnnualPower = new ColModel("annualPower", "annualPower", "年发电量", "年发电量", "dataGrid",
"annualPower");
colModels.add(colModelStatitonName);
colModels.add(colModelInstallCapactity);
colModels.add(colModelWindSpeedOrIrradiance);
......@@ -190,24 +220,27 @@ public class MonitoringServiceImpl {
colModels.add(colModelMonthlyPower);
colModels.add(colModelAnnualPower);
List<StationCacheInfoDto> stationCacheInfoDtoList = commonServiceImpl.getListStationCacheInfoDto();
List<StationCacheInfoDto> stationCacheInfoDtos = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(provinceName)).collect(Collectors.toList());
List<StationCacheInfoDto> stationCacheInfoDtos = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongProvince().equals(provinceName))
.collect(Collectors.toList());
if (ObjectUtils.isEmpty(stationCacheInfoDtos)) {
DataGridMock dataGridMock = new DataGridMock(current, 0, false, 1, null);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
return resultsData;
}
//日发电量
// 日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
// 年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
// 年发电量完成比例
String completionRatio = "0.00";
//年利用小时数
// 年利用小时数
List<StationPlan> fdzPlans = new ArrayList<>();
int year = Calendar.getInstance().get(Calendar.YEAR);
List<String> fdz = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
List<String> fdz = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId)
.collect(Collectors.toList());
LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationPlan::getYear, String.valueOf(year));
queryWrapper.in(StationPlan::getStationBasicId, fdz);
......@@ -219,55 +252,91 @@ public class MonitoringServiceImpl {
AtomicReference<Double> installCapacity = new AtomicReference<>(0.0);
AtomicReference<Double> fdzInstallCapacity = new AtomicReference<>(0.0);
AtomicReference<Double> gfzinstallCapacity = new AtomicReference<>(0.0);
//年发电量
// 年发电量
AtomicReference<Double> fdzannualPower = new AtomicReference<>(0.0);
AtomicReference<Double> gfzannualPower = new AtomicReference<>(0.0);
//遍历列表
// 遍历列表
stationCacheInfoDtos.forEach(stationCacheInfoDto -> {
CompletionOfPowerIndicatorsDto completionOfPowerIndicatorsDto = new CompletionOfPowerIndicatorsDto();
completionOfPowerIndicatorsDto.setStationName(stationCacheInfoDto.getStationName());
completionOfPowerIndicatorsDto.setInstallCapactity(stationCacheInfoDto.getInstalledCapacity());
try {
if (stationCacheInfoDto.getStationType().equals("FDZ")) {
//用于组装-es查询条件
// 用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>();
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null,
ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
completionOfPowerIndicatorsDto
.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto
.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl
.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
dailyPower.updateAndGet(v -> v
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzannualPower.updateAndGet(v -> v
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzInstallCapacity
.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射", "南瑞光差保护_313P"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("WTX-801_25_WTX-801_总辐射", "南瑞光差保护_313P"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class, null);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null,
ESEquipments.class);
completionOfPowerIndicatorsDto
.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P")
* CommonConstans.kwToMv));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto
.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl
.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl
.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzinstallCapacity
.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
}
} catch (Exception exception) {
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance("0");
......@@ -294,7 +363,9 @@ public class MonitoringServiceImpl {
completionRatioDto.setTitle(completionRatio);
completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(String.format(CommonConstans.Twodecimalplaces, (fdzannualPower.get() * CommonConstans.wkwhToMv / fdzInstallCapacity.get() + gfzannualPower.get() * CommonConstans.wkwhToMv / gfzinstallCapacity.get())));
useHoursDto.setTitle(String.format(CommonConstans.Twodecimalplaces,
(fdzannualPower.get() * CommonConstans.wkwhToMv / fdzInstallCapacity.get()
+ gfzannualPower.get() * CommonConstans.wkwhToMv / gfzinstallCapacity.get())));
useHoursDto.setUnit("h");
socialContributionDtoList.add(dailyPowerdto);
socialContributionDtoList.add(monthlyPowerdto);
......@@ -305,20 +376,24 @@ public class MonitoringServiceImpl {
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
Integer allsize = completionOfPowerIndicatorsDtoList.size();
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1, completionOfPowerIndicatorsDtoList);
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1,
completionOfPowerIndicatorsDtoList);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
try {
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_list_topic", JSON.toJSON(resultsData).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送区域实时生产数据消息=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_list_topic",
JSON.toJSON(resultsData).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_completion_of_powerindicator_topic",
JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送区域实时生产数据消息=================== 成功!"
+ JSON.toJSONString(socialContributionDtoPage));
} catch (Exception exception) {
logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
}
return resultsData;
}
public void getCompletionOfPowerIndicatorsByCurrentData(List<StationCacheInfoDto> stationBasicList, String provinceName) {
public void getCompletionOfPowerIndicatorsByCurrentData(List<StationCacheInfoDto> stationBasicList,
String provinceName) {
String provinceNameTopic = "";
if (provinceName.contains("黑龙江") || provinceName.contains("内蒙古")) {
provinceNameTopic = provinceName.substring(0, 3);
......@@ -328,7 +403,8 @@ public class MonitoringServiceImpl {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("title", provinceNameTopic + "区域");
try {
emqKeeper.getMqttClient().publish(provinceName + "_proviceName_topic", JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(provinceName + "_proviceName_topic",
JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
logger.info("----------------------------------推送省份名称消息成功败--------------------------------");
} catch (Exception e) {
logger.info("----------------------------------推送省份名称消息失败--------------------------------");
......@@ -461,34 +537,47 @@ public class MonitoringServiceImpl {
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL_", 1));
List<Region> regionList = regionMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
mapRegionList.forEach(mapRegion -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
// 开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList());
List<String> regionNames = regions.stream().map(region -> region.getRegionName()).collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList());
List<Region> regions = regionList.stream()
.filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2))
|| stringArrayList.contains(region.getRegionName().substring(0, 3)))
.collect(Collectors.toList());
List<String> regionNames = regions.stream().map(region -> region.getRegionName())
.collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode()))
.collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream()
.filter(stationBasic -> regionCodes
.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0]))
.collect(Collectors.toList());
mapAreaInfoDto.setProvince(regionNames);
// --------------------省份名称处理结束----------------------------
//设置片区名称
// 设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置片区code
// 设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
//分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
//储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
//获取装机容量
// 风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
// 集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
// 分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
// 储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
// 获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
//获取当日发电量
// 获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
......@@ -499,43 +588,61 @@ public class MonitoringServiceImpl {
public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL_", 1));
//根据areaName获取area信息
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = regionMapper.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
// 根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
// 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList());
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().eq("is_main_coordinate", 0));
List<Region> regions = regionList.stream()
.filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2))
|| stringArrayList.contains(region.getRegionName().substring(0, 3)))
.collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode()))
.collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream()
.filter(stationBasic -> regionCodes
.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0]))
.collect(Collectors.toList());
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper
.selectList(new QueryWrapper<StationCoordinate>().eq("is_main_coordinate", 0));
if (!stationBasicListAll.isEmpty()) {
stationBasicListAll.forEach(stationBasic -> {
HomeMapStationInfoDto homeMapStationInfoDto = new HomeMapStationInfoDto();
//设置场站id
// 设置场站id
homeMapStationInfoDto.setStationId(String.valueOf(stationBasic.getSequenceNbr()));
//设置场站类型
// 设置场站类型
homeMapStationInfoDto.setStationType(stationBasic.getStationType());
//设置装机容量
homeMapStationInfoDto.setStationInstalledCapacity(String.format(CommonConstans.Twodecimalplaces, getStationCaPACITYL(stationBasic.getStationNumber())));
//设置风速辐照度
// 设置装机容量
homeMapStationInfoDto.setStationInstalledCapacity(String.format(CommonConstans.Twodecimalplaces,
getStationCaPACITYL(stationBasic.getStationNumber())));
// 设置风速辐照度
List<Map<String, Object>> mapList;
List<Map<String, Object>> mapList1;
if (stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
// homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces,
// commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
queryCondtion1.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null,
ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(
String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(
esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
} else {
// Map<String, List<String>> queryCondtion = new HashMap<>();
......@@ -547,22 +654,29 @@ public class MonitoringServiceImpl {
//
// homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
Map<String, List<String>> queryCondtion2 = new HashMap<>();
queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion2.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null,
ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
}
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
//获取场站经纬度
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null,
ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
}
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(
stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr()))
.collect(Collectors.toList()).get(0);
// 获取场站经纬度
List<String> list = new ArrayList<>();
list.add(stationCoordinate.getLongitude());
list.add(stationCoordinate.getLaitude());
......@@ -595,15 +709,22 @@ public class MonitoringServiceImpl {
if ("FDZ".equals(stationBasic.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total.updateAndGet(v -> v
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList(CommonConstans.taiHeGenIndicatorDay));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl
.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
}
} catch (Exception e) {
......@@ -612,13 +733,14 @@ public class MonitoringServiceImpl {
});
return String.format(CommonConstans.Twodecimalplaces, total.get());
}
//获取社会贡献
// 获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果
* areaName 与stationId都传 则取场站id
*/
public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
......@@ -628,7 +750,8 @@ public class MonitoringServiceImpl {
} else if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
......@@ -636,15 +759,19 @@ public class MonitoringServiceImpl {
Double total1 = 0.00;
if (!stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear);
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
Double finalTotal = total1;
......@@ -658,9 +785,10 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
//月发电量
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
......@@ -669,14 +797,17 @@ public class MonitoringServiceImpl {
if (!stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
Double finalTotal = total;
......@@ -684,7 +815,8 @@ public class MonitoringServiceImpl {
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", String.format(CommonConstans.Twodecimalplaces, monthlyPower.get()));
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
String.format(CommonConstans.Twodecimalplaces, monthlyPower.get()));
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
......@@ -696,33 +828,46 @@ public class MonitoringServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtoList = new ArrayList<>();
stationCacheInfoDtoList = commonServiceImpl.getListStationCacheInfoDto();
if (!ObjectUtils.isEmpty(areaName)) {
stationCacheInfoDtoList = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName)).collect(Collectors.toList());
stationCacheInfoDtoList = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName))
.collect(Collectors.toList());
}
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
//日发电量
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// 日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
// 年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
stationCacheInfoDtoList.forEach( stationCacheInfoDto->{
stationCacheInfoDtoList.forEach(stationCacheInfoDto -> {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
dailyPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
});
HashMap<String, String> dayHashMap = new HashMap<>();
......@@ -744,26 +889,28 @@ public class MonitoringServiceImpl {
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
// 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
// 变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL_", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
Region region = regionMapper.selectOne(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1)
.like(Region::getRegionName, stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
return stationBasicListAll;
}
public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
//月发电量
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
......@@ -772,14 +919,17 @@ public class MonitoringServiceImpl {
if (!stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
Double finalTotal = total;
......@@ -787,50 +937,60 @@ public class MonitoringServiceImpl {
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", String.format(CommonConstans.Twodecimalplaces, monthlyPower.get() % 200));
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
String.format(CommonConstans.Twodecimalplaces, monthlyPower.get() % 200));
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
}
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationCacheInfoDto> stationCacheInfoDtoList = new ArrayList<>();
stationCacheInfoDtoList = commonServiceImpl.getListStationCacheInfoDto();
if (!ObjectUtils.isEmpty(areaName)) {
stationCacheInfoDtoList = stationCacheInfoDtoList.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName)).collect(Collectors.toList());
stationCacheInfoDtoList = stationCacheInfoDtoList.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getBelongArea().equals(areaName))
.collect(Collectors.toList());
}
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = new ArrayList<>();
List<String> yList = new ArrayList<>();
AtomicReference<Double> total = new AtomicReference<>(0.00);
//月发电量
// 月发电量
String finalIndicator = "月发电量";
stationCacheInfoDtoList.forEach(stationCacheInfoDto -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
if (!stationCacheInfoDto.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList(CommonConstans.taiHeGenIndicatorMonth));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
}
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get())*100/getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId())));
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces,
(total.get()) * 100 / getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId())));
});
List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator
.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed())
.collect(Collectors.toList());
sorted.forEach(stationBasic -> {
HashMap<String, String> hashMap1 = new HashMap<>();
hashMap1.put("stationName", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getAddress()+"%");
hashMap1.put("value", stationBasic.getAddress() + "%");
hashMap1.put("value1", stationBasic.getAddress());
mapList.add(hashMap1);
});
......@@ -838,7 +998,6 @@ public class MonitoringServiceImpl {
return hashMapPage;
}
public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
......@@ -851,8 +1010,8 @@ public class MonitoringServiceImpl {
return xList;
}
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue,
String areaName) {
Page<HashMap<String, String>> page = new Page<>(1, 3);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
......@@ -861,7 +1020,8 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
AtomicReference<String> indicator = new AtomicReference<>("日发电量");
if (tabValue.equals("1")) {
......@@ -869,7 +1029,7 @@ public class MonitoringServiceImpl {
} else if (tabValue.equals("2")) {
indicator.set("年发电量");
}
//填写发电小时数
// 填写发电小时数
stationBasicListAll.forEach(stationBasic -> {
Double install1 = getStationCaPACITYL(stationBasic.getStationNumber());
BigDecimal gfInstall = new BigDecimal(String.format("%.2f", install1));
......@@ -884,25 +1044,37 @@ public class MonitoringServiceImpl {
}
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue()));
stationBasic
.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue()));
if (stationBasic.getAddress().equals("NaN")) {
stationBasic.setAddress("0.00");
}
});
//分组并排序
fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
gfdzlist = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
// 分组并排序
fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble))
.reversed())
.collect(Collectors.toList());
gfdzlist = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble))
.reversed())
.collect(Collectors.toList());
for (int i = 0; i < 3; i++) {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("sortNumber", String.valueOf(i + 1));
......@@ -926,21 +1098,22 @@ public class MonitoringServiceImpl {
mapList.add(stringHashMap);
}
page.setRecords(mapList);
//组装数据
// 组装数据
return page;
}
public void getTotalData() {
//计算所有场站年计划完成量
// 计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ"))
.mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
//查询风电站年计划完成量
// 查询风电站年计划完成量
//
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
......@@ -950,37 +1123,41 @@ public class MonitoringServiceImpl {
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream()
.filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list = new ArrayList<>();
//装机容量
// 装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
stringHashMap.put("title", totalInstall.toString());
stringHashMap.put("data", "");
list.add(stringHashMap);
//风电站
// 风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
//集中式光伏电站
// 集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2);
//分布式光伏电站
// 分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString());
......@@ -1004,36 +1181,52 @@ public class MonitoringServiceImpl {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
powerOfDayFD = powerOfDayFD
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD
+ keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}
for (int i = 0; i < gfList.size(); i++) {
StationBasic stationBasic = gfList.get(i);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/"
+ String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfMonthGF));
stringHashMap5.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD) + "/"
+ String.format(CommonConstans.Fourdecimalplaces, powerOfMonthGF));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualGF));
stringHashMap6.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD) + "/"
+ String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualGF));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD * 100) / fdzValue) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF * 100) / gfvalue));
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD * 100) / fdzValue)
+ "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF * 100) / gfvalue));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
stringHashMap8.put("title",
String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/"
+ String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualGF * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
......@@ -1043,35 +1236,45 @@ public class MonitoringServiceImpl {
stringHashMap10.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD + powerOfMonthGF));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD + powerOfAnnualGF));
stringHashMap11.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD + powerOfAnnualGF));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, ((powerOfAnnualFD + powerOfAnnualGF) * 100) / yearValue));
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces,
((powerOfAnnualFD + powerOfAnnualGF) * 100) / yearValue));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD + powerOfAnnualGF);
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide )));
stringHashMap13.put("title1",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("title2", "二氧化碳减排量(t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal )));
stringHashMap14.put("title1",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("title2", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner )));
stringHashMap15.put("title1",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner)));
stringHashMap15.put("title2", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide )));
stringHashMap16.put("title1",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide)));
stringHashMap16.put("title2", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("total_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("total_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1,
true);
} catch (Exception ex) {
}
......@@ -1079,34 +1282,45 @@ public class MonitoringServiceImpl {
public List<HashMap<String, Object>> getNationalPowerGenerationData() {
List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
if (stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces,
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
});
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> fdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
resultHashMap.add(getTableByStationListAndTitle("风电年发电量 (万kWh)", fdzList, "#0060ff"));
resultHashMap.add(getTableByStationListAndTitle("分布式光伏年发电量 (万kWh)", fbsgfdzList, "#fdaa04"));
resultHashMap.add(getTableByStationListAndTitle("集中式光伏年发电量 (万kWh)", jzsgfdzList, "#ec18f7"));
return resultHashMap;
}
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList, String color) {
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList,
String color) {
HashMap<String, Object> hashMap = new HashMap<>();
List<String> xData = new ArrayList<>();
List<String> yData = new ArrayList<>();
......@@ -1123,13 +1337,17 @@ public class MonitoringServiceImpl {
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level_", 1));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper
.selectList(new LambdaQueryWrapper<Region>().eq(Region::getLevel, 1));
regionList.forEach(region -> {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("label", region.getRegionName());
hashMap.put("value", region.getRegionCode());
List<HashMap<String, Object>> children = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).map(stationBasic -> {
List<HashMap<String, Object>> children = stationBasicList.stream().filter(
stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())))
.map(stationBasic -> {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("label", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getSequenceNbr());
......@@ -1163,17 +1381,20 @@ public class MonitoringServiceImpl {
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<IndicatorData> indicatorDataList = new ArrayList<>();
if (stationBasic.getStationType().equals("FDZ")) {
indicatorDataList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值", date + " 00:00:00", date + " 23:59:59", stationBasic.getBoosterGatewayId());
indicatorDataList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
"220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值", date + " 00:00:00", date + " 23:59:59",
stationBasic.getBoosterGatewayId());
} else {
indicatorDataList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime("南瑞光差保护_313P", date + " 00:00:00", date + " 23:59:59", stationBasic.getBoosterGatewayId());
indicatorDataList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime("南瑞光差保护_313P",
date + " 00:00:00", date + " 23:59:59", stationBasic.getBoosterGatewayId());
}
//x轴数据
// x轴数据
List<String> xdata = new ArrayList<>();
//实时有功功率
// 实时有功功率
List<String> currentPowerYdata = new ArrayList<>();
//短期功率预测
// 短期功率预测
List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测
// 超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
if (ObjectUtils.isEmpty(indicatorDataList)) {
for (int i = 0; i < 25; i++) {
......@@ -1205,7 +1426,8 @@ public class MonitoringServiceImpl {
superShortPowerHashMap.put("yData", superPowerShortYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format(CommonConstans.Twodecimalplaces, currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String currentMin = String.format(CommonConstans.Twodecimalplaces,
currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
// String shortMin = String.format(CommonConstans.Twodecimalplaces, shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
// String supreMin = String.format(CommonConstans.Twodecimalplaces, superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
......@@ -1217,7 +1439,8 @@ public class MonitoringServiceImpl {
gz.add("0");
sj1.add("0:00");
String currentMax = String.format(CommonConstans.Twodecimalplaces, currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String currentMax = String.format(CommonConstans.Twodecimalplaces,
currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
// String shortMax = String.format(CommonConstans.Twodecimalplaces, shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
// String supreMax = String.format(CommonConstans.Twodecimalplaces, superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
......@@ -1228,7 +1451,8 @@ public class MonitoringServiceImpl {
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add("0:00");
sj2.add("0:00");
String currentAvg = String.format(CommonConstans.Twodecimalplaces, currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
String currentAvg = String.format(CommonConstans.Twodecimalplaces,
currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
// String shortAvg = String.format(CommonConstans.Twodecimalplaces, shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
// String supreAvg = String.format(CommonConstans.Twodecimalplaces, superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
List<String> pjz = new ArrayList<>();
......@@ -1250,7 +1474,8 @@ public class MonitoringServiceImpl {
public HashMap<String, String> getSecDays(String secStartDate) {
HashMap<String, String> result = new HashMap<>();
result.put("title", String.valueOf(DateUtil.between(DateUtil.parse(secStartDate), DateUtil.date(), DateUnit.DAY)));
result.put("title",
String.valueOf(DateUtil.between(DateUtil.parse(secStartDate), DateUtil.date(), DateUnit.DAY)));
return result;
}
......@@ -1260,9 +1485,11 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream()
.collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
stringStringMap.put("name", key);
......@@ -1272,7 +1499,7 @@ public class MonitoringServiceImpl {
return result;
}
//获取装机容量
// 获取装机容量
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
......@@ -1280,7 +1507,8 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
......@@ -1289,7 +1517,7 @@ public class MonitoringServiceImpl {
return hashMap;
}
//获取有功功率
// 获取有功功率
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
......@@ -1300,24 +1528,32 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
if (stationBasic.getStationType().equals("FDZ")) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList,
"220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
} else {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")*CommonConstans.kwToMv);
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null,
ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")
* CommonConstans.kwToMv);
}
});
//有功功率换算
// 有功功率换算
hashMap.put("title", String.format(CommonConstans.Twodecimalplaces, total.get()));
return hashMap;
}
......@@ -1325,8 +1561,10 @@ public class MonitoringServiceImpl {
public Double keepFourdecimalPlaces(Double param) {
return Double.valueOf(String.format("%.4f", param));
}
public Double getPlanGenByStationIdAndMonth(String stationId){
String [] dates = DateUtil.today().split("-");
return stationPlanMapper.getPlanGenByStationIdAndMonth(stationId,dates[0], String.valueOf(Integer.valueOf(dates[1])));
public Double getPlanGenByStationIdAndMonth(String stationId) {
String[] dates = DateUtil.today().split("-");
return stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0],
String.valueOf(Integer.valueOf(dates[1])));
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RegionDto;
......@@ -38,6 +39,6 @@ public class RegionServiceImpl extends BaseService<RegionDto,Region,RegionMapper
}
//根据regionName获取regionCode
public Region getRegionCodeByRegionName(String regionName) {
return this.getOne(new QueryWrapper<Region>().like("REGION_NAME",regionName).eq("LEVEL_",1));
return this.getOne(new LambdaQueryWrapper<Region>().like(Region::getRegionName,regionName).eq(Region::getLevel,1));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment