Commit 2c0e8764 authored by tangwei's avatar tangwei

解决冲突

parents aefdb796 14d16bea
package com.yeejoin.amos.boot.module.jxiop.biz.constants;
import java.util.HashMap;
public class CommonConstans {
//光伏发电量系数
public static final Double pvGenPoweActor = 0.000001;
// 风电站:
// (日/月/年)发电量=场站所有风机(日/月/年)发电量总和
// 装机容量=场站所有风机装机容量总和
//
// 光伏站:
// (日/月/年)发电量=场站所有逆变器(日/月/年)发电量总和
// 装机容量=场站所有逆变器装机容量总和
//
// 通用:
// 发电量完成率=(月/年)发电量/(月/年)发电量指标
// 小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
// 可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
// 二氧化碳减排量(万t)=发电量(万kW·h)*0.79
public static final Double carbonDioxide = 0.79;
// 节约标准煤(万t)=发电量(万kW·h)*0.29
public static final Double standardCoal = 0.29;
// 炭粉尘减排量(t)=发电量(万kW·h)*0.30
public static final Double toner = 0.30;
// 二氧化硫减排量(t)=发电量(万kW·h)*1.51
public static final Double sulfurDioxide = 1.51;
// 氮氧化物减排量(t)=发电量(万kW·h)*1.69
public static final Double oxynitride = 1.69;
//吨转万吨
public static final Double tToWT = 0.0001;
//万Kwh转MV
public static final Integer wkwhToMv = 10;
// 正常运行 发电状态=1
// 告警运行 报警状态=1
// 正常停机 停机状态=1
// 故障停机 故障状态=1
// 限功率
// 待机状态 待机状态=1
// 维护状态 维护状态=1
// 通讯中断
public static final HashMap<String, String> fanStatus = new HashMap<String, String>() {
{
put("发电状态", "正常运行");
put("报警状态", "报警运行");
put("停机状态", "停机状态");
put("故障状态", "故障状态");
put("待机状态", "待机状态");
put("维护状态", "维护状态");
put("限功率", "限功率");
put("通讯中断", "通讯中断");
}
};
// 正常运行 运行=1
// 正常停机 停机=1
// 限功率 限额运行=1
// 限电停机 降额运行=1
// 告警运行 告警运行=1
// 故障停机 故障停机=1
// 待机状态 待机=1
// 通讯中断 通讯故障=1
public static final HashMap<String, String> pvStatus = new HashMap<String, String>() {
{
put("运行", "正常运行");
put("停机", "正常停机");
put("限额运行", "限功率");
put("降额运行", "限电停机");
put("告警运行", "告警运行");
put("故障停机", "故障停机");
put("待机", "待机状态");
put("通讯故障", "通讯中断");
}
};
}
......@@ -65,7 +65,15 @@ public class DeviceController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘大屏 - 获取历史告警数据")
@GetMapping("/historyNationwideByPage")
public ResponseModel<Page<IndexDto>> historyNationwideByPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationBasicId") String stationBasicId) {
Page<IndexDto> resultsData = monitorFanIndicatorImpl.historyNationwideByPage( current, size, stationBasicId);
return ResponseHelper.buildResponse(resultsData);
}
......
......@@ -11,7 +11,7 @@ import java.util.Map;
public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
List<Map<String, String>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId);
List<Map<String, Object>> timingTemporarysSorageData (@RequestParam(value ="gatewayId" ) String gatewayId);
Map<String, Object> getStatisticsInfo (@RequestParam(value ="gatewayId" ) String gatewayId,
......
......@@ -2,7 +2,12 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
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;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
......@@ -32,10 +37,12 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
public class CommonServiceImpl {
......@@ -55,6 +62,12 @@ public class CommonServiceImpl {
@Autowired
private ElasticsearchRestTemplate elasticsearchTemplate;
@Resource
private StationBasicMapper stationBasicMapper;
@Resource
private RegionMapper regionMapper;
@Resource
private MapRegionMapper mapRegionMapper;
/**
* @deprecated 获取指标值总和
......@@ -154,13 +167,36 @@ public class CommonServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtoList =redisTemplate.opsForList().range("station_info_cache",0,-1);
if(ObjectUtils.isEmpty(stationCacheInfoDtoList)){
try {
stationCacheDataInit.run();
stationCacheInfoDtoList =redisTemplate.opsForList().range("station_info_cache",0,-1);
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 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"));
stationBasicList.forEach(stationBasic -> {
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.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.setInstalledCapacity(String.format("%.2f",sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId",stationBasic.getFanGatewayId()));
queryDtoList.add(new QueryDto("equipmentIndexName.keyword","有功功率"));
if(!stationBasic.getStationType().equals("FDZ")){
queryDtoList.add(new QueryDto("frontModule","逆变器"));
}
stationCacheInfoDto.setEquipmentNumbers(this.getCount(queryDtoList,"equipmentNumber.Keyword", ESEquipments.class).toString());
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDtos.add(stationCacheInfoDto);
});
redisTemplate.opsForList().leftPushAll("station_info_cache",stationCacheInfoDtos);
return stationCacheInfoDtos;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return stationCacheInfoDtoList;
}
......
......@@ -129,7 +129,7 @@ public class LargeScreenImpl {
int month = currentDate.getMonthValue();
QueryWrapper<StationPlan> wrapper = new QueryWrapper<>();
wrapper.select("sum(value) as sum_value");
wrapper.select("ifnull(sum(value), 0) as sum_value");
wrapper.eq("monthly", month);
List<Map<String, Object>> list = StationPlanMapper.selectMaps(wrapper);
Double sumValue = list != null && !list.isEmpty() ? (Double) list.get(0).get("sum_value") : 0;
......@@ -139,8 +139,8 @@ public class LargeScreenImpl {
mapdta.put("YJHWC", ybfb);
QueryWrapper<StationPlan> wrapper1 = new QueryWrapper<>();
wrapper1.select("sum(value) as sum_value");
List<Map<String, Object>> list1 = StationPlanMapper.selectMaps(wrapper);
wrapper1.select("ifnull(sum(value), 0) as sum_value");
List<Map<String, Object>> list1 = StationPlanMapper.selectMaps(wrapper1);
Double sumValuen = list1 != null && !list1.isEmpty() ? (Double) list1.get(0).get("sum_value") : 0;
Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValue * 100 : 0;
ybfbn = new BigDecimal(ybfbn).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
......@@ -246,7 +246,7 @@ public class LargeScreenImpl {
int month = currentDate.getMonthValue();
QueryWrapper<StationPlan> wrapper = new QueryWrapper<>();
wrapper.select("sum(value) as sum_value");
wrapper.select("ifnull(sum(value), 0) as sum_value");
wrapper.eq("monthly", month);
List<Map<String, Object>> list = StationPlanMapper.selectMaps(wrapper);
Double sumValue = list != null && !list.isEmpty() ? (Double) list.get(0).get("sum_value") : 0;
......@@ -256,8 +256,8 @@ public class LargeScreenImpl {
mapdta.put("YJHWC", ybfb);
QueryWrapper<StationPlan> wrapper1 = new QueryWrapper<>();
wrapper1.select("sum(value) as sum_value");
List<Map<String, Object>> list1 = StationPlanMapper.selectMaps(wrapper);
wrapper1.select("ifnull(sum(value), 0) as sum_value");
List<Map<String, Object>> list1 = StationPlanMapper.selectMaps(wrapper1);
Double sumValuen = list1 != null && !list1.isEmpty() ? (Double) list1.get(0).get("sum_value") : 0;
Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValue * 100 : 0;
ybfbn = new BigDecimal(ybfbn).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
......
......@@ -5,7 +5,8 @@
<select id="timingTemporarysSorageData" resultType="map">
SELECT avg(value) as value ,
SELECT
avg(value) as value ,
created_time as createdTime ,
equipmentIndexName
FROM
......@@ -17,8 +18,9 @@
<if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null
</if>
AND equipmentIndexName='有功功率'
</where>
GROUP BY batch_no ,equipmentIndexName;
GROUP BY created_time ,equipmentIndexName;
</select>
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -29,6 +30,7 @@ import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.LoginInfoModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -41,6 +43,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import springfox.documentation.spring.web.json.Json;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
......@@ -55,6 +58,7 @@ import java.util.stream.Collectors;
* @author system_generator
* @date 2023-04-20
*/
@Slf4j
@Service
public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBasic, PersonBasicMapper> implements IPersonBasicService {
......@@ -482,8 +486,10 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
usd.setUserName(personAccount.getAccountName());
usd.setLockStatus("UNLOCK");
usd.setUserId(personAccount.getPuserId());
usd.setOriginalPassword(oldpersonAccount.getPassword());
//新增平台用户
AgencyUserModel agencyUserModel = this.updateuser(personAccount.getPuserId(), usd);
log.info("更新平台账户信息::"+ JSONObject.toJSONString(usd));
//设置userID
usd.setUserId(agencyUserModel.getUserId());
//设置工号
......@@ -616,8 +622,8 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
//修改平台用户
private AgencyUserModel updateuser(String userId, AgencyUserModel userDto) {
FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.update(userDto, userId);
FeignClientResult<AgencyUserModel> amosUser1 = Privilege.agencyUserClient.modifyPassword(userId,userDto);
AgencyUserModel user = new AgencyUserModel();
if (!ObjectUtils.isEmpty(amosUser)) {
if (amosUser.getStatus() == 200) {
user = amosUser.getResult();
......@@ -625,6 +631,13 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto, PersonBa
throw new RuntimeException(amosUser.getMessage());
}
}
if (!ObjectUtils.isEmpty(amosUser1)) {
if (amosUser1.getStatus() == 200) {
user = amosUser1.getResult();
} else {
throw new RuntimeException(amosUser1.getMessage());
}
}
return user;
}
private LoginInfoModel updateLoginInfo(String loginId,AgencyUserModel userDto) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
......@@ -13,6 +12,8 @@ public class StationCacheInfoDto implements Serializable {
private String stationName;
//场站类型
private String stationType;
//场站类型
private String stationNumber;
//所属省份
private String belongProvince;
//所属片区
......@@ -25,4 +26,6 @@ public class StationCacheInfoDto implements Serializable {
private String fanGatewayId;
//升压站网关
private String boosterGatewayId;
//片区code
private String areaCode;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;
......@@ -11,7 +15,7 @@ import java.util.Date;
@Accessors(chain = true)
@TableName("equip_alarm_event")
public class EquipAlarmEvent {
@TableField("sequence_nbr")
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
private Long sequenceNumber;
@TableField("created_time")
private Date createdTime;
......@@ -30,4 +34,6 @@ public class EquipAlarmEvent {
*/
@TableField("frontModule")
private String frontModule;
@TableField("value")
private String value;
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.extra.pinyin.PinyinUtil;
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;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
......@@ -33,6 +38,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
......@@ -56,6 +62,11 @@ public class CommonServiceImpl {
@Autowired
private StationBasicMapper stationBasicMapper;
@Resource
private RegionMapper regionMapper;
@Resource
private MapRegionMapper mapRegionMapper;
/**
* 带参数 求平均值
*/
......@@ -178,6 +189,13 @@ public class CommonServiceImpl {
return value;
}
/**
* @deprecated 获取场站的设备总数
* @param queryDto
* @param keysum
* @param clas
* @return
*/
public Integer getCount(List<QueryDto> queryDto, String keysum, Class clas) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
for (QueryDto dto : queryDto) {
......@@ -225,7 +243,6 @@ public class CommonServiceImpl {
return Double.valueOf(String.format("%.2f", totalvalue));
}
public Double getNumByIndicatior(String gatewayId, String indicator) {
String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName=~/" + indicator + "$/";
Double totalvalue = 0.00;
......@@ -256,6 +273,12 @@ public class CommonServiceImpl {
return Double.valueOf(String.format("%.2f", avageValue));
}
/**
*
* @param mapList 查询出来的influxdb数据
* @param indicator 指标名称
* @return 该指标的求和数据
*/
public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double totalvalue = 0.0000;
try {
......@@ -281,10 +304,21 @@ public class CommonServiceImpl {
return Double.valueOf(String.format("%.2f", avageValue));
}
/**
* 根据场站Number获取装机容量
* @param WERKS
* @return
*/
public Double getStationCapactityByStationWerks(String WERKS) {
return sjglZsjZsbtzMapper.getStationCapactityByStationWerks(WERKS);
}
/**
* @deprecated 根据发电量获取社会贡献
* @param totalSocialContribution
* @return
*/
public Page<SocialContributionDto> getSocialContributionDtoList(Double totalSocialContribution) {
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
......@@ -327,12 +361,40 @@ public class CommonServiceImpl {
return socialContributionDtoPage;
}
/**
* @deprecated 获取缓存场站信息数据
* @return 缓存的场站信息
*/
public List<StationCacheInfoDto> getListStationCacheInfoDto() {
List<StationCacheInfoDto> stationCacheInfoDtoList = redisTemplate.opsForList().range("station_info_cache", 0, -1);
if (ObjectUtils.isEmpty(stationCacheInfoDtoList)) {
try {
stationCacheDataInit.run();
stationCacheInfoDtoList = redisTemplate.opsForList().range("station_info_cache", 0, -1);
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 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"));
stationBasicList.forEach(stationBasic -> {
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.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.setInstalledCapacity(String.format("%.2f",sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId",stationBasic.getFanGatewayId()));
queryDtoList.add(new QueryDto("equipmentIndexName.keyword","有功功率"));
if(!stationBasic.getStationType().equals("FDZ")){
queryDtoList.add(new QueryDto("frontModule","逆变器"));
}
stationCacheInfoDto.setEquipmentNumbers(this.getCount(queryDtoList,"equipmentNumber.Keyword", ESEquipments.class).toString());
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDtos.add(stationCacheInfoDto);
});
redisTemplate.opsForList().leftPushAll("station_info_cache",stationCacheInfoDtos);
return stationCacheInfoDtos;
} catch (Exception e) {
throw new RuntimeException(e);
}
......@@ -340,13 +402,36 @@ public class CommonServiceImpl {
return stationCacheInfoDtoList;
}
/**
* @deprecated 根据场站id获取缓存数据中的场站对象
* @param stationId 场站id
* @return 缓存的场站对象
*/
public StationCacheInfoDto getStationCacheInfoDtoByStationId(String stationId) {
StationCacheInfoDto stationCacheInfoDto = this.getListStationCacheInfoDto().stream().filter(stationCacheInfoDto1 -> stationCacheInfoDto1.getStationId().equals(stationId)).collect(Collectors.toList()).get(0);
return stationCacheInfoDto;
}
/**
* @deprecated 根据场站id获取场站的首字母缩写
* @param stationid 场站id
* @return 返回该场站的名称拼音缩写
*/
public String getFanDevicePrefix(String stationid) {
StationBasic stationBasic = stationBasicMapper.selectById(stationid);
return PinyinUtil.getFirstLetter(stationBasic.getStationName().split("风")[0], "").toUpperCase(Locale.ROOT);
}
/**
* @deprecated 将查询条件进行组装
* @param searchCondtionMap 需要查询的数据的 条件map
* @return List<QueryDto> QueryDtolist 用于给传值
*/
public List<QueryDto> getQueryDtoList(Map<String,String> searchCondtionMap){
List<QueryDto> result = new ArrayList<>();
searchCondtionMap.keySet().forEach(s -> {
result.add(new QueryDto(s,searchCondtionMap.get(s)));
});
return result;
}
}
......@@ -98,6 +98,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
private StationBasicMapper stationBasicMapper;
@Autowired
private SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
@Autowired
private RegionMapper regionMapper;
//风机状态列表
@Value("${fan.statuts.stattuspath}")
......@@ -642,12 +644,14 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
long timeInMillis = new Date().getTime();
for (StationBasic stationBasic : stationBasics) {
if (stationBasic.getStationType().equals("FDZ")) {
timingTemporarysSorageData(stationBasic.getFanGatewayId());
timingTemporarysSorageData(stationBasic.getFanGatewayId(),timeInMillis);
}
if (stationBasic.getStationType().equals("JZSGFDZ")) {
schedSolarPower(stationBasic.getBoosterGatewayId());
schedSolarPower(stationBasic.getBoosterGatewayId(),timeInMillis);
}
}
}
......@@ -732,7 +736,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public void timingTemporarysSorageData(String gatewayId) {
public void timingTemporarysSorageData(String gatewayId, long timeInMillis) {
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '瞬时风速' ";
String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE equipmentIndexName = '有功功率'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
......@@ -745,7 +749,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) {
e.printStackTrace();
}
long timeInMillis = new Date().getTime();
// long timeInMillis = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
try {
TemporaryData temporaryData = new TemporaryData();
......@@ -778,7 +782,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryDataService.saveBatch(temporaryDatass);
}
public void schedSolarPower(String gatewayId) {
public void schedSolarPower(String gatewayId,long timeInMillis) {
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE displayName = '总辐射累计' ";
String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE displayName = '有功功率'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
......@@ -791,7 +795,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} catch (ParseException e) {
e.printStackTrace();
}
long timeInMillis = new Date().getTime();
// long timeInMillis = new Date().getTime();
for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
try {
TemporaryData temporaryData = new TemporaryData();
......@@ -1498,10 +1502,34 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// resultMap.put("equipmentSpecificName", list.get(0).getEquipmentSpecificName());
// resultMap.put("equipmentIndexName", list.get(0).getEquipmentSpecificName());
//箱变名称与箱变型号去掉区域
String type = "光伏阵区系统";
String queryEquipNum = "";
if (equipmentNumber.contains("-")){
String[] equipNames = equipmentNumber.split("-");
if (equipNames.length>2){
type ="汇流箱系统";
queryEquipNum = equipNames[0]+equipNames[1]+Integer.parseInt(equipNames[2]);
}else {
type ="光伏逆变器系统";
String sql1 = " SELECT * FROM indicators_" + gatewayId + " WHERE (equipmentIndexName ='待机' or equipmentIndexName ='故障停机' or equipmentIndexName ='告警运行' or equipmentIndexName ='限额运行' or equipmentIndexName ='停机' or equipmentIndexName = '通讯故障' or equipmentIndexName = '降额运行' or equipmentIndexName = '运行') and value = 'true' and equipmentNumber ='"+equipmentNumber+"'";
List<IndicatorsDto> list1 = influxDButils.getListData(sql1, IndicatorsDto.class);
resultMap.put("status", AlarmDesc.getCode(list1.get(0).getEquipmentIndexName()));
queryEquipNum="#"+Integer.parseInt(equipNames[0]);
}
}else {
queryEquipNum ="#"+ Integer.parseInt(equipmentNumber)+"";
}
queryEquipNum = queryEquipNum + type;
LambdaQueryWrapper<SjglZsjZsbtz> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(SjglZsjZsbtz::getSbmc,queryEquipNum);
SjglZsjZsbtz sjglZsjZsbtz = sjglZsjZsbtzMapper.selectOne(queryWrapper);
resultMap.put("equipmentSpecificName", list.get(0).getEquipmentSpecificName().split("区域/")[1]);
resultMap.put("equipmentIndexName", list.get(0).getEquipmentSpecificName().split("区域/")[1]);
resultMap.put("equipmentIndexName",null == sjglZsjZsbtz.getGgxh()?"": sjglZsjZsbtz.getGgxh());
resultMap.put("equipmentInfoName", list.get(0).getEquipmentSpecificName().substring(5).replace("/", " "));
resultMap.put("status", list.get(0).getValue().equals("false") ? "异常" : "正常运行");
}
return resultMap;
}
......@@ -2072,7 +2100,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return deaviationRateDtoPage;
}
@Scheduled(cron = "0 */1 * * * ?")
public void addNbqAlarmEvent() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
......@@ -2106,11 +2134,14 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (IndicatorsDto indicatorsDto : indicatorsDtoList) {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
equipAlarmEvent.setEquipIndex(indicatorsDto.getEquipmentNumber());
equipAlarmEvent.setEquipName(indicatorsDto.getEquipmentSpecificName());
equipAlarmEvent.setAlarmDesc(AlarmDesc.getCode(indicatorsDto.getEquipmentIndexName()));
equipAlarmEvent.setAlarmDesc(StringUtils.isEmpty(equipAlarmEvent.getAlarmDesc())? indicatorsDto.getEquipmentIndexName() : equipAlarmEvent.getAlarmDesc());
equipAlarmEvent.setCreatedTime(DateUtils.longStr2Date(indicatorsDto.getCreatedTime()));
equipAlarmEvent.setGatewayId(stationBasic.getFanGatewayId());
equipAlarmEvent.setSort(time);
equipAlarmEvent.setFrontModule(indicatorsDto.getFrontModule());
equipAlarmEvent.setValue(indicatorsDto.getValue());
newEquipAlarmEvents.add(equipAlarmEvent);
newEquipAlarmEvent.add(equipAlarmEvent);
}
......@@ -2120,7 +2151,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<EquipAlarmEvent> oldEquipAlarmEvents = equipAlarmEventMapper.getOldDataBySort(lastSort, stationBasic.getFanGatewayId());
for (EquipAlarmEvent oldEquipAlarmEvent : oldEquipAlarmEvents) {
for (EquipAlarmEvent equipAlarmEvent : newEquipAlarmEvents) {
if (oldEquipAlarmEvent.getEquipIndex().equals(equipAlarmEvent.getEquipIndex()) && oldEquipAlarmEvent.getAlarmDesc().equals(equipAlarmEvent.getAlarmDesc())) {
if (oldEquipAlarmEvent.getEquipIndex().equals(equipAlarmEvent.getEquipIndex()) &&
oldEquipAlarmEvent.getAlarmDesc().equals(equipAlarmEvent.getAlarmDesc()) &&
oldEquipAlarmEvent.getValue().equals(equipAlarmEvent.getValue())) {
newEquipAlarmEvent.remove(equipAlarmEvent);
}
}
......
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