Commit 2fe5a287 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 39f897c0 1e13a0e8
package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PersonBasicServiceImpl;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@Component
@EnableScheduling
@Slf4j
public class PersonYardMessage extends EmqxListener {
@Autowired
private AmosRequestContext amosAuth;
@Autowired
protected EmqKeeper emqKeeper;
......
......@@ -3,15 +3,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.emqx;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import lombok.extern.slf4j.Slf4j;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import javax.annotation.PostConstruct;
import java.util.List;
......@@ -20,12 +16,9 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
@Component
@EnableScheduling
@Slf4j
public class StationYardMessage extends EmqxListener {
@Autowired
private AmosRequestContext amosAuth;
@Autowired
protected EmqKeeper emqKeeper;
......@@ -34,7 +27,9 @@ public class StationYardMessage extends EmqxListener {
private StationBasicMapper stationBasicMapper;
// 江西电建接收红黄绿码主题
/**
* 江西电建接收红黄绿码主题
*/
private static final String JXIOP_STATION_YARD = "jxIop/station/yard";
private static final BlockingQueue<List<Map<String, String>>> blockingQueue = new LinkedBlockingQueue<List<Map<String, String>>>();
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -69,7 +70,7 @@ public class MonitoringServiceImpl {
@Autowired
EmqKeeper emqKeeper;
// @Autowired
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
IndicatorDataMapper indicatorDataMapper;
......@@ -257,7 +258,7 @@ public class MonitoringServiceImpl {
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.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)));
......@@ -691,6 +692,12 @@ public class MonitoringServiceImpl {
public Page<HashMap<String, String>> getDetailsOnPowergeneration(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 99);
List<HashMap<String, String>> hashMapList = 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());
}
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
......@@ -698,11 +705,11 @@ public class MonitoringServiceImpl {
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if ("FDZ".equals(stationBasic.getStationType())) {
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(stationBasic.getFanGatewayId()));
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, "月发电量")));
......@@ -710,7 +717,7 @@ public class MonitoringServiceImpl {
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
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)));
......
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