Commit 04c57b16 authored by caotao's avatar caotao

更新数据代码

parent c85b235e
......@@ -48,7 +48,7 @@ public class AnalyseController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据")
@GetMapping(value = "/getInfluxdbDataByConditon")
public ResponseModel<List<Map<String, Object>>> getInfluxdbDataByConditon(@RequestParam String gateaway, @RequestParam String indictorName, @RequestParam String startTime, @RequestParam String endTime) {
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(gateaway,indictorName,startTime, endTime)) ;
public ResponseModel<List<Map<String, Object>>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam String startTime, @RequestParam String endTime) {
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
}
}
......@@ -5,10 +5,11 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizC80c;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizHjev;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizUxfv;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBiz3yudMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizC80cMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizHjevMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizUxfvMapper;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.slf4j.Logger;
......@@ -70,7 +71,7 @@ public class CommonServiceImpl {
private IdxBizC80cMapper idxBizC80cMapper;
// idx_biz_hjev 光伏监测变量
@Autowired
private IdxBizHjevMapper idxBizHjevMapper;
private IdxBizPvPointProcessVariableClassificationMapper idxBizPvPointProcessVariableClassificationMapper;
// idx_biz_3yud 光伏工况变量划分
@Autowired
private IdxBiz3yudMapper idxBiz3yudMapper;
......@@ -80,22 +81,6 @@ public class CommonServiceImpl {
@Autowired
InfluxdbUtil influxdbUtil;
public List<IdxBizC80c> getAllFanstationTestPoint() {
List<IdxBizC80c> idxBizC80cList = new ArrayList<>();
idxBizC80cList = idxBizC80cMapper.selectList(new QueryWrapper<IdxBizC80c>().isNotNull("SEQUENCE_NBR"));
return idxBizC80cList;
}
public List<IdxBizHjev> getAllPVstationTestPoint() {
List<IdxBizHjev> idxBizC80cList = new ArrayList<>();
idxBizC80cList = idxBizHjevMapper.selectList(new QueryWrapper<IdxBizHjev>().isNotNull("SEQUENCE_NBR"));
return idxBizC80cList;
}
public List<String> getGateWayId() {
List<String> gateWayIdList = idxBizC80cMapper.gateWayIdListFan();
return gateWayIdList;
}
/**
* @return
......@@ -350,7 +335,7 @@ public class CommonServiceImpl {
realParams.put(gkzxzjskey2, values);
String response = HttpUtil.createPost(baseUrl + gkzxzjsurl).body(JSON.toJSONString(realParams)).execute().body();
try {
logger.info("--------------------repsonse: "+response);
logger.info("--------------------repsonse: " + response);
TimeUnit.SECONDS.sleep(sleepTime);
logger.info("------------------------------------------调用中心值计算算法结束----------------------------------------");
} catch (InterruptedException e) {
......@@ -387,8 +372,15 @@ public class CommonServiceImpl {
return resultList;
}
public List<Map<String, Object>> getInfluxdbDataByConditon(String gateaway,String indictorName,String startTime,String endTime) {
String sql = String.format("select * from iot_data_%s where indictorName='%s' and time > '%s' and time < '%s' ;",gateaway,indictorName,startTime,endTime);
public List<Map<String, Object>> getInfluxdbDataByConditon(String stationType, String pointId, String startTime, String endTime) {
String sql = "";
if ("FD".equals(stationType)) {
IdxBizUxfv idxBizUxfv = idxBizUxfvMapper.selectById(pointId);
sql = String.format("select * from iot_data_%s where address ='%s' and time > '%s' and time < '%s' ;", idxBizUxfv.getGatewayId(), idxBizUxfv.getIndexAddress(), startTime, endTime);
} else {
IdxBizPvPointProcessVariableClassification idxBizPvPointProcessVariableClassification = idxBizPvPointProcessVariableClassificationMapper.selectById(pointId);
sql = String.format("select * from iot_data_%s where address ='%s' and time > '%s' and time < '%s' ;", idxBizPvPointProcessVariableClassification.getGatewayId(), idxBizPvPointProcessVariableClassification.getIndexAddress(), startTime, endTime);
}
return influxdbUtil.query(sql);
}
}
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