Commit def1b30d authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer' into developer

parents b2df1ac7 840a1a2c
......@@ -99,9 +99,9 @@ public class GoodWeRequestUtil {
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
// if (jsonArray.size() == 0) {
// jsonArray.add(jsonObject);
// }
}
return jsonArray;
}
......
......@@ -13,9 +13,10 @@ public class GoodWeConstant {
public static final HashMap<String, String> stationStaus = new HashMap<String, String>() {
{
put("-1", "离线");
put("0", "待机");
put("1", "正常");
put("2", "停机");
put("0", "在线");
put("1", "在线");
put("2", "报警");
put("-2", "报警");
}
};
public static final HashMap<String, String> warningStaus = new HashMap<String, String>() {
......@@ -31,6 +32,27 @@ public class GoodWeConstant {
}
};
public static final HashMap<String, String> types = new HashMap<String, String>() {
{
put("0", "家庭户用");
put("1", "工商业屋顶");
put("2", "地面电站");
put("3", "扶贫电站");
put("4", "储能电站");
}
};
public static final HashMap<String, List<String>> errorCodeMap = new HashMap<String, List<String>>() {
{
put("E0", Arrays.asList("漏电流自检异常",
......
......@@ -85,16 +85,16 @@ public class HouseholdTestController {
@PostMapping(value = "/goodweDemo")
@ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例")
public void goodweDemo() throws IOException {
// goodWeDataAcquisitionService.stationList();
goodWeDataAcquisitionService.stationList();
// goodWeDataAcquisitionService.stationDetail();
// goodWeDataAcquisitionService.inverAlramInfo();
// goodWeDataAcquisitionService.inverAlramInfo();
// goodWeDataAcquisitionService.inverterList();
// goodWeDataAcquisitionService.inverterDetail();
// goodWeDataAcquisitionService.stationMonthGen();
// goodWeDataAcquisitionService.stationYearGen();
// goodWeDataAcquisitionService.inverterDetail();
goodWeDataAcquisitionService.inverterMonthGen();
goodWeDataAcquisitionService.inverterYearGen();
// goodWeDataAcquisitionService.inverterMonthGen();
// goodWeDataAcquisitionService.inverterYearGen();
}
/**
......@@ -111,8 +111,8 @@ public class HouseholdTestController {
// goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
......@@ -125,13 +125,13 @@ public class HouseholdTestController {
@PostMapping(value = "/sofarnew")
@ApiOperation(httpMethod = "POST", value = "首航", notes = "首航")
public void sofarnew() throws IOException {
sofarDataAcquisitionService.stationList();
// sofarDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
goLangDataAcquisitionService.inverAlramInfo();
}
/**
......@@ -149,7 +149,7 @@ public class HouseholdTestController {
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
// goLangDataAcquisitionService.inverAlramInfo();
}
/**
......
......@@ -35,5 +35,5 @@ public interface GoodWeDataAcquisitionService {
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
void inverAlramInfo(String stationid);
}
......@@ -109,19 +109,22 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
jpStation.setCapacity(goodWeStationList.getCapacity());
jpStation.setName(goodWeStationList.getStationname());
jpStation.setPrice(0.42);
jpStation.setAddress(goodWeStationList.getAddress());
jpStation.setAddress(goodWeStationList.getLocation());
jpStation.setLatitude(goodWeStationList.getLatitude());
jpStation.setLongitude(goodWeStationList.getLongitude());
jpStation.setUserName(goodWeStationList.getOwner_name());
jpStation.setUserName(goodWeStationList.getOwner_name()==null?goodWeStationList.getStationname():goodWeStationList.getOwner_name());
jpStation.setUserPhone(goodWeStationList.getOwner_phone());
jpStation.setStationContact(goodWeStationList.getOwner_name());
jpStation.setModuleCount(0);
jpStation.setRealTimePower(goodWeStationList.getPac() * GoodWeConstant.wToKw);
jpStation.setState(GoodWeConstant.stationStaus.get(goodWeStationList.getStatus()));
jpStation.setRealTimePower(goodWeStationList.getPac()!=null?goodWeStationList.getPac() * GoodWeConstant.wToKw:null);
jpStation.setState(goodWeStationList.getStatus()!=null?GoodWeConstant.stationStaus.get(goodWeStationList.getStatus()+""):null);
jpStation.setDayGenerate(goodWeStationList.getEday());
jpStation.setDayIncome(goodWeStationList.getEday_income());
jpStation.setAccumulatedPower(goodWeStationList.getEtotal());
jpStation.setCumulativeIncome(goodWeStationList.getEtotal_income());
jpStation.setType(goodWeStationList.getPowerstation_type());
jpStation.setRecDate(new Date());
if (ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStation.setCreateTime(new Date(goodWeStationList.getCreatedTime()));
if (ObjectUtils.isNotEmpty(goodWeStationList.getTurnon_time())) {
......@@ -133,8 +136,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
jpStationMapper.updateById(jpStation);
}
this.inverAlramInfo(goodWeStationList.getPowerstation_id());
//增加td 电站区域公司,经销商绑定表
// TdJpStation tdJpStation = tdJpStationMapper.selectOne(new QueryWrapper<TdJpStation>().
// eq("third_code",PVProducerInfoEnum.GDW.getCode()).
......@@ -287,6 +289,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void stationDetail() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.forEach(stationId -> {
......@@ -316,6 +319,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void stationMonthGen() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.forEach(stationId -> {
......@@ -340,6 +344,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void stationYearGen() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.forEach(stationId -> {
......@@ -375,6 +380,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void inverterList() {
List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
stationIds.stream().forEach(stationId -> {
......@@ -413,6 +419,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void inverterDetail() {
List<String> goodweSnList = jpInverterMapper.getGoodWeSnCodes();
List<List<String>> splitList = Lists.partition(goodweSnList, 50);
......@@ -686,6 +693,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void inverterMonthGen() {
List<String> sns =jpInverterMapper.getGoodWeSnCodes() ;
String currentMonth = DateUtil.format(new Date(), "yyyyMM");
......@@ -710,6 +718,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
@Scheduled(cron = "${dataRequstScheduled.GoodWe}")
public void inverterYearGen() {
String currentYear = DateUtil.format(new Date(), "yyyy");
List<String> sns =jpInverterMapper.getGoodWeSnCodes() ;
......@@ -734,14 +743,15 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
}
@Override
public void inverAlramInfo() {
public void inverAlramInfo(String stationid) {
HashMap<String, Object> requestInfo = new HashMap<>();
String today = DateUtil.today();
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 1000);
requestInfo.put("starttime", today + " 00:00:00");
requestInfo.put("endtime", today + " 23:59:59");
requestInfo.put("status", 2);
requestInfo.put("stationid", stationid);
// requestInfo.put("status", 2);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWeAlarmDto> alarmList = goodWeRequestUtil.getResPonse(GoodWeConstant.alarmListUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeAlarmDto.class);
alarmList.forEach(goodWeAlarmDto -> {
......
......@@ -74,6 +74,6 @@ dataRequstScheduled.huawei=0 0/50 * * * *
dataRequstScheduled.keshida=0 0/50 * * * *
dataRequstScheduled.Sunlight=0 0/50 * * * *
dataRequstScheduled.GoodWe=0 0/50 * * * *
dataRequstScheduled.GoodWe=0 0/3 * * * *
dataRequstScheduled.Sofar=0 0/3 * * * *
\ No newline at end of file
dataRequstScheduled.Sofar=0 0/50 * * * *
\ No newline at end of file
......@@ -32,6 +32,9 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "服务代理商")
private String serviceAgent;
@ApiModelProperty(value = "区域公司")
private String regionalCompaniesName;
@ApiModelProperty(value = "电站类型")
private String powerStationType;
......
......@@ -19,5 +19,6 @@ public interface PowerStationMapper extends BaseMapper<PowerStation> {
@UserEmpower(field ={"regional_companies_code"} ,dealerField={"a.developer_code","a.regional_companies_code","a.developer_user_id"} ,fieldConditions ={"in","in","in"}, relationship="and")
List<PowerStationDto> queryPage(@Param("powerStationCode") String powerStationCode,
@Param("ownersName")String ownersName,
@Param("serviceAgent")String serviceAgent);
@Param("serviceAgent")String serviceAgent,
@Param("regionalCompaniesName")String regionalCompaniesName);
}
......@@ -7,6 +7,7 @@
b.initiate_status,
b.contract_lock_id,
hygf_peasant_household.regional_companies_code,
hygf_peasant_household.regional_companies_name,
hygf_peasant_household.developer_code,
hygf_peasant_household.developer_user_id
from hygf_power_station LEFT JOIN ( select peasant_household_id,initiate_status, contract_lock_id from hygf_household_contract where hygf_household_contract.status !='已作废'
......@@ -21,7 +22,10 @@
and hygf_power_station.owners_name like concat(concat("%",#{ownersName}),"%")
</if>
<if test="serviceAgent!=null and serviceAgent!=''">
and hygf_power_station.service_agent=#{serviceAgent}
and hygf_power_station.service_agent like concat(concat("%",#{serviceAgent}),"%")
</if>
<if test="regionalCompaniesName!=null and regionalCompaniesName!=''">
and hygf_peasant_household.regional_companies_name like concat(concat("%",#{regionalCompaniesName}),"%")
</if>
ORDER BY hygf_power_station.rec_date desc
) a
......
......@@ -100,12 +100,14 @@ public class PowerStationController extends BaseController {
public ResponseModel<Page<PowerStationDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "powerStationCode",required = false)String powerStationCode,
@RequestParam(value = "ownersName",required = false)String ownersName) {
@RequestParam(value = "ownersName",required = false)String ownersName,
@RequestParam(value = "serviceAgent",required = false)String serviceAgent,
@RequestParam(value = "regionalCompaniesName",required = false)String regionalCompaniesName) {
Page<PowerStationDto> page = new Page<PowerStationDto>();
page.setCurrent(current);
page.setSize(size);
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationUserRoles(page,powerStationCode,ownersName,userInfo));
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationUserRoles(page,powerStationCode,ownersName,userInfo,serviceAgent,regionalCompaniesName));
}
/**
......
......@@ -13,20 +13,21 @@ import java.util.Date;
public interface Constant {
// 风电相关性消费者
String kafkaTopicConsumer = "FanConditionVariables";
String kafkaTopicConsumer = "FAN_XGX";
// 光伏相关性消费者
String kafkaTopicConsumerPv = "PvConditionVariables";
String kafkaTopicConsumerPv = "PV_XGX";
// 风电 工况区间划分
String kafkaTopicConsumerGKHFFan = "FanConditionVariablesGKHF";
String kafkaTopicConsumerGKHFFan = "FAN_QJHF";
// 光伏 工况区间划分
String kafkaTopicConsumerGKHFPv = "PvConditionVariablesGKHF";
String kafkaTopicConsumerGKHFPv = "PV_QJHF";
// 风电 中心值计算
String kafkaTopicConsumerZXZFan = "FanConditionVariablesGZXZ";
String kafkaTopicConsumerZXZFan = "FAN_ZXZ";
// 光伏 中心值计算
String kafkaTopicConsumerZXZPv = "PvConditionVariablesZXZ";
String kafkaTopicConsumerZXZPv = "PV_ZXZ";
}
......@@ -4,11 +4,13 @@ import lombok.Data;
@Data
public class BuDunGenDto {
private Double day;
private Double month;
private Double year;
private Double month_complete;
private Double year_complete;
private Double year_hour_number;
private Double cumulative;
private String station_name;
private Double actual_installed_capacity;
private Double day;
private Double month;
private Double year;
private Double month_complete;
private Double year_complete;
private Double year_hour_number;
private Double cumulative;
}
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
/**
* 从数据源配置
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.jxiop.biz.tdanalysismapper", sqlSessionFactoryRef = "taosAnalysisSqlSessionFactory")
public class TdEngineAnalysisConfig {
private Logger logger = LoggerFactory.getLogger(TdEngineAnalysisConfig.class);
// 精确到 cluster 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/tdengineanalysis/*.xml";
@Value("${spring.db4.datasource.url}")
private String dbUrl;
@Value("${spring.db4.datasource.username}")
private String username;
@Value("${spring.db4.datasource.password}")
private String password;
@Value("${spring.db4.datasource.driver-class-name}")
private String driverClassName;
@Bean(name = "taosAnalysisDataSource") //声明其为Bean实例
public DataSource clusterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "taosAnalysisTransactionManager")
public DataSourceTransactionManager clusterTransactionManager() {
return new DataSourceTransactionManager(clusterDataSource());
}
@Bean(name = "taosAnalysisSqlSessionFactory")
public SqlSessionFactory clusterSqlSessionFactory(@Qualifier("taosDataSource") DataSource culsterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(TdEngineAnalysisConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
return sessionFactory.getObject();
}
}
......@@ -130,9 +130,9 @@ public class CommonConstans {
public static final String YEAR_GEN_ATTAINMENT_RATE = "年计划完成率";
//年利用小时数
public static final String YEAR_GEN_HOURS = "年利用小时数";
public static final String WIND_SPEED_THIRTY_SECONDS = "30秒平均风速";
public static final String TOTAL_RADIATION = "辐照度";
public static final String TOTAL_RADIATION_SUM = "累计辐照度";
public static final String WIND_SPEED_THIRTY_SECONDS = "30秒平均风速";
public static final String TOTAL_RADIATION = "辐照度";
public static final String TOTAL_RADIATION_SUM = "累计辐照度";
public static final String ACTIVE_POWER = "有功功率";
......
......@@ -12,21 +12,13 @@ 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.service.IMapRegionService;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.service.MonitorService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javafx.scene.control.Tab;
import org.aspectj.apache.bcel.classfile.Module;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -37,7 +29,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.logging.Handler;
import java.util.stream.Collectors;
@RestController
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import lombok.Data;
import java.io.PipedReader;
import java.util.Date;
@Data
......@@ -23,7 +24,7 @@ public class IndicatorData {
private String unit;
private String value;
private String value="0";
private Float valueF ;
......@@ -35,4 +36,11 @@ public class IndicatorData {
private String displayName;
private String xtime;
private String pointSeq;
private String pointAddress;
private String pointLocation;
private String pointType;
private String pointName;
private String dasTime;
}
......@@ -89,7 +89,6 @@ public interface MonitorService {
IPage<Map> getStationOverViewFanByStationId( String stationId);
/**
* @Descritpion 根据入参动态获取全国发电量数据
* @param stationId
* @return
*/
Map<String,Object> gettimedateyfd( );
......@@ -109,5 +108,15 @@ public interface MonitorService {
*/
ResultsData getElectricQuantityList(int current, int size, StationBasic stationBasic);
/**
* @Description 动态获取电量表计数据
*/
void getTotalData();
/**
* @Description 获取全国功率曲线
* @return
*/
Map<String, Object> getDetailsWindSpeedAlldataqg();
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdanalysismapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface IndicatorDataNewMapper extends BaseMapper<IndicatorData> {
@Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id =#{gatewayId} and ts >=#{startTime} and ts <=#{endTime} group by address ")
List<IndicatorData> selectlastfd(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime);
@Select("select LAST(address)address,LAST(gateway_id)gatewayId,LAST(data_type)dataType,LAST(equipment_index_name)equipmentIndexName,LAST(`value_f`)valueF,LAST(equipment_number)equipmentNumber,LAST(created_time)createdTime from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and gateway_id =#{gatewayId} and ts >=#{startTime} and ts <=#{endTime} group by address ")
List<IndicatorData> selectlastgf(@Param("equipmentIndexName") String equipmentIndexName,@Param("gatewayId") String gatewayId,@Param("startTime") String startTime, @Param("endTime") String endTime);
@Select("select created_time createdTime, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtime(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select sum(valueFs) valueF,xtime from (select SUBSTR(`created_time`, 11,6) xtime, `value_f` as valueFs from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id in (#{gatewayId})) group by xtime order by xtime ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqg(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where point_name =#{pointName} and ts >= TODAY()-8h and point_type ='SYNTHETIC'")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqgNew(@Param("equipmentIndexName") String pointName);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where point_name =#{pointName} and ts >= TODAY()-8h and gateway_id in (#{gatewayId})) and point_type ='SYNTHETIC'")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqgNew(@Param("equipmentIndexName") String pointName,@Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("equipmentIndexName") String equipmentIndexName, @Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF, equipment_index_name from iot_data.indicator_data where equipment_index_name like '%路电流%' and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumberPv(@Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
}
......@@ -11,13 +11,16 @@ spring.db2.datasource.url=jdbc:mysql://139.9.173.44:3306/jxiop_sync_data?allowMu
spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
##db3
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
##db4
spring.db4.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root
spring.db4.datasource.password=taosdata
spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
## eureka properties:
eureka.instance.hostname=172.16.10.220
......
## DB properties:
## db1-production database
spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:mysql://10.20.1.157:3306/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
## db2-sync_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:mysql://10.20.1.157:3306/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
##db3
spring.db3.datasource.url=jdbc:TAOS-RS://10.20.1.157:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
##db4
spring.db4.datasource.url=jdbc:TAOS-RS://10.20.1.157:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root
spring.db4.datasource.password=taosdata
spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
## eureka properties:
eureka.instance.hostname=172.16.10.220
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database=1
spring.redis.host=10.20.1.210
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.cache.type=GENERIC
j2cache.open-spring-cache=true
j2cache.cache-clean-mode=passive
j2cache.allow-null-values=true
j2cache.redis-client=lettuce
j2cache.l2-cache-open=true
j2cache.broadcast=net.oschina.j2cache.cache.support.redis.SpringRedisPubSubPolicy
j2cache.L1.provider_class=caffeine
j2cache.L2.provider_class=net.oschina.j2cache.cache.support.redis.SpringRedisProvider
j2cache.L2.config_section=lettuce
j2cache.sync_ttl_to_redis=true
j2cache.default_cache_null_object=false
j2cache.serialization=fst
caffeine.properties=/caffeine.properties
lettuce.mode=single
lettuce.namespace=
lettuce.storage=generic
lettuce.channel=j2cache
lettuce.scheme=redis
lettuce.hosts=${spring.redis.host}:${spring.redis.port}
lettuce.password=${spring.redis.password}
lettuce.database=${spring.redis.database}
lettuce.sentinelMasterId=
lettuce.maxTotal=100
lettuce.maxIdle=10
lettuce.minIdle=10
lettuce.timeout=10000
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.220:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.10.220:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
emqx.max-inflight=1000
## influxDB
#spring.influx.url= http://172.16.3.155:18186
#spring.influx.password=Yeejoin@2020
#spring.influx.user=root
#spring.influx.database=iot_platform
#spring.influx.retention_policy=default
#spring.influx.retention_policy_time=30d
#spring.influx.actions=10000
#spring.influx.bufferLimit=20000
## influxDB
#spring.influx.url= http://139.9.171.247:8086
#spring.influx.password=Yeejoin@2023
#spring.influx.user=admin
#spring.influx.database=iot_platform
#spring.influx.retention_policy=default
#spring.influx.retention_policy_time=30d
#spring.influx.actions=10000
#spring.influx.bufferLimit=20000
#spring.influx.url=http://10.20.1.157:18086
#spring.influx.password=Yeejoin@2020
#spring.influx.user=root
#spring.influx.database=iot_platform
#spring.influx.retention_policy=default
#spring.influx.retention_policy_time=30d
#spring.influx.actions=10000
#spring.influx.bufferLimit=20000
knife4j.production=false
knife4j.enable=true
knife4j.basic.enable=true
knife4j.basic.username=admin
knife4j.basic.password=a1234560
management.security.enabled=true
spring.security.user.name=admin
spring.security.user.password=a1234560
fire-rescue=123
mybatis-plus.global-config.db-config.update-strategy=ignored
# user-amos setting : This value is the secretkey for person manage moudle accout password encryption.please don't change it!!!
amos.secret.key=qaz
# if your service can't be access ,you can use this setting , you need change ip as your.
#eureka.instance.prefer-ip-address=true
#eureka.instance.ip-address=172.16.3.122
spring.activemq.broker-url=tcp://10.20.1.210:61616
spring.activemq.user=admin
spring.activemq.password=admin
spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
spring.elasticsearch.rest.uris=http://10.20.0.223:9200
spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000
# ?????????
fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl=upload/jxiop/syz/
# Ԥ
idx.predict.serviceUrl=http://10.20.1.157:8095/jxdj/predict-data
......@@ -2,7 +2,7 @@ spring.application.name=AMOS-JXIOP-BIGSCREEN
server.servlet.context-path=/jxiop-bigscreen
server.port=33300
server.uri-encoding=UTF-8
spring.profiles.active=dev
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
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/ccs.log.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>7</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>30mb</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="com.baomidou.mybatisplus" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<logger name="org.typroject" level="DEBUG"/>
<logger name="com.yeejoin" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
......@@ -15,22 +15,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-ugp-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-module-common-biz</artifactId>-->
<!-- <version>${amos-biz-boot.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.amosframework.boot</groupId>-->
<!-- <artifactId>amos-boot-biz-common</artifactId>-->
<!-- <version>1.0.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
......@@ -39,6 +23,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -66,6 +51,11 @@
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.16</version>
</dependency>
</dependencies>
<build>
......
......@@ -31,7 +31,7 @@ import java.net.InetAddress;
@EnableAsync
@EnableScheduling
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class})
@MapperScan({"com.yeejoin.amos.boot.module.das.mapper.msyql","com.yeejoin.amos.boot.module.das.mapper.tdengineanalysis","com.yeejoin.amos.boot.module.das.mapper.tdengineiot"})
@MapperScan({"com.yeejoin.amos.boot.module.das.mapper.msyql","com.yeejoin.amos.boot.module.das.mapper.analysis","com.yeejoin.amos.boot.module.das.mapper.iot"})
@ComponentScan({"springfox.documentation.schema", "com.yeejoin.amos.boot.module.das","com.yeejoin.amos.boot.module.das.service.impl","org.typroject.tyboot.component"})
public class AmosJxiopDasApplication {
......
......@@ -16,9 +16,11 @@ public class IndicatorData {
private Date createdTime;
private String gatewayId;
private String dataType;
private String dasTime;
private String pointSeq;
private String pointAddress;
private String pointLocation;
private String pointType;
private String pointName;
private String value="0";
private Double valueF;
......
......@@ -8,6 +8,6 @@ import java.util.List;
@Component
public interface IndicatorDataMapper {
int insertBatch(@Param("list") List<IndicatorData> list, @Param("gatewayId")String gatewayId);
int insertBatch(@Param("list") List<IndicatorData> list, @Param("gatewayId")String gatewayId,@Param("dasTime")String dasTime);
void createTable();
}
......@@ -8,6 +8,6 @@ import java.util.List;
public interface FrontGatewayDevicePointsMapper extends BaseMapper<FrontGatewayDevicePoints> {
@Select("select distinct gateway_id from iot_front_gateway_device_points")
List<String> getGatewayIds();
@Select("select SEQUENCE_NBR,POINT_NAME,POINT_DATA_TYPE,POINT_ADDRESS,POINT_LOCATION from iot_front_gateway_device_points where gateway_id = #{gatewayId}")
@Select("select SEQUENCE_NBR,POINT_NAME,POINT_DATA_TYPE,POINT_ADDRESS,POINT_LOCATION,POINT_TYPE,DATA_TYPE from iot_front_gateway_device_points where gateway_id = #{gatewayId}")
List<FrontGatewayDevicePoints> getFrontGatewayDevicePointsByGatewayId(String gatewayId);
}
package com.yeejoin.amos.boot.module.das.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
......@@ -18,6 +19,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.util.*;
import java.util.stream.Collectors;
......@@ -41,16 +43,17 @@ public class DasServiceImpl implements DasService {
* 完成后,会记录此次操作所花费的时间。
*/
public void dataSolidification() {
String dasTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:00");
log.info("数据采集开始执行-采集时间::" + dasTime );
// 记录操作开始时间
Long startTime = System.currentTimeMillis();
Long startTime = System.currentTimeMillis();
// 创建新表
indicatorDataMapper.createTable();
// 获取所有网关ID
List<String> gateWayIds = frontGatewayDevicePointsMapper.getGatewayIds();
// 并行处理每个网关ID的数据凝固
gateWayIds.parallelStream().forEach(gatewayId -> {
dataSolidificationByGatewayId(gatewayId);
dataSolidificationByGatewayId(gatewayId,dasTime);
});
// 记录操作结束时间
Long endTime = System.currentTimeMillis();
......@@ -66,7 +69,7 @@ public class DasServiceImpl implements DasService {
* @param gatewayId 网关的唯一标识符,用于查询相关设备点信息和数据点值。
*/
@Async("jxiopAsyncExecutor")
public void dataSolidificationByGatewayId(String gatewayId) {
public void dataSolidificationByGatewayId(String gatewayId,String dasTime) {
// 根据网关ID查询设备点信息
List<FrontGatewayDevicePoints> tempPoints = frontGatewayDevicePointsMapper.getFrontGatewayDevicePointsByGatewayId(gatewayId);
if (!ObjectUtils.isEmpty(tempPoints)) {
......@@ -90,6 +93,7 @@ public class DasServiceImpl implements DasService {
indicatorData.setPointAddress(point.getPointAddress());
indicatorData.setPointLocation(point.getPointLocation());
indicatorData.setPointName(point.getPointName());
indicatorData.setPointType(point.getPointType());
// 设置数据点的值,如果是布尔值则进行转换
indicatorData.setValue(stbMap.get(point.getSequenceNbr().toString()));
if (!ObjectUtils.isEmpty(indicatorData.getValue()) && !booleans.contains(indicatorData.getValue())) {
......@@ -104,10 +108,9 @@ public class DasServiceImpl implements DasService {
// 批量插入构建的数据模型到数据库
Lists.partition(listAll, 1000).stream().forEach(
list -> {
indicatorDataMapper.insertBatch(list, gatewayId);
indicatorDataMapper.insertBatch(list, gatewayId,dasTime);
}
);
// 向EMQX发送消息,通知数据同步成功
try {
HashMap<String, String> syncFlag = new HashMap<>();
......
......@@ -31,6 +31,8 @@ spring.redis.password=yeejoin@2020
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://10.20.1.210:2883
emqx.client-user-name=admin
emqx.client-password=public
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://10.20.1.210:8083/mqtt
......
......@@ -8,11 +8,13 @@
<update id="createTable">
create STABLE if not exists indicator_data
(created_time timestamp,
das_time VARCHAR(100),
data_type NCHAR(12),
point_seq VARCHAR(100) ,
point_address VARCHAR(100) ,
point_location VARCHAR(500) ,
point_name VARCHAR(200),
point_type VARCHAR(50),
`value` VARCHAR(50),
`value_f` float)
TAGS (gateway_id binary(64));
......@@ -24,11 +26,13 @@
indicator_data_#{gatewayId,jdbcType=VARCHAR} USING indicator_data
TAGS (#{gatewayId,jdbcType=VARCHAR})
VALUES (NOW + #{index}a,
#{dasTime,jdbcType=VARCHAR},
#{item.dataType,jdbcType=VARCHAR},
#{item.pointSeq,jdbcType=VARCHAR},
#{item.pointAddress,jdbcType=VARCHAR},
#{item.pointLocation,jdbcType=VARCHAR},
#{item.pointName,jdbcType=VARCHAR},
#{item.pointType,jdbcType=VARCHAR},
#{item.value,jdbcType=VARCHAR},
#{item.valueF,jdbcType=FLOAT})
</foreach>
......
......@@ -21,7 +21,7 @@ public class StationCacheInfoDto implements Serializable {
//所属片区
private String belongArea;
//装机容量
private String installedCapacity="0.0";
private String installedCapacity;
//设备数量
private String equipmentNumbers;
//风机网关
......
......@@ -14,7 +14,7 @@ import java.util.stream.Collectors;
public interface CoreCommonService {
/**
* @deprecated 远程调用core服务根据厂长名称
* @deprecated 远程调用core服务根据场站名称
* @param stationNames 要查的场站名称需要使用逗号分隔 eg:夏造风机,石灰山风机
* @param pointsNames 要查的测点名称需要使用逗号分隔开 eg:日发电量,月发电量,年发电
* @return CoreValuesDto
......
......@@ -17,7 +17,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESEquipmentsRepository;
//import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.index.query.*;
import org.elasticsearch.script.Script;
......@@ -49,8 +48,6 @@ import java.util.stream.Collectors;
@Slf4j
public class CommonServiceImpl {
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
@Autowired
......
......@@ -28,14 +28,19 @@ public class CoreCommonServiceImpl implements CoreCommonService {
@Override
public List<CoreValuesDto> getValuesByStationNamesAndPointsNames(String stationNames, String pointsNames) {
List<CoreValuesDto> result = new ArrayList<>();
try {
FeignClientResult<List<Object>> feignClientResult = coreFeignClient.getValues(stationNames, pointsNames);
List<Object> list = feignClientResult.getResult();
List<CoreValuesDto> result = new ArrayList<>();
list.forEach(o -> {
CoreValuesDto coreValuesDto = JSONObject.parseObject(JSONObject.toJSONString(o), CoreValuesDto.class);
coreValuesDto.setDataMap(coreValuesDto.getData().stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> b)));
result.add(coreValuesDto);
});
}catch (Exception e){
e.printStackTrace();
return new ArrayList<>();
}
return result;
}
......
......@@ -254,7 +254,6 @@ public class MonitorServiceImpl implements MonitorService {
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);
RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
regionNationWideDto.setStaitionId(String.valueOf(stationCacheInfoDto.getStationId()));
......@@ -279,7 +278,13 @@ public class MonitorServiceImpl implements MonitorService {
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());
}
}
regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
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()));
......@@ -356,24 +361,25 @@ public class MonitorServiceImpl implements MonitorService {
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;
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(String.format(CommonConstans.Twodecimalplaces, buDunStationDetailInfo.getWind_as_irradiance()));
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("电站",""))).findFirst().get();
if (stationCacheInfoDto.getStationCoreName() != null && stationCacheInfoDto.getBoosterCoreName() != null) {
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;
......@@ -481,7 +487,7 @@ 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 = Constants.areaChinese;
areaName =areaName+ Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName=" + areaName;
}
......@@ -573,7 +579,7 @@ public class MonitorServiceImpl implements MonitorService {
List<HashMap<String, String>> mapList = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_month_top_url + "&topValue=5";
if (!ObjectUtils.isEmpty(areaName)) {
if (areaName.contains(Constants.areaChinese)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = areaName + Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName=" + areaName;
......@@ -640,7 +646,7 @@ public class MonitorServiceImpl implements MonitorService {
List<StationBasic> gfdzlist = new ArrayList<>();
String requestUrl = Constants.BASE_URL + "?" + Constants.get_hours_num_top + "&topValue=3&tabValue=" + tabValue;
if (!ObjectUtils.isEmpty(areaName)) {
if (areaName.contains(Constants.areaChinese)) {
if (!areaName.contains(Constants.areaChinese)) {
areaName = areaName + Constants.areaChinese;
}
requestUrl = requestUrl + "&areaName=" + areaName;
......
......@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.netflix.loadbalancer.RetryRule;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
......@@ -17,11 +16,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
//import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
//import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......
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