Commit 62374488 authored by wujiang's avatar wujiang

修复分析计算

parent ea99dc0e
package com.yeejoin.amos.boot.module.jxiop.biz.Enum; package com.yeejoin.amos.boot.module.jxiop.biz.Enum;
public enum SmartAnalyseEnum { public enum SmartAnalyseEnum {
FAN_QJHF("FAN_QJHF", "风机区间变量划分"),
FAN_XGX("FAN_XGX","风机相关性"),
FAN_ZXZ("FAN_ZXZ","风机中心值"), FAN_QJHF("FAN_QJHF", "风机区间变量划分"),
PV_QJHF("PV_QJHF","光伏区间变量划分"), FAN_XGX("FAN_XGX", "风机相关性"),
PV_XGX("PV_XGX","光伏相关性"), FAN_ZXZ("FAN_ZXZ", "风机中心值"),
PV_ZXZ("PV_ZXZ","光伏中心值"); PV_QJHF("PV_QJHF", "光伏区间变量划分"),
private String key; PV_XGX("PV_XGX", "光伏相关性"),
private String name;
public String getKey() { PV_ZXZ("PV_ZXZ", "光伏中心值");
return key;
}
public void setKey(String key) { private String key;
this.key = key;
}
public String getName() { private String name;
return name;
}
public void setName(String name) { public String getKey() {
this.name = name; return key;
} }
SmartAnalyseEnum(String key, String name) { public void setKey(String key) {
this.key = key; this.key = key;
this.name = name; }
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
SmartAnalyseEnum(String key, String name) {
this.key = key;
this.name = name;
}
} }
...@@ -76,7 +76,7 @@ public class TdEngineConfig { ...@@ -76,7 +76,7 @@ public class TdEngineConfig {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean(); final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(culsterDataSource); sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(TdEngineConfig.MAPPER_LOCATION)); .getResources(MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity"); sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置 //mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true); sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
......
...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; ...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.SmartAnalyseEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariableClassification; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
...@@ -45,273 +46,308 @@ import java.util.stream.Collectors; ...@@ -45,273 +46,308 @@ import java.util.stream.Collectors;
@RequestMapping(value = "/analyse") @RequestMapping(value = "/analyse")
public class AnalyseController extends BaseController { public class AnalyseController extends BaseController {
@Autowired @Autowired
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
@Autowired @Autowired
IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper; IdxBizFanHealthIndexMapper idxBizFanHealthIndexMapper;
@Autowired @Autowired
IAlarmInfoDetailService iAlarmInfoDetailService; IAlarmInfoDetailService iAlarmInfoDetailService;
@Autowired @Autowired
FanHealthIndexMapper fanHealthIndexMapper; FanHealthIndexMapper fanHealthIndexMapper;
@Autowired @Autowired
PvHealthIndexMapper pvHealthIndexMapper; PvHealthIndexMapper pvHealthIndexMapper;
@Autowired @Autowired
IPermissionService permissionService; IPermissionService permissionService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机") @ApiOperation(httpMethod = "GET", value = "获取执行结果", notes = "获取执行结果")
@GetMapping(value = "/getFanConditionVariablesByTime") @GetMapping(value = "/isRun")
public ResponseModel<String> getFanConditionVariablesByTime(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { public ResponseModel<String> isRun(@RequestParam(required = true) String key) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { return ResponseHelper.buildResponse(commonServiceImpl.isRun(key));
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); }
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); @ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机")
} @GetMapping(value = "/getFanConditionVariablesByTime")
return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeThread(startTime, endTime)); public ResponseModel<String> getFanConditionVariablesByTime(@RequestParam(required = false) String startTime,
} @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
@ApiOperation(httpMethod = "GET", value = "工况测点区间划分-光伏", notes = "工况测点区间划分-光伏") Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
@GetMapping(value = "/getPvConditionVariablesByTime") startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
public ResponseModel<String> getPvConditionVariablesByTime(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { }
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeThread(startTime, endTime));
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); }
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
} @ApiOperation(httpMethod = "GET", value = "工况测点区间划分-光伏", notes = "工况测点区间划分-光伏")
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeThread(startTime, endTime)); @GetMapping(value = "/getPvConditionVariablesByTime")
} public ResponseModel<String> getPvConditionVariablesByTime(@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
@ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机") Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
@GetMapping(value = "/getFanConditionVariablesByTimeAnalyse") Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
public ResponseModel<String> getFanConditionVariablesByTimeAnalyse(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); }
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeThread(startTime, endTime));
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); }
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
} @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyseThread(startTime, endTime)); @ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机")
} @GetMapping(value = "/getFanConditionVariablesByTimeAnalyse")
public ResponseModel<String> getFanConditionVariablesByTimeAnalyse(@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
@PostMapping(value = "/getFanConditionVariablesByTimeAnalyseNew") Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
@ApiOperation(httpMethod = "POST", value = "相关性分析 - 风机 - 新", notes = "相关性分析 - 风机 - 新") Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
public ResponseModel<Object> getFanConditionVariablesByTimeAnalyseNew() throws InterruptedException { startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
commonServiceImpl.chuli(); endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
return ResponseHelper.buildResponse(null); }
} return ResponseHelper
.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyseThread(startTime, endTime));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "相关性分析 - 光伏 - 新", notes = "相关性分析 - 光伏 - 新") @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getPvConditionVariablesByTimeAnalyseNew") @PostMapping(value = "/getFanConditionVariablesByTimeAnalyseNew")
public ResponseModel<String> getPvConditionVariablesByTimeAnalyseNew(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) throws InterruptedException { @ApiOperation(httpMethod = "POST", value = "相关性分析 - 风机 - 新", notes = "相关性分析 - 风机 - 新")
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { public ResponseModel<Object> getFanConditionVariablesByTimeAnalyseNew() throws InterruptedException {
startTime = DateUtils.convertDateToString(DateUtil.beginOfYear(new Date()), DateUtils.DATE_TIME_PATTERN); commonServiceImpl.chuli();
endTime = DateUtils.convertDateToString(DateUtils.getCurrentDayEndTime(new Date()), DateUtils.DATE_TIME_PATTERN); return ResponseHelper.buildResponse(null);
} }
commonServiceImpl.chuliPv(startTime, endTime);
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyseThread(startTime, endTime)); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
} @ApiOperation(httpMethod = "GET", value = "相关性分析 - 光伏 - 新", notes = "相关性分析 - 光伏 - 新")
@GetMapping(value = "/getPvConditionVariablesByTimeAnalyseNew")
public ResponseModel<String> getPvConditionVariablesByTimeAnalyseNew(
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime)
@ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机") throws InterruptedException {
@GetMapping(value = "/getPvConditionVariablesByTimeAnalyse") if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
public ResponseModel<String> getPvConditionVariablesByTimeAnalyse(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { startTime = DateUtils.convertDateToString(DateUtil.beginOfYear(new Date()), DateUtils.DATE_TIME_PATTERN);
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { endTime = DateUtils.convertDateToString(DateUtils.getCurrentDayEndTime(new Date()),
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); DateUtils.DATE_TIME_PATTERN);
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); }
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); commonServiceImpl.chuliPv(startTime, endTime);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); return ResponseHelper
} .buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyseThread(startTime, endTime));
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyseThread(startTime, endTime)); }
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机")
@ApiOperation(httpMethod = "GET", value = "中心值计算-风机", notes = "中心值计算-风机") @GetMapping(value = "/getPvConditionVariablesByTimeAnalyse")
@GetMapping(value = "/getFanConditionVariablesByTimeAnalyse1") public ResponseModel<String> getPvConditionVariablesByTimeAnalyse(@RequestParam(required = false) String startTime,
public ResponseModel<String> getFanConditionVariablesByTimeAnalyse1(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
} }
return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyse1Thread(startTime, endTime)); return ResponseHelper
} .buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyseThread(startTime, endTime));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "中心值计算-光伏", notes = "中心值计算-光伏") @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getPvConditionVariablesByTimeAnalyse1") @ApiOperation(httpMethod = "GET", value = "中心值计算-风机", notes = "中心值计算-风机")
public ResponseModel<String> getPvConditionVariablesByTimeAnalyse1(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { @GetMapping(value = "/getFanConditionVariablesByTimeAnalyse1")
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { public ResponseModel<String> getFanConditionVariablesByTimeAnalyse1(
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN); Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
} startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyse1Thread(startTime, endTime)); endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
} }
return ResponseHelper
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) .buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyse1Thread(startTime, endTime));
@ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据") }
@GetMapping(value = "/getInfluxdbDataByConditon")
public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) { @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "中心值计算-光伏", notes = "中心值计算-光伏")
if (!StringUtils.isEmpty(startTime)) { @GetMapping(value = "/getPvConditionVariablesByTimeAnalyse1")
try { public ResponseModel<String> getPvConditionVariablesByTimeAnalyse1(@RequestParam(required = false) String startTime,
Date date = DateUtils.dateAddHours(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN), -8); @RequestParam(required = false) String endTime) {
startTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN); if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
} catch (ParseException e) { Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
e.printStackTrace(); Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
} startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
if (!StringUtils.isEmpty(endTime)) { }
try { return ResponseHelper
Date date = DateUtils.dateAddHours(DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN), -8); .buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyse1Thread(startTime, endTime));
endTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN); }
} catch (ParseException e) {
e.printStackTrace(); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
} @ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据")
} @GetMapping(value = "/getInfluxdbDataByConditon")
if (StringUtils.isEmpty(startTime)) { public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType,
Date sevenAgoDayStartTime = null; @RequestParam String pointId, @RequestParam(required = false) String startTime,
try { @RequestParam(required = false) String endTime) {
sevenAgoDayStartTime = DateUtils.dateAddDays(new Date(), -7);
} catch (Exception e) { if (!StringUtils.isEmpty(startTime)) {
e.printStackTrace(); try {
} Date date = DateUtils.dateAddHours(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN), -8);
startTime = DateUtils.convertDateToString(DateUtils.dateAddHours(sevenAgoDayStartTime, -8), DateUtils.DATE_TIME_PATTERN); startTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} } catch (ParseException e) {
DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8); e.printStackTrace();
if (StringUtils.isEmpty(endTime)) { }
endTime = DateUtils.convertDateToString(DateUtils.dateAddHours(new Date(), -8), DateUtils.DATE_TIME_PATTERN); }
} if (!StringUtils.isEmpty(endTime)) {
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType, pointId, startTime, endTime)); try {
} Date date = DateUtils.dateAddHours(DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN), -8);
endTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) e.printStackTrace();
@ApiOperation(httpMethod = "GET", value = "根据测点查单位信息", notes = "根据测点查单位信息") }
@GetMapping(value = "/getUnitByIndexAddress") }
public ResponseModel<Map<String, String>> getUnitByIndexAddress(@RequestParam String stationType, @RequestParam String pointId) { if (StringUtils.isEmpty(startTime)) {
return ResponseHelper.buildResponse(commonServiceImpl.getUnitByIndexAddress(stationType, pointId)); Date sevenAgoDayStartTime = null;
} try {
sevenAgoDayStartTime = DateUtils.dateAddDays(new Date(), -7);
} catch (Exception e) {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) e.printStackTrace();
@ApiOperation(httpMethod = "post", value = "获取influxdb数据", notes = "获取influxdb数据") }
@PostMapping(value = "/getInfluxdbDataByConditon") startTime = DateUtils.convertDateToString(DateUtils.dateAddHours(sevenAgoDayStartTime, -8),
public ResponseModel<Map<String, Object>> getDataByConditon(@RequestParam String stationType, @RequestParam(required = false) String pointId, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime, @RequestBody Map<String, Object> map) { DateUtils.DATE_TIME_PATTERN);
if ("FD".equals(stationType)) { }
if (ObjectUtils.isEmpty(map.get("EQUIPINDEX")) || CharSequenceUtil.isEmpty(map.get("EQUIPINDEX").toString())) { DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8);
return ResponseHelper.buildResponse(new HashMap<>()); if (StringUtils.isEmpty(endTime)) {
} endTime = DateUtils.convertDateToString(DateUtils.dateAddHours(new Date(), -8),
LambdaQueryWrapper<IdxBizFanHealthIndex> indexLambdaQueryWrapper = new LambdaQueryWrapper<>(); DateUtils.DATE_TIME_PATTERN);
indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getStation, map.get("STATION")); }
indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getEquipmentName, map.get("EQUIPNAME")); return ResponseHelper
indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getPointName, map.get("EQUIPINDEX")).last("limit 1"); .buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType, pointId, startTime, endTime));
}
List<IdxBizFanHealthIndex> idxBizFanHealthIndices = idxBizFanHealthIndexMapper.selectList(indexLambdaQueryWrapper);
if (CollectionUtils.isNotEmpty(idxBizFanHealthIndices)) { @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
pointId = idxBizFanHealthIndices.get(0).getIndexAddress(); @ApiOperation(httpMethod = "GET", value = "根据测点查单位信息", notes = "根据测点查单位信息")
} @GetMapping(value = "/getUnitByIndexAddress")
} public ResponseModel<Map<String, String>> getUnitByIndexAddress(@RequestParam String stationType,
@RequestParam String pointId) {
if (!StringUtils.isEmpty(startTime)) { return ResponseHelper.buildResponse(commonServiceImpl.getUnitByIndexAddress(stationType, pointId));
try { }
Date date = DateUtils.dateAddHours(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN), -8);
startTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
} catch (ParseException e) { @ApiOperation(httpMethod = "post", value = "获取influxdb数据", notes = "获取influxdb数据")
e.printStackTrace(); @PostMapping(value = "/getInfluxdbDataByConditon")
} public ResponseModel<Map<String, Object>> getDataByConditon(@RequestParam String stationType,
} @RequestParam(required = false) String pointId, @RequestParam(required = false) String startTime,
if (!StringUtils.isEmpty(endTime)) { @RequestParam(required = false) String endTime, @RequestBody Map<String, Object> map) {
try { if ("FD".equals(stationType)) {
Date date = DateUtils.dateAddHours(DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN), -8); if (ObjectUtils.isEmpty(map.get("EQUIPINDEX"))
endTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN); || CharSequenceUtil.isEmpty(map.get("EQUIPINDEX").toString())) {
} catch (ParseException e) { return ResponseHelper.buildResponse(new HashMap<>());
e.printStackTrace(); }
} LambdaQueryWrapper<IdxBizFanHealthIndex> indexLambdaQueryWrapper = new LambdaQueryWrapper<>();
} indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getStation, map.get("STATION"));
if (StringUtils.isEmpty(startTime)) { indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getEquipmentName, map.get("EQUIPNAME"));
Date sevenAgoDayStartTime = null; indexLambdaQueryWrapper.eq(IdxBizFanHealthIndex::getPointName, map.get("EQUIPINDEX")).last("limit 1");
try {
sevenAgoDayStartTime = DateUtils.dateAddDays(new Date(), -7); List<IdxBizFanHealthIndex> idxBizFanHealthIndices = idxBizFanHealthIndexMapper
} catch (Exception e) { .selectList(indexLambdaQueryWrapper);
e.printStackTrace(); if (CollectionUtils.isNotEmpty(idxBizFanHealthIndices)) {
} pointId = idxBizFanHealthIndices.get(0).getIndexAddress();
startTime = DateUtils.convertDateToString(DateUtils.dateAddHours(sevenAgoDayStartTime, -8), DateUtils.DATE_TIME_PATTERN); }
} }
DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8);
if (StringUtils.isEmpty(endTime)) { if (!StringUtils.isEmpty(startTime)) {
endTime = DateUtils.convertDateToString(DateUtils.dateAddHours(new Date(), -8), DateUtils.DATE_TIME_PATTERN); try {
} Date date = DateUtils.dateAddHours(DateUtils.dateParse(startTime, DateUtils.DATE_TIME_PATTERN), -8);
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType, pointId, startTime, endTime)); startTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} } catch (ParseException e) {
e.printStackTrace();
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) }
@ApiOperation(httpMethod = "GET", value = "预警详情信息", notes = "预警详情信息") }
@GetMapping(value = "/getAlramInfoDetail") if (!StringUtils.isEmpty(endTime)) {
public ResponseModel<Map<String, Object>> getAlramInfoDetailOfFan(@RequestParam(required = true) String id, @RequestParam(required = true) String type) { try {
if ("FAN".equals(type)) { Date date = DateUtils.dateAddHours(DateUtils.dateParse(endTime, DateUtils.DATE_TIME_PATTERN), -8);
return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfFan(id)); endTime = DateUtils.convertDateToString(date, DateUtils.DATE_TIME_PATTERN);
} else { } catch (ParseException e) {
return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfPv(id)); e.printStackTrace();
} }
}
} if (StringUtils.isEmpty(startTime)) {
Date sevenAgoDayStartTime = null;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) try {
@ApiOperation(httpMethod = "GET", value = "预警详情信息-光伏", notes = "预警详情信息-光伏") sevenAgoDayStartTime = DateUtils.dateAddDays(new Date(), -7);
@GetMapping(value = "/queryIndexByArae") } catch (Exception e) {
public ResponseModel<Map<String, Object>> queryIndexByArae(@RequestParam(required = false) String area, String analysisType, String startTimeTop, String endTimeTop) { e.printStackTrace();
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); startTime = DateUtils.convertDateToString(DateUtils.dateAddHours(sevenAgoDayStartTime, -8),
if ( null != endTimeTop){ DateUtils.DATE_TIME_PATTERN);
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); }
endTimeTop = formatter.format(endDate); DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8);
} if (StringUtils.isEmpty(endTime)) {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); endTime = DateUtils.convertDateToString(DateUtils.dateAddHours(new Date(), -8),
startTimeTop = formatter.format(startDate); DateUtils.DATE_TIME_PATTERN);
}
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop); return ResponseHelper
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop); .buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType, pointId, startTime, endTime));
}
for (PvHealthIndex pvHealthIndex : pvHealthIndices) {
FanHealthIndex fanHealthIndex = new FanHealthIndex(); @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
BeanUtils.copyProperties(pvHealthIndex,fanHealthIndex); @ApiOperation(httpMethod = "GET", value = "预警详情信息", notes = "预警详情信息")
fanHealthIndices.add(fanHealthIndex); @GetMapping(value = "/getAlramInfoDetail")
} public ResponseModel<Map<String, Object>> getAlramInfoDetailOfFan(@RequestParam(required = true) String id,
Map<String, Object> map = new HashMap<>(); @RequestParam(required = true) String type) {
List<Object> axisData = new ArrayList<>(); if ("FAN".equals(type)) {
List<Object> seriesData = new ArrayList<>(); return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfFan(id));
Map<String, List<FanHealthIndex>> mapList = fanHealthIndices.stream().collect(Collectors.groupingBy(FanHealthIndex::getAnalysisTime)); } else {
for (String s : mapList.keySet()) { return ResponseHelper.buildResponse(iAlarmInfoDetailService.getAlramInfoDetailOfPv(id));
List<FanHealthIndex> fanHealthIndices1 = mapList.get(s); }
Double healtnIndex = fanHealthIndices1.stream().collect(Collectors.averagingDouble(FanHealthIndex::getHealthIndex));
seriesData.add(healtnIndex.intValue()); }
axisData.add(s);
} @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "预警详情信息-光伏", notes = "预警详情信息-光伏")
map.put("axisData", axisData); @GetMapping(value = "/queryIndexByArae")
map.put("seriesData", seriesData); public ResponseModel<Map<String, Object>> queryIndexByArae(@RequestParam(required = false) String area,
return ResponseHelper.buildResponse(map); String analysisType, String startTimeTop, String endTimeTop) {
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) if (null != endTimeTop) {
@ApiOperation(httpMethod = "GET", value = "获取当前人的权限-全国、片区、场站", notes = "获取当前人的权限-全国、片区、场站") Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
@GetMapping(value = "/getCurrentUserPermissions") endTimeTop = formatter.format(endDate);
public ResponseModel<List<String>> getFanConditionVariablesByTime() { }
return ResponseHelper.buildResponse(permissionService.getCurrentUserPermissions()); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
} startTimeTop = formatter.format(startDate);
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectData(null, area, null, null, analysisType,
"片区", null, null, null, startTimeTop, endTimeTop);
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区",
null, null, null, startTimeTop, endTimeTop);
for (PvHealthIndex pvHealthIndex : pvHealthIndices) {
FanHealthIndex fanHealthIndex = new FanHealthIndex();
BeanUtils.copyProperties(pvHealthIndex, fanHealthIndex);
fanHealthIndices.add(fanHealthIndex);
}
Map<String, Object> map = new HashMap<>();
List<Object> axisData = new ArrayList<>();
List<Object> seriesData = new ArrayList<>();
Map<String, List<FanHealthIndex>> mapList = fanHealthIndices.stream()
.collect(Collectors.groupingBy(FanHealthIndex::getAnalysisTime));
for (String s : mapList.keySet()) {
List<FanHealthIndex> fanHealthIndices1 = mapList.get(s);
Double healtnIndex = fanHealthIndices1.stream()
.collect(Collectors.averagingDouble(FanHealthIndex::getHealthIndex));
seriesData.add(healtnIndex.intValue());
axisData.add(s);
}
map.put("axisData", axisData);
map.put("seriesData", seriesData);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "获取当前人的权限-全国、片区、场站", notes = "获取当前人的权限-全国、片区、场站")
@GetMapping(value = "/getCurrentUserPermissions")
public ResponseModel<List<String>> getCurrentUserPermissions() {
return ResponseHelper.buildResponse(permissionService.getCurrentUserPermissions());
}
} }
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