Commit 973ea840 authored by tangwei's avatar tangwei

增加初始化方法

parent 2643f2be
......@@ -45,7 +45,8 @@ public class MonitorFanIndicator extends BaseEntity {
private String addressGateway;//地址加网管
@TableField("equipment_number")
private String equipmentNumber; //设备编号
@TableField("data_type")
private String dataType; //设备编号
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
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.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
......@@ -24,10 +27,8 @@ import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
@RestController
@Api(tags = "Demo-test")
......@@ -53,7 +54,8 @@ public class DemoController extends BaseController {
MonitorFanIndicatorImpl monitorFanIndicatorImpl;
@Autowired
InfluxDButils influxDButils;
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试prodcutcion 库")
......@@ -79,8 +81,40 @@ public class DemoController extends BaseController {
@ApiOperation(value = "测试获取风速平均值")
@GetMapping("/test4")
public void demoTest3() {
Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
System.out.println(o.toString());
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
QueryWrapper<MonitorFanIndicator> QueryWrapper= new QueryWrapper<>();
QueryWrapper.eq("gateway","1668801435891929089");
long DATE =new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list=monitorFanIndicatorregionMapper.selectList(QueryWrapper);
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
tag.put("address",monitorFanIndicator.getIndexAddress() );
tag.put("dataType", monitorFanIndicator.getDataType());
tag.put("equipmentSpecificName",monitorFanIndicator.getFanCode() );
tag.put("equipmentsIdx",monitorFanIndicator.getAddressGateway() );
tag.put("gatewayId", monitorFanIndicator.getGateway());
tag.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", null);
maps2.put("valueLabel",null );
maps2.put("traceId", null);
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
maps2.put("systemType", monitorFanIndicator.getSystemType());
influxDbConnection.insert("indicators_"+monitorFanIndicator.getGateway(), tag, maps2,1688558007051L, TimeUnit.MILLISECONDS);
}
}
......
......@@ -59,7 +59,6 @@ public class MonitorFanIdxController extends BaseController {
@RequestParam(value = "gateway", required = false) String gateway,
@RequestParam(value = "current", required = false) int current,
@RequestParam(value = "size", required = false) int size) {
String[] gateways=gateway.split(",");
IPage<RunRecord> page= monitorFanIndicator.queryRunRecord( size,gateways, current);
return ResponseHelper.buildResponse(page);
......
......@@ -26,7 +26,7 @@ public class StationDataTask {
//定时获取场站指标最新数据
@Scheduled(cron = "${station.task.cron}")
// @Scheduled(cron = "${station.task.cron}")
public void getStationDataTask(){
//获取所有场站信息
List<StationTaksDto> list=stationDataTask.getListStationBasic();
......
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