Commit 883405a2 authored by caotao's avatar caotao

1.接口返回新增测点id方便处理多余数据

2.新增通过excel更新数据
parent 46bf449b
package com.yeejoin.amos.boot.module.jxiop.api.mapper; package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mysql.cj.x.protobuf.MysqlxCrud;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -17,22 +14,7 @@ import java.util.Map; ...@@ -17,22 +14,7 @@ import java.util.Map;
* @createDate: 2023/7/3 * @createDate: 2023/7/3
*/ */
public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicator> { public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicator> {
//批量修改
void UpdateMonitorFanIndicator(@Param(value = "list") List<IndexDto> list);
Integer queryByPageTotal(@Param("equipmentNumber") String equipmentNumber,
@Param("gateway") String gateway,
@Param("frontModule") String frontModule);
List<MonitorFanIndicator> queryByPage(@Param("size") long size,
@Param("equipmentNumber") String equipmentNumber,
@Param("gateway") String gateway,
@Param("frontModule") String frontModule,
@Param("offset") int offset);
Object getIndicatoralueAvage(String gateway,String indicator);
Object getIndicatoralueTotal(String gateway,String indicator);
List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId, List<Map<String, String>> getFanConfigPower(@Param("gatewayId") String gatewayId,
@Param("equipmentNum") String equipmentNum); @Param("equipmentNum") String equipmentNum);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper">
<update id="UpdateMonitorFanIndicator">
update monitor_fan_indicator
<trim prefix="set" suffixOverrides=",">
<trim prefix="indicator_value=case" suffix="end,">
<foreach collection="list" item="item" index="index">
when address_gateway=#{item.equipmentsIdx} then #{item.valueLabel}
</foreach>
</trim>
<trim prefix="indicator_time=case" suffix="end,">
<foreach collection="list" item="item" index="index">
when address_gateway=#{item.equipmentsIdx} then #{item.createdTime}
</foreach>
</trim>
</trim>
where address_gateway in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.equipmentsIdx}
</foreach>
</update>
<select id="queryByPage" resultType="com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator">
select * from monitor_fan_indicator
<where>
<if test="equipmentNumber != null and equipmentNumber !=''">
equipment_number = #{equipmentNumber}
</if>
<if test="gateway != null and gateway !=''">
AND gateway = #{gateway}
</if>
<if test="frontModule != null and frontModule !=''">
AND front_module = #{frontModule}
</if>
</where>
limit #{offset}, #{size}
</select>
<select id="queryByPageTotal" resultType="java.lang.Integer">
select count(1) from monitor_fan_indicator
<where>
<if test="equipmentNumber != null and equipmentNumber !=''">
equipment_number = #{equipmentNumber}
</if>
<if test="gateway != null and gateway !=''">
AND gateway = #{gateway}
</if>
<if test="frontModule != null and frontModule !=''">
AND front_module = #{frontModule}
</if>
</where>
</select>
<select id="getIndicatoralueAvage" resultType="Object">
SELECT AVG(indicator_value) wind_speed
FROM monitor_fan_indicator
WHERE gateway=#{gateway} and
indicator like concat('%',#{indicator},'%')
</select>
<select id="getIndicatoralueTotal" resultType="Object">
SELECT SUM(indicator_value) wind_speed
FROM monitor_fan_indicator
WHERE gateway=#{gateway} and
indicator like concat('%',#{indicator},'%')
</select>
<select id="getFanConfigPower" resultType="java.util.Map"> <select id="getFanConfigPower" resultType="java.util.Map">
select select
sequence_nbr as id, sequence_nbr as id,
......
...@@ -14,7 +14,7 @@ import java.util.Map; ...@@ -14,7 +14,7 @@ import java.util.Map;
*/ */
public interface IMonitorFanIndicator { public interface IMonitorFanIndicator {
//批量修改指标值 //批量修改指标值
void UpdateMonitorFanIndicator(List<IndexDto> list); // void UpdateMonitorFanIndicator(List<IndexDto> list);
// ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); // ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
// ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); // ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
......
...@@ -115,13 +115,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -115,13 +115,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private List<Map> list; private List<Map> list;
@Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) {
monitorFanIndicatorregionMapper.UpdateMonitorFanIndicator(list);
}
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
...@@ -287,9 +280,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -287,9 +280,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
* @param indicator * @param indicator
* @return * @return
*/ */
public Object getIndicatoralueAvage(String gateway, String indicator) { // public Object getIndicatoralueAvage(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueAvage(gateway, indicator); // return monitorFanIndicatorregionMapper.getIndicatoralueAvage(gateway, indicator);
} // }
/** /**
...@@ -299,9 +292,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -299,9 +292,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
* @param indicator * @param indicator
* @return * @return
*/ */
public Object getIndicatoralueTotal(String gateway, String indicator) { // public Object getIndicatoralueTotal(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway, indicator); // return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway, indicator);
} // }
public StationBasic getOneByStationNumber(String stationId) { public StationBasic getOneByStationNumber(String stationId) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.EquipmentsJxiopDocMysqlMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.EquipmentsJxiopDocMysqlMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments; 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.PointImportDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentsJxiopDocMysql; import com.yeejoin.amos.boot.module.jxiop.biz.entity.EquipmentsJxiopDocMysql;
...@@ -39,7 +39,6 @@ import org.slf4j.LoggerFactory; ...@@ -39,7 +39,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHits; import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
...@@ -52,10 +51,11 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -52,10 +51,11 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
@RestController @RestController
...@@ -119,76 +119,46 @@ public class DemoController extends BaseController { ...@@ -119,76 +119,46 @@ public class DemoController extends BaseController {
return updateResult; return updateResult;
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试prodcutcion 库")
@GetMapping("/test")
public StationBasic demoTest() {
return stationBasicServiceimpl.getById(1660231556607774721L);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试中间库")
@GetMapping("/test1")
public List<Test> demoTest1() {
return testServiceimpl.getList();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试influxdb")
@GetMapping("/test3")
public void demoTest2() {
String sql = "SELECT * FROM indicators_1668801435891929089";
String sql1 = "SELECT * FROM indicators_1668801570352926721";
// List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
// List<IndicatorsDto> list2 = influxDButils.getListData(sql1, IndicatorsDto.class);
// System.out.println(list.size());
// System.out.println(list2.size());
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化influxdb-风电、光伏、升压站") @ApiOperation(value = "初始化influxdb-风电、光伏、升压站")
@GetMapping("doc/test4") @GetMapping("doc/test4")
public ResponseModel<Integer> demoTest3() { public ResponseModel<Integer> demoTest3() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站 //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String[] strings = {"1668801435891929089", "1669524885619085313", "1668801570352926721", "1669525017559306241"}; String[] strings = {"1668801435891929089", "1669524885619085313", "1668801570352926721", "1669525017559306241"};
// String [] strings = {"1669524885619085313"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
elasticsearchTemplate.deleteIndex(ESEquipments.class); elasticsearchTemplate.deleteIndex(ESEquipments.class);
int num = 0; int num = 0;
for (int i = 0; i < strings.length; i++) { for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentsJxiopDocMysql> QueryWrapper = new QueryWrapper<>();
// 夏造风电 // 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089"); // QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏 // 泰和光伏
QueryWrapper.eq("gateway", strings[i]); QueryWrapper.eq("gateway", strings[i]);
long DATE = new Date().getTime(); long DATE = new Date().getTime();
System.out.println(DATE); System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper); List<EquipmentsJxiopDocMysql> list = equipmentsJxiopDocMysqlMapper.selectList(QueryWrapper);
num = num + list.size(); num = num + list.size();
List<ESEquipments> listit = new ArrayList<>(); List<ESEquipments> listit = new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) { for (EquipmentsJxiopDocMysql monitorFanIndicator : list) {
ESEquipments eSEquipments = new ESEquipments( ESEquipments eSEquipments = new ESEquipments(
null, monitorFanIndicator.getValueF(),
monitorFanIndicator.getAddressGateway(), monitorFanIndicator.getId(),
monitorFanIndicator.getIndexAddress(), monitorFanIndicator.getAddress(),
monitorFanIndicator.getDataType(), monitorFanIndicator.getDataType(),
monitorFanIndicator.getFanCode(), monitorFanIndicator.getEquipmentSpecificName(),
monitorFanIndicator.getGateway(), monitorFanIndicator.getGatewayId(),
monitorFanIndicator.getIsAlarm(), monitorFanIndicator.getIsAlarm(),
new Date(), monitorFanIndicator.getCreatedTime(),
monitorFanIndicator.getUnit(), monitorFanIndicator.getUnit(),
"", monitorFanIndicator.getValue(),
"", monitorFanIndicator.getValueLabel(),
"", monitorFanIndicator.getTraceId(),
monitorFanIndicator.getIndicator(), monitorFanIndicator.getEquipmentIndexName(),
monitorFanIndicator.getEquipmentNumber(), monitorFanIndicator.getEquipmentNumber(),
monitorFanIndicator.getFrontModule(), monitorFanIndicator.getFrontModule(),
monitorFanIndicator.getSystemType(), monitorFanIndicator.getSystemType(),
monitorFanIndicator.getPictureName(), monitorFanIndicator.getPictureName(),
monitorFanIndicator.getEquipmentNumber()); monitorFanIndicator.getDisplayName());
listit.add(eSEquipments); listit.add(eSEquipments);
...@@ -231,11 +201,11 @@ public class DemoController extends BaseController { ...@@ -231,11 +201,11 @@ public class DemoController extends BaseController {
result.forEach(esEquipments -> { result.forEach(esEquipments -> {
EquipmentsJxiopDocMysql equipmentsJxiopDocMysql = new EquipmentsJxiopDocMysql(); EquipmentsJxiopDocMysql equipmentsJxiopDocMysql = new EquipmentsJxiopDocMysql();
BeanUtils.copyProperties(esEquipments, equipmentsJxiopDocMysql); BeanUtils.copyProperties(esEquipments, equipmentsJxiopDocMysql);
if( ObjectUtils.isEmpty(equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("id",equipmentsJxiopDocMysql.getId())))){ if (ObjectUtils.isEmpty(equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("id", equipmentsJxiopDocMysql.getId())))) {
equipmentsJxiopDocMysqlMapper.insert(equipmentsJxiopDocMysql); equipmentsJxiopDocMysqlMapper.insert(equipmentsJxiopDocMysql);
}else { } else {
equipmentsJxiopDocMysqlMapper.updateById(equipmentsJxiopDocMysql); equipmentsJxiopDocMysqlMapper.updateById(equipmentsJxiopDocMysql);
} }
}); });
} catch (Exception e) { } catch (Exception e) {
...@@ -247,7 +217,7 @@ public class DemoController extends BaseController { ...@@ -247,7 +217,7 @@ public class DemoController extends BaseController {
@ApiOperation(value = "从Mysql同步数据到ES") @ApiOperation(value = "从Mysql同步数据到ES")
@GetMapping("doc/getDatafromMySqlToES") @GetMapping("doc/getDatafromMySqlToES")
public void getDatafromMySqlToES() { public void getDatafromMySqlToES() {
List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().like("front_module","泰和功率预测")); List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().like("front_module", "泰和功率预测"));
equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> { equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> {
ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get(); ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get();
//更新显示名称 //更新显示名称
...@@ -268,6 +238,47 @@ public class DemoController extends BaseController { ...@@ -268,6 +238,47 @@ public class DemoController extends BaseController {
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入整理的测点数据到MySQL同时更新es")
@PostMapping("doc/importDatafAndUpdateEs")
public void getDatafromMySqlToES(@RequestParam String filePath) {
try {
InputStream inputStream = new FileInputStream(filePath);
List<Object> pointImportDtoList = EasyExcel.read(inputStream).head(PointImportDto.class).sheet(0).headRowNumber(1).doReadSync();
pointImportDtoList.forEach(o -> {
PointImportDto pointImportDto = (PointImportDto) o;
List<EquipmentsJxiopDocMysql> equipmentsJxiopDocMysqlList = equipmentsJxiopDocMysqlMapper.selectList(new QueryWrapper<EquipmentsJxiopDocMysql>().eq("gateway_id", pointImportDto.getGatewayId()).eq("equipment_index_name",pointImportDto.getEquipmentIndexName()));
if(!ObjectUtils.isEmpty(equipmentsJxiopDocMysqlList)){
equipmentsJxiopDocMysqlList.forEach(equipmentsJxiopDocMysql -> {
ESEquipments esEquipments = equipmentsRepository.findById(equipmentsJxiopDocMysql.getId()).get();
//更新模块
equipmentsJxiopDocMysql.setFrontModule(pointImportDto.getFrontModule());
esEquipments.setFrontModule(pointImportDto.getFrontModule());
//更新类型
equipmentsJxiopDocMysql.setSystemType(pointImportDto.getSystemType());
esEquipments.setSystemType(pointImportDto.getSystemType());
//更新排序号
equipmentsJxiopDocMysql.setTraceId(pointImportDto.getTraceId());
esEquipments.setTraceId(pointImportDto.getTraceId());
//更新显示名称
equipmentsJxiopDocMysql.setDisplayName(pointImportDto.getDisplayName());
esEquipments.setDisplayName(pointImportDto.getDisplayName());
//更新单位
if(!ObjectUtils.isEmpty(pointImportDto.getUnit())){
equipmentsJxiopDocMysql.setUnit(pointImportDto.getUnit());
esEquipments.setUnit(pointImportDto.getUnit());
}
equipmentsJxiopDocMysqlMapper.updateById(equipmentsJxiopDocMysql);
equipmentsRepository.save(esEquipments);
});
}
});
} catch (Exception e) {
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试消息发送") @ApiOperation(value = "测试消息发送")
@GetMapping("/test5") @GetMapping("/test5")
public void demoTest4() { public void demoTest4() {
...@@ -295,39 +306,39 @@ public class DemoController extends BaseController { ...@@ -295,39 +306,39 @@ public class DemoController extends BaseController {
int num = 0; int num = 0;
for (int i = 0; i < strings.length; i++) { for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentsJxiopDocMysql> QueryWrapper = new QueryWrapper<>();
// 夏造风电 // 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089"); // QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏 // 泰和光伏
QueryWrapper.eq("gateway", strings[i]); QueryWrapper.eq("gateway", strings[i]);
long DATE = new Date().getTime(); long DATE = new Date().getTime();
System.out.println(DATE); System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper); List<EquipmentsJxiopDocMysql> list = equipmentsJxiopDocMysqlMapper.selectList(QueryWrapper);
num = num + list.size(); num = num + list.size();
List<ESEquipments> listit = new ArrayList<>(); List<ESEquipments> listit = new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) { for (EquipmentsJxiopDocMysql monitorFanIndicator : list) {
ESEquipments eSEquipments = new ESEquipments( ESEquipments eSEquipments = new ESEquipments(
null, monitorFanIndicator.getValueF(),
monitorFanIndicator.getAddressGateway(), monitorFanIndicator.getId(),
monitorFanIndicator.getIndexAddress(), monitorFanIndicator.getAddress(),
monitorFanIndicator.getDataType(), monitorFanIndicator.getDataType(),
monitorFanIndicator.getFanCode(), monitorFanIndicator.getEquipmentSpecificName(),
monitorFanIndicator.getGateway(), monitorFanIndicator.getGatewayId(),
monitorFanIndicator.getIsAlarm(), monitorFanIndicator.getIsAlarm(),
new Date(), monitorFanIndicator.getCreatedTime(),
monitorFanIndicator.getUnit(), monitorFanIndicator.getUnit(),
"", monitorFanIndicator.getValue(),
"", monitorFanIndicator.getValueLabel(),
"", monitorFanIndicator.getTraceId(),
monitorFanIndicator.getIndicator(), monitorFanIndicator.getEquipmentIndexName(),
monitorFanIndicator.getEquipmentNumber(), monitorFanIndicator.getEquipmentNumber(),
monitorFanIndicator.getFrontModule(), monitorFanIndicator.getFrontModule(),
monitorFanIndicator.getSystemType(), monitorFanIndicator.getSystemType(),
monitorFanIndicator.getPictureName(), monitorFanIndicator.getPictureName(),
monitorFanIndicator.getEquipmentNumber()); monitorFanIndicator.getDisplayName());
listit.add(eSEquipments); listit.add(eSEquipments);
...@@ -465,192 +476,6 @@ public class DemoController extends BaseController { ...@@ -465,192 +476,6 @@ public class DemoController extends BaseController {
return commonServiceImpl.getListStationCacheInfoDto(); return commonServiceImpl.getListStationCacheInfoDto();
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组平均数")
@GetMapping("/test13")
public Map demoTest13() {
List<String> value = new ArrayList<>();
value.add(ss);
value.add(zfs);
value.add(zfslj);
Map<String, List<String>> map = new HashMap<>();
map.put("equipmentIndexName.keyword", value);
// List<String> value1=new ArrayList<>();
// value1.add("1668801435891929089");
// map.put("gatewayId.keyword",value1);
List<? extends Terms.Bucket> lidate = commonServiceImpl.getgroupavg(map, "valueF", "equipmentIndexName.keyword", ESEquipments.class);
Map<String, Object> mapdta = new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
for (Terms.Bucket bucket : lidate) {
Aggregations aggregation = bucket.getAggregations();
List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null;
for (Aggregation agg : listdata) {
ParsedAvg parsedAvg = (ParsedAvg) agg;
mapdta.put(bucket.getKeyAsString(), format2.format(parsedAvg.getValue()));
}
}
return mapdta;
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分组求和数")
@GetMapping("/test14")
public Map demoTest14() {
List<String> value = new ArrayList<>();
value.add("年发电量");
Map<String, List<String>> map = new HashMap<>();
map.put("equipmentIndexName.keyword", value);
List<String> value1 = new ArrayList<>();
value1.add("1668801435891929089");
map.put("gatewayId.keyword", value1);
List<? extends Terms.Bucket> lidate = commonServiceImpl.getgroupsum(map, "valueF", "equipmentIndexName.keyword", ESEquipments.class);
Map<String, Object> mapdta = new HashMap<>();
DecimalFormat format2 = new DecimalFormat("#.0000");
for (Terms.Bucket bucket : lidate) {
Aggregations aggregation = bucket.getAggregations();
List<Aggregation> listdata = Objects.nonNull(aggregation) ? aggregation.asList() : null;
for (Aggregation agg : listdata) {
ParsedSum parsedSum = (ParsedSum) agg;
mapdta.put(bucket.getKeyAsString(), format2.format(parsedSum.getValue()));
}
}
return mapdta;
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "分组求和数")
// @GetMapping("/test15")
// public Map test15() {
//
//// Map<String,Double> map= largeScreenImpl.getqg();
//
// return map;
// }
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "分组求和数")
// @GetMapping("/test16")
// public Map test16() {
//
// //获取每个区域下所有风机网管
// List<StationCacheInfoDto> listk =commonServiceImpl.getListStationCacheInfoDto();
//
// Map<String, List<StationCacheInfoDto>> map = listk.stream().filter(v -> StringUtils.isNotEmpty(v.getBelongArea())).collect(Collectors.groupingBy(StationCacheInfoDto :: getBelongArea));
// Map<String,Double> maps=null;
//
// for(String key:map.keySet()){
// List<String> value1=new ArrayList<>();
//
// List<StationCacheInfoDto> list= map.get(key);
//
// for (StationCacheInfoDto stationCacheInfoDto : list) {
// value1.add(stationCacheInfoDto.getBoosterGatewayId());
// value1.add(stationCacheInfoDto.getFanGatewayId());
// }
//
// maps= largeScreenImpl.getqy(value1);
// break;
// }
//
// return maps;
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化inlfuxdb-new")
@GetMapping("/test17")
public ResponseModel<Integer> demoTest17() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String[] strings = {"1668801570352926721", "1669525017559306241"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
int num = 0;
for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏
QueryWrapper.eq("gateway", strings[i]);
QueryWrapper.eq("front_module", "电量表计");
QueryWrapper.eq("system_type", "模拟量");
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
num = num + list.size();
List<ESEquipments> listit = new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
// maps2.put("address", monitorFanIndicator.getIndexAddress());
// maps2.put("dataType", monitorFanIndicator.getDataType());
// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
// maps2.put("gatewayId", monitorFanIndicator.getGateway());
// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
// maps2.put("createdTime", "2023-07-05 18:30:26");
// maps2.put("unit", monitorFanIndicator.getUnit());
// maps2.put("value", "");
// maps2.put("traceId", "");
// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule", "模拟量");
// maps2.put("systemType", monitorFanIndicator.getSystemType());
// maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
// maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
}
}
return ResponseHelper.buildResponse(num);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "分组求和数")
// @GetMapping("/test18")
// public Map test18() {
// List<StationCacheInfoDto> list = commonServiceImpl.getListStationCacheInfoDto();
// //获取时间天字符串
//
// String datyvalue= "2023-08-11";
// elasticsearchTemplate.deleteIndex(ESDailyPowerGeneration.class);
// elasticsearchTemplate.deleteIndex(ESMoonPowerGeneration.class);
// elasticsearchTemplate.deleteIndex(ESYearPowerGeneration.class);
//
// for (StationCacheInfoDto stationCacheInfoDto : list) {
// if("FDZ".equals(stationCacheInfoDto.getStationType())){
//
// //风机
// powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"FDZ",datyvalue);
// powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"FDZ",datyvalue);
// powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"FDZ",datyvalue);
//
// }else{
//
// //光伏
// powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), dayvalue, dayDateFormat, dayType,"GFDZ",datyvalue);
// powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), moonValue, moonDateFormat, moonType,"GFDZ",datyvalue);
// powerGenerationImpl.addPowerGeneration( stationCacheInfoDto, stationCacheInfoDto.getFanGatewayId(), yearValue, yearDateFormat, yearType,"GFDZ",datyvalue);
//
// }
// }
//
// return null;
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "es获取数据") @ApiOperation(value = "es获取数据")
@GetMapping("/test19") @GetMapping("/test19")
......
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class PointImportDto {
@ExcelProperty("网关")
private String gatewayId ;
@ExcelProperty("模块")
private String frontModule;
@ExcelProperty("类型")
private String systemType;
@ExcelProperty("排序号")
private String traceId;
@ExcelProperty("测点名称")
private String equipmentIndexName;
@ExcelProperty("显示名称")
private String displayName;
@ExcelProperty("单位")
private String unit;
}
...@@ -13,8 +13,6 @@ import java.util.Map; ...@@ -13,8 +13,6 @@ import java.util.Map;
* @createDate: 2023/7/3 * @createDate: 2023/7/3
*/ */
public interface IMonitorFanIndicator { public interface IMonitorFanIndicator {
//批量修改指标值
void UpdateMonitorFanIndicator(List<IndexDto> list);
ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber); ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
......
...@@ -117,10 +117,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -117,10 +117,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private List<Map> list; private List<Map> list;
@Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) {
monitorFanIndicatorregionMapper.UpdateMonitorFanIndicator(list);
}
@Override @Override
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
...@@ -294,28 +291,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -294,28 +291,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return treeDto; return treeDto;
} }
/**
* 根据网关与指标获取指标的平均值
*
* @param gateway
* @param indicator
* @return
*/
public Object getIndicatoralueAvage(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueAvage(gateway, indicator);
}
/**
* 根据网关与指标获取指标的总值
*
* @param gateway
* @param indicator
* @return
*/
public Object getIndicatoralueTotal(String gateway, String indicator) {
return monitorFanIndicatorregionMapper.getIndicatoralueTotal(gateway, indicator);
}
public StationBasic getOneByStationNumber(String stationId) { public StationBasic getOneByStationNumber(String stationId) {
......
...@@ -4,11 +4,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller; ...@@ -4,11 +4,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments; 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; import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test; import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
...@@ -45,10 +43,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -45,10 +43,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
@RestController @RestController
...@@ -146,81 +142,81 @@ public class DemoController extends BaseController { ...@@ -146,81 +142,81 @@ public class DemoController extends BaseController {
// System.out.println(list2.size()); // System.out.println(list2.size());
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化influxdb-风电、光伏、升压站") // @ApiOperation(value = "初始化influxdb-风电、光伏、升压站")
@GetMapping("doc/test4") // @GetMapping("doc/test4")
public ResponseModel<Integer> demoTest3() { // public ResponseModel<Integer> demoTest3() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站 // //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"}; // String [] strings = {"1668801435891929089","1669524885619085313","1668801570352926721","1669525017559306241"};
// String [] strings = {"1669524885619085313"}; //// String [] strings = {"1669524885619085313"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速"); //// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString()); //// System.out.println(o.toString());
elasticsearchTemplate.deleteIndex(ESEquipments.class); // elasticsearchTemplate.deleteIndex(ESEquipments.class);
int num=0; // int num=0;
for (int i = 0; i < strings.length; i++) { // for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>(); // QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// 夏造风电 //// 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089"); //// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏 //// 泰和光伏
QueryWrapper.eq("gateway", strings[i]); // QueryWrapper.eq("gateway", strings[i]);
long DATE = new Date().getTime(); // long DATE = new Date().getTime();
System.out.println(DATE); // System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper); // List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
num=num+list.size(); // num=num+list.size();
List<ESEquipments> listit =new ArrayList<>(); // List<ESEquipments> listit =new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) { // for (MonitorFanIndicator monitorFanIndicator : list) {
ESEquipments eSEquipments=new ESEquipments(
null,
monitorFanIndicator.getAddressGateway(),
monitorFanIndicator.getIndexAddress(),
monitorFanIndicator.getDataType(),
monitorFanIndicator.getFanCode(),
monitorFanIndicator.getGateway(),
monitorFanIndicator.getIsAlarm(),
new Date(),
monitorFanIndicator.getUnit(),
"",
"" ,
"",
monitorFanIndicator.getIndicator(),
monitorFanIndicator.getEquipmentNumber(),
monitorFanIndicator.getFrontModule(),
monitorFanIndicator.getSystemType(),
monitorFanIndicator.getPictureName(),
monitorFanIndicator.getEquipmentNumber());
listit.add(eSEquipments);
// Map<String, String> tag = new HashMap<>();
// Map<String, Object> maps2 = new HashMap<>();
// //
// maps2.put("address", monitorFanIndicator.getIndexAddress()); // ESEquipments eSEquipments=new ESEquipments(
// maps2.put("dataType", monitorFanIndicator.getDataType()); // null,
// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode()); // monitorFanIndicator.getAddressGateway(),
// tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway()); // monitorFanIndicator.getIndexAddress(),
// maps2.put("gatewayId", monitorFanIndicator.getGateway()); // monitorFanIndicator.getDataType(),
// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm()); // monitorFanIndicator.getFanCode(),
// maps2.put("createdTime", "2023-07-05 18:30:26"); // monitorFanIndicator.getGateway(),
// maps2.put("unit", monitorFanIndicator.getUnit()); // monitorFanIndicator.getIsAlarm(),
// maps2.put("value", ""); // new Date(),
// maps2.put("valueLabel","" ); // monitorFanIndicator.getUnit(),
// maps2.put("traceId", ""); // "",
// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator()); // "" ,
// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber()); // "",
// maps2.put("frontModule", monitorFanIndicator.getFrontModule()); // monitorFanIndicator.getIndicator(),
// maps2.put("systemType", monitorFanIndicator.getSystemType()); // monitorFanIndicator.getEquipmentNumber(),
// maps2.put("pictureName", monitorFanIndicator.getPictureName()); // monitorFanIndicator.getFrontModule(),
// //升压站的字段显示名称 // monitorFanIndicator.getSystemType(),
// maps2.put("displayName", ""); // monitorFanIndicator.getPictureName(),
// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS); // monitorFanIndicator.getEquipmentNumber());
//
} // listit.add(eSEquipments);
equipmentsRepository.saveAll(listit); //
} //
return ResponseHelper.buildResponse(num); //// Map<String, String> tag = new HashMap<>();
} //// Map<String, Object> maps2 = new HashMap<>();
////
//// maps2.put("address", monitorFanIndicator.getIndexAddress());
//// maps2.put("dataType", monitorFanIndicator.getDataType());
//// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
//// tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
//// maps2.put("gatewayId", monitorFanIndicator.getGateway());
//// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
//// maps2.put("createdTime", "2023-07-05 18:30:26");
//// maps2.put("unit", monitorFanIndicator.getUnit());
//// maps2.put("value", "");
//// maps2.put("valueLabel","" );
//// maps2.put("traceId", "");
//// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
//// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
//// maps2.put("frontModule", monitorFanIndicator.getFrontModule());
//// maps2.put("systemType", monitorFanIndicator.getSystemType());
//// maps2.put("pictureName", monitorFanIndicator.getPictureName());
//// //升压站的字段显示名称
//// maps2.put("displayName", "");
//// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
//
// }
// equipmentsRepository.saveAll(listit);
// }
// return ResponseHelper.buildResponse(num);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试消息发送") @ApiOperation(value = "测试消息发送")
...@@ -238,88 +234,88 @@ public class DemoController extends BaseController { ...@@ -238,88 +234,88 @@ public class DemoController extends BaseController {
} }
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化升压站") // @ApiOperation(value = "初始化升压站")
@GetMapping("/test6") // @GetMapping("/test6")
public ResponseModel<Integer> demoTest5() { // public ResponseModel<Integer> demoTest5() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站 // //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801570352926721","1669525017559306241"}; // String [] strings = {"1668801570352926721","1669525017559306241"};
// String [] strings = {"1669525017559306241"}; //// String [] strings = {"1669525017559306241"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速"); //// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString()); //// System.out.println(o.toString());
int num=0;
for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏
QueryWrapper.eq("gateway", strings[i]);
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
num=num+list.size();
List<ESEquipments> listit =new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) {
ESEquipments eSEquipments=new ESEquipments(
null,
monitorFanIndicator.getAddressGateway(),
monitorFanIndicator.getIndexAddress(),
monitorFanIndicator.getDataType(),
monitorFanIndicator.getFanCode(),
monitorFanIndicator.getGateway(),
monitorFanIndicator.getIsAlarm(),
new Date(),
monitorFanIndicator.getUnit(),
"",
"" ,
"",
monitorFanIndicator.getIndicator(),
monitorFanIndicator.getEquipmentNumber(),
monitorFanIndicator.getFrontModule(),
monitorFanIndicator.getSystemType(),
monitorFanIndicator.getPictureName(),
monitorFanIndicator.getEquipmentNumber() );
listit.add(eSEquipments);
// Map<String, String> tag = new HashMap<>();
// Map<String, Object> maps2 = new HashMap<>();
// //
// maps2.put("address", monitorFanIndicator.getIndexAddress()); // int num=0;
// maps2.put("dataType", monitorFanIndicator.getDataType()); // for (int i = 0; i < strings.length; i++) {
// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode()); // QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway()); //// 夏造风电
// maps2.put("gatewayId", monitorFanIndicator.getGateway()); //// QueryWrapper.eq("gateway", "1668801435891929089");
// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm()); //// 泰和光伏
// maps2.put("createdTime", "2023-07-05 18:30:26"); // QueryWrapper.eq("gateway", strings[i]);
// maps2.put("unit", monitorFanIndicator.getUnit()); // long DATE = new Date().getTime();
// maps2.put("value", ""); // System.out.println(DATE);
// maps2.put("valueLabel","" ); // List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
// maps2.put("traceId", ""); // num=num+list.size();
// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator()); //
// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber()); // List<ESEquipments> listit =new ArrayList<>();
// maps2.put("frontModule", monitorFanIndicator.getFrontModule()); // for (MonitorFanIndicator monitorFanIndicator : list) {
// maps2.put("systemType", monitorFanIndicator.getSystemType()); //
// maps2.put("pictureName", monitorFanIndicator.getPictureName()); //
// //升压站的字段显示名称 // ESEquipments eSEquipments=new ESEquipments(
// maps2.put("displayName", monitorFanIndicator.getEquipmentNumber()); // null,
// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS); // monitorFanIndicator.getAddressGateway(),
} // monitorFanIndicator.getIndexAddress(),
// monitorFanIndicator.getDataType(),
equipmentsRepository.saveAll(listit); // monitorFanIndicator.getFanCode(),
} // monitorFanIndicator.getGateway(),
return ResponseHelper.buildResponse(num); // monitorFanIndicator.getIsAlarm(),
} // new Date(),
// monitorFanIndicator.getUnit(),
// "",
// "" ,
// "",
// monitorFanIndicator.getIndicator(),
// monitorFanIndicator.getEquipmentNumber(),
// monitorFanIndicator.getFrontModule(),
// monitorFanIndicator.getSystemType(),
// monitorFanIndicator.getPictureName(),
// monitorFanIndicator.getEquipmentNumber() );
//
// listit.add(eSEquipments);
//
//
//
//
//
//
//
//// Map<String, String> tag = new HashMap<>();
//// Map<String, Object> maps2 = new HashMap<>();
////
//// maps2.put("address", monitorFanIndicator.getIndexAddress());
//// maps2.put("dataType", monitorFanIndicator.getDataType());
//// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
//// tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
//// maps2.put("gatewayId", monitorFanIndicator.getGateway());
//// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
//// maps2.put("createdTime", "2023-07-05 18:30:26");
//// maps2.put("unit", monitorFanIndicator.getUnit());
//// maps2.put("value", "");
//// maps2.put("valueLabel","" );
//// maps2.put("traceId", "");
//// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
//// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
//// maps2.put("frontModule", monitorFanIndicator.getFrontModule());
//// maps2.put("systemType", monitorFanIndicator.getSystemType());
//// maps2.put("pictureName", monitorFanIndicator.getPictureName());
//// //升压站的字段显示名称
//// maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
//// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
// }
//
// equipmentsRepository.saveAll(listit);
// }
// return ResponseHelper.buildResponse(num);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试动态图片") @ApiOperation(value = "测试动态图片")
...@@ -527,57 +523,57 @@ public class DemoController extends BaseController { ...@@ -527,57 +523,57 @@ public class DemoController extends BaseController {
// return maps; // return maps;
// } // }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) // @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化inlfuxdb-new") // @ApiOperation(value = "初始化inlfuxdb-new")
@GetMapping("/test17") // @GetMapping("/test17")
public ResponseModel<Integer> demoTest17() { // public ResponseModel<Integer> demoTest17() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站 // //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801570352926721","1669525017559306241"}; // String [] strings = {"1668801570352926721","1669525017559306241"};
//
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速"); //// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString()); //// System.out.println(o.toString());
//
int num=0; // int num=0;
for (int i = 0; i < strings.length; i++) { // for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>(); // QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// 夏造风电 //// 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089"); //// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏 //// 泰和光伏
QueryWrapper.eq("gateway", strings[i]); // QueryWrapper.eq("gateway", strings[i]);
QueryWrapper.eq("front_module","电量表计"); // QueryWrapper.eq("front_module","电量表计");
QueryWrapper.eq("system_type","模拟量"); // QueryWrapper.eq("system_type","模拟量");
long DATE = new Date().getTime(); // long DATE = new Date().getTime();
System.out.println(DATE); // System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper); // List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
num=num+list.size(); // num=num+list.size();
//
List<ESEquipments> listit =new ArrayList<>(); // List<ESEquipments> listit =new ArrayList<>();
for (MonitorFanIndicator monitorFanIndicator : list) { // for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>(); // Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>(); // Map<String, Object> maps2 = new HashMap<>();
//
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway()); // tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
// maps2.put("address", monitorFanIndicator.getIndexAddress()); // // maps2.put("address", monitorFanIndicator.getIndexAddress());
// maps2.put("dataType", monitorFanIndicator.getDataType()); // // maps2.put("dataType", monitorFanIndicator.getDataType());
// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode()); // // maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
// maps2.put("gatewayId", monitorFanIndicator.getGateway()); // // maps2.put("gatewayId", monitorFanIndicator.getGateway());
// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm()); // // maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
// maps2.put("createdTime", "2023-07-05 18:30:26"); // // maps2.put("createdTime", "2023-07-05 18:30:26");
// maps2.put("unit", monitorFanIndicator.getUnit()); // // maps2.put("unit", monitorFanIndicator.getUnit());
// maps2.put("value", ""); // // maps2.put("value", "");
// maps2.put("traceId", ""); // // maps2.put("traceId", "");
// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator()); // // maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber()); // // maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule","模拟量"); // maps2.put("frontModule","模拟量");
// maps2.put("systemType", monitorFanIndicator.getSystemType()); // // maps2.put("systemType", monitorFanIndicator.getSystemType());
// maps2.put("pictureName", monitorFanIndicator.getPictureName()); // // maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称 // //升压站的字段显示名称
// maps2.put("displayName", monitorFanIndicator.getEquipmentNumber()); // // maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS); //// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
} // }
} // }
return ResponseHelper.buildResponse(num); // return ResponseHelper.buildResponse(num);
} // }
......
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