Commit 5f874a73 authored by qinhu's avatar qinhu

Hbase配置引入

parent 4a17a880
......@@ -5,8 +5,8 @@ import cn.wise.sc.energy.power.plant.business.domain.vo.DeviceInfoVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.PlantInfoVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.UnitInfoVo;
import cn.wise.sc.energy.power.plant.business.service2.IDeviceInfoService;
import cn.wise.sc.energy.power.plant.business.service2.IPlantInfoService;
import cn.wise.sc.energy.power.plant.business.service.IDeviceInfoService;
import cn.wise.sc.energy.power.plant.business.service.IPlantInfoService;
import com.alibaba.fastjson.JSON;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
......
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import lombok.extern.slf4j.Slf4j;
import cn.wise.sc.energy.power.plant.business.domain.AbstractEntity;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.IBaseService;
import cn.wise.sc.energy.power.plant.business.service.IBaseService;
import cn.wise.sc.energy.power.plant.common.core.bean.EntityQuery;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import org.springframework.web.bind.annotation.DeleteMapping;
......
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import cn.wise.sc.energy.power.plant.business.bean.DataPower;
import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
import cn.wise.sc.energy.power.plant.business.domain.TendencyQuery;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.ICharacterParamService;
import cn.wise.sc.energy.power.plant.business.service2.impl.BaseServiceImpl;
import cn.wise.sc.energy.power.plant.business.service.ICharacterParamService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
......
//package cn.wise.sc.energy.power.plant.business.controller;
//
//import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
//import io.swagger.annotations.Api;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @description: 冷凝水监控 控制器
// * @author: qh
// * @create: 2020-05-20 16:04
// */
//@Deprecated
//@CrossOrigin
//@RestController
//@RequestMapping("/condensate")
//public class CondensateController {
//
// public BaseResponse<String> test() {
// return null;
// }
//
//}
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import cn.wise.sc.energy.power.plant.business.domain.vo.DeviceInfoVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.IDeviceInfoService;
import cn.wise.sc.energy.power.plant.business.service.IDeviceInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.CrossOrigin;
......
//package cn.wise.sc.energy.power.plant.business.controller;
//
//import cn.wise.sc.energy.power.plant.business.service.MenuService;
//import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.context.annotation.Description;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @description: 菜单
// * @author: qh
// * @create: 2020-05-23 09:30
// **/
//@Deprecated
//@CrossOrigin
//@RestController
//@RequestMapping("/menu")
//public class MenuController {
//
// final
// MenuService menuService;
//
// public MenuController(MenuService menuService) {
// this.menuService = menuService;
// }
//
// @GetMapping("/menuInfo")
// @ApiOperation("获取菜单信息")
// public BaseResponse<String> getMenuInfo() {
// return menuService.getMenuInfo();
// }
//
//
// @GetMapping("/characterInfo")
// @ApiOperation("获取测点信息")
// public BaseResponse<String> getCharacterInfo(String key) {
// return menuService.getCharacterInfo(key);
// }
//
//}
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.IPlantInfoService;
import cn.wise.sc.energy.power.plant.business.service.IPlantInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import cn.wise.sc.energy.power.plant.business.domain.Oscillogram;
import cn.wise.sc.energy.power.plant.business.domain.OscillogramRowMapper;
import com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate;
import com.spring4all.spring.boot.starter.hbase.api.RowMapper;
import io.swagger.annotations.Api;
import org.apache.hadoop.conf.Configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
......
//package cn.wise.sc.energy.power.plant.business.controller;
//
//import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
//import cn.wise.sc.energy.power.plant.business.service.ISpindleService;
//import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
//import io.swagger.annotations.Api;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @description: 转轴监控
// * @author: qh
// * @create: 2020-05-20 16:13
// */
//@Deprecated
//@CrossOrigin
//@RestController
//@RequestMapping("/spindle")
//public class SpindleController {
//
// final ISpindleService iSpindleService;
//
// public SpindleController(ISpindleService iSpindleService) {
// this.iSpindleService = iSpindleService;
// }
//
// @GetMapping
// public BaseResponse<String> getDataByTime(TimeModelQuery timeModelQuery, String key) {
// return null;
// }
//
//}
//package cn.wise.sc.energy.power.plant.business.controller;
//
//import cn.wise.sc.energy.power.plant.common.kafka.service.IndicatorService;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @description:
// * @author: qh
// * @create: 2020-05-18 14:57
// **/
//@RestController
//@RequestMapping("/test")
//@CrossOrigin
//public class TestController {
//
// final
// IndicatorService indicatorService;
//
// public TestController(IndicatorService indicatorService) {
// this.indicatorService = indicatorService;
// }
//
// @GetMapping
// public void test(){
// indicatorService.sendMessage("thermalpower_plant_1","sssssssss");
// }
//
//
//
//}
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.IUnitInfoService;
import cn.wise.sc.energy.power.plant.business.service.IUnitInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.CrossOrigin;
......
package cn.wise.sc.energy.power.plant.business.controller2;
package cn.wise.sc.energy.power.plant.business.controller;
import cn.wise.sc.energy.power.plant.business.domain.PageQuery;
import cn.wise.sc.energy.power.plant.business.domain.UserInfo;
import cn.wise.sc.energy.power.plant.business.domain.UserInfoQuery;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.IUserInfoService;
import cn.wise.sc.energy.power.plant.business.service.IUserInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CrossOrigin;
......@@ -45,7 +43,8 @@ public class UserInfoController {
public BaseResponse<Boolean> add(UserInfoQuery userInfo) {
return iUserInfoService.addUserInfo(userInfo);
}
@PutMapping("/new")
@PutMapping("/edit")
public BaseResponse<Boolean> edit(UserInfoQuery userInfo) {
return iUserInfoService.edit(userInfo);
}
......
package cn.wise.sc.energy.power.plant.business.controller2;
import cn.wise.sc.energy.power.plant.business.bean.DataPower;
import cn.wise.sc.energy.power.plant.business.service.IndexRealTimeDataService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* @description: 首页大屏实时数据展示
* @author: qh
* @create: 2020-05-25 10:23
**/
@CrossOrigin
@RestController
@RequestMapping("/indexRealData")
public class IndexRealDataController {
final
IndexRealTimeDataService indexRealTimeDataService;
public IndexRealDataController(IndexRealTimeDataService indexRealTimeDataService) {
this.indexRealTimeDataService = indexRealTimeDataService;
}
//
// @GetMapping("/vibration")
// @ApiOperation("首页实时数据 三相电压/电流 定子电压/电流 (汇总实时数据)")
// public BaseResponse<DataPower> vibrationData(String plantCode) {
//
// return indexRealTimeDataService.realTimeDataVoltage(plantCode);
// }
@GetMapping("/powerTendency")
@ApiOperation("首页各机组功率趋势图")
public BaseResponse<DataPower> powerTendency(String plantCode) {
return indexRealTimeDataService.getIndexPowerInit(plantCode);
}
@GetMapping("/unitLubrication")
@ApiOperation("各机组振动棒状对比图数据")
public BaseResponse<DataPower> realTimeDataUnitLubrication(String plantCode) {
return indexRealTimeDataService.realTimeDataUnitLubrication(plantCode);
}
@GetMapping("/bearingBushC")
@ApiOperation("各机组轴瓦温度柱状图")
public BaseResponse<DataPower> bearingBushC(String plantCode) {
return indexRealTimeDataService.realTimeDataBearingBushC(plantCode);
}
@GetMapping("/3DModel")
@ApiOperation("3D图测点")
public BaseResponse<DataPower> realTimeData3DModel(String unitId, String plantCode) {
return indexRealTimeDataService.realTimeData3DModel(unitId, plantCode);
}
@GetMapping("/alarm")
@ApiOperation("获取各机组报警点数对比")
public BaseResponse<List<DataPower>> realTimeDataAlarm() {
DataPower dataPower = get();
//模拟报警点数的假数据
DataPower dataPower2 = new DataPower();
dataPower2.getXAxis().add("热工参数");
dataPower2.getXAxis().add("机械参数");
dataPower2.getXAxis().add("电气参数");
dataPower2.getXAxis().add("环境参数");
dataPower2.getXAxis().add("辅助参数");
DataPower.PowerPoints powerPoints = new DataPower.PowerPoints();
powerPoints.setName("一号机组");
powerPoints.getValue().add(new Random().nextInt(30) + "");
powerPoints.getValue().add(new Random().nextInt(20) + "");
powerPoints.getValue().add(new Random().nextInt(10) + "");
powerPoints.getValue().add(new Random().nextInt(10) + "");
powerPoints.getValue().add(new Random().nextInt(10) + "");
DataPower.PowerPoints powerPoints1 = new DataPower.PowerPoints();
powerPoints1.setName("二号机组");
powerPoints1.getValue().add(new Random().nextInt(30) + "");
powerPoints1.getValue().add(new Random().nextInt(20) + "");
powerPoints1.getValue().add(new Random().nextInt(10) + "");
powerPoints1.getValue().add(new Random().nextInt(10) + "");
powerPoints1.getValue().add(new Random().nextInt(10) + "");
dataPower2.getDataList().add(powerPoints);
dataPower2.getDataList().add(powerPoints1);
List<DataPower> dataPowers = new ArrayList<>(2);
dataPowers.add(dataPower2);
dataPowers.add(dataPower);
return BaseResponse.okData(dataPowers);
}
@GetMapping("/alarm2")
@ApiOperation("获取各机组报警点数对比")
public BaseResponse<List<DataPower>> realTimeDataAlarm2() {
DataPower dataPower = get();
//模拟报警点数的假数据
DataPower dataPower2 = new DataPower();
dataPower2.getXAxis().add("一号机组");
dataPower2.getXAxis().add("二号机组");
DataPower.PowerPoints powerPoints = new DataPower.PowerPoints();
powerPoints.setName("一号机组");
powerPoints.getValue().add(getTotal(dataPower.getDataList(), 0));
DataPower.PowerPoints powerPoints1 = new DataPower.PowerPoints();
powerPoints1.setName("二号机组");
powerPoints1.getValue().add(getTotal(dataPower.getDataList(), 1));
dataPower2.getDataList().add(powerPoints);
dataPower2.getDataList().add(powerPoints1);
List<DataPower> dataPowers = new ArrayList<>(2);
dataPowers.add(dataPower);
dataPowers.add(dataPower2);
return BaseResponse.okData(dataPowers);
}
private String getTotal(List<DataPower.PowerPoints> powerPoints, int count) {
int rts = 0;
for (DataPower.PowerPoints powerPoints1 : powerPoints) {
rts += Integer.parseInt(powerPoints1.getValue().get(count));
}
return rts + "";
}
private DataPower get() {
//模拟报警点数的假数据
DataPower dataPower = new DataPower();
dataPower.getXAxis().add("一号机组");
dataPower.getXAxis().add("二号机组");
DataPower.PowerPoints powerPoints = new DataPower.PowerPoints();
powerPoints.setName("一级报警");
powerPoints.getValue().add(new Random().nextInt(30) + "");
powerPoints.getValue().add(new Random().nextInt(20) + "");
DataPower.PowerPoints powerPoints1 = new DataPower.PowerPoints();
powerPoints1.setName("二级报警");
powerPoints1.getValue().add(new Random().nextInt(30) + "");
powerPoints1.getValue().add(new Random().nextInt(20) + "");
DataPower.PowerPoints powerPoints2 = new DataPower.PowerPoints();
powerPoints2.setName("三级报警");
powerPoints2.getValue().add(new Random().nextInt(30) + "");
powerPoints2.getValue().add(new Random().nextInt(20) + "");
dataPower.getDataList().add(powerPoints);
dataPower.getDataList().add(powerPoints1);
dataPower.getDataList().add(powerPoints2);
return dataPower;
}
}
package cn.wise.sc.energy.power.plant.business.controller2;
import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
import cn.wise.sc.energy.power.plant.business.service.TendencyService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @description: 趋势图
* @author: qh
* @create: 2020-05-23 11:51
**/
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/tendency")
public class TendencyController {
final
RedissonClient redissonClient;
final
TendencyService tendencyService;
public TendencyController(RedissonClient redissonClient, TendencyService tendencyService) {
this.redissonClient = redissonClient;
this.tendencyService = tendencyService;
}
@PostMapping
public BaseResponse<String> getInitData(@RequestBody List<String> keys,
TimeModelQuery timeModelQuery,
Integer status) {
return tendencyService.getInitData(keys, timeModelQuery, status);
}
}
......@@ -2,6 +2,8 @@ package cn.wise.sc.energy.power.plant.business.domain;
import lombok.Data;
import java.util.List;
/**
* @description: 波形图
* @author: qh
......@@ -10,4 +12,39 @@ import lombok.Data;
@Data
public class Oscillogram {
/**
* 功率谱数据
*/
private List<Data> power;
/**
* 阶次比数据
*/
private List<Data> orderRatio;
/**
* 相位谱数据
*/
private List<Data> phaseSpectrum;
public static class Data{
/**
* 测点对应KKS编码
*/
private String kKSCode;
/**
* 幅值(Y轴坐标值)
*/
private List<Double> data;
/**
* 频率(X轴坐标值)
*/
private List<Double> index;
}
}
......@@ -2,6 +2,8 @@ package cn.wise.sc.energy.power.plant.business.domain;
import lombok.Data;
import java.util.List;
/**
* @description: 波形图入参
* @author: qh
......@@ -23,7 +25,7 @@ public class OscillogramQuery {
@Data
@lombok.Data
public static class Record{
/**
......@@ -41,6 +43,41 @@ public class OscillogramQuery {
*/
private String generationFreq;
/**
* 旋转方向(0:顺时针,1:逆时针)
*/
private Integer direction;
/**
* 记录类型(0:连续采样,1定时采样:)
*/
private Integer recordFlag;
private List<Data> data;
}
@lombok.Data
public static class Data{
/**
* 测点对应KKS编码
*/
private String kKSCode;
/**
* 样包采样周期数
*/
private Long period;
/**
* 各键相点相对起始时间偏移
*/
private Long keyPhaseOffset;
/**
* 数据区域
*/
private String data;
}
}
//package cn.wise.sc.energy.power.plant.business.service;
//
//import cn.wise.sc.energy.power.plant.business.bean.BasicOption;
//import cn.wise.sc.energy.power.plant.business.bean.TurbineOption;
//import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
//import com.alibaba.fastjson.JSON;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//
///**
// * @description: 数据库操作
// * @author: qh
// * @create: 2020-05-23 09:36
// */
//@Slf4j
//@Component
//public class DataBaseService {
//
// final JdbcTemplate jdbcTemplate;
//
// /**
// * 根据plantCode获取电厂配置
// */
// private final String GET_TURBINE_CONFIG_BY_PLANT_CODE = "SELECT basicoption FROM turbineoption WHERE plantcode = ?";
//
// /**
// * 获取所有电厂配置
// */
// private final String GET_TURBINE_CONFIG = "SELECT basicoption FROM turbineoption";
//
// /**
// * 获取所有电厂信息
// */
// private final String GET_TURBINE = "SELECT plantcode,plantname,basicoption FROM turbineoption";
//
// public DataBaseService(JdbcTemplate jdbcTemplate) {
// this.jdbcTemplate = jdbcTemplate;
// }
//
// /**
// * 根据plantCode获取电厂配置文件信息
// *
// * @param plantCode 电厂编码
// * @return 配置文件
// */
// public String getTurbineConfigJson(String plantCode) {
//
// //判断plantCode不为空
// ResponseEnum.BAD_LICENCE_TYPE.assertNotEmpty(plantCode);
//
// List<String> rts = jdbcTemplate.query(GET_TURBINE_CONFIG_BY_PLANT_CODE, new String[]{plantCode}, (resultSet, i) -> resultSet.getNString(1));
//
// if (rts != null && rts.size() > 0) {
// return rts.get(0);
// } else {
// log.info("没有找到相关电厂配置信息! 电厂编号:{}", plantCode);
// throw new RuntimeException("没有找到相关数据");
// }
// }
//
// /**
// * 获取所有电厂配置文件信息
// *
// * @return 配置文件
// */
// public List<String> getAllTurbineConfigJson() {
//
// return jdbcTemplate.query(GET_TURBINE_CONFIG, new String[]{}, (resultSet, i) -> resultSet.getNString(1)
// );
// }
//
// /**
// * 获取所有电厂信息
// * @return 电厂信息集合
// */
// public List<TurbineOption> getAllTurbine() {
// return jdbcTemplate.query(GET_TURBINE, new String[]{}, (resultSet, i) -> {
//
// TurbineOption turbineOption = new TurbineOption();
// turbineOption.setPlantCode(resultSet.getNString(1));
// turbineOption.setPlantName(resultSet.getNString(2));
// String basicOptionStr = resultSet.getNString(3);
//
// ResponseEnum.LICENCE_NOT_FOUND.assertNotEmpty(basicOptionStr);
// turbineOption.setBasicOption(JSON.parseObject(basicOptionStr,BasicOption.class));
//
// return turbineOption;
// }
//
// );
// }
//
// /**
// * 获取所有信息
// *
// * @return
// */
// public List<TurbineOption> getAllTurbineOption() {
// return jdbcTemplate.query(GET_TURBINE, new String[]{}, (resultSet, i) -> {
// TurbineOption turbineOption = new TurbineOption();
// turbineOption.setPlantCode(resultSet.getNString(1));
// turbineOption.setPlantName(resultSet.getNString(2));
// turbineOption.setBasicOption(JSON.parseObject(resultSet.getNString(3), BasicOption.class));
// return turbineOption;
// }
// );
// }
//}
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.AbstractEntity;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
......
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.bean.DataPower;
import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
......@@ -6,11 +6,8 @@ import cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo;
import cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import net.opentsdb.client.api.query.response.QueryResponse;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.DetectionItem;
......
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.DeviceInfo;
import cn.wise.sc.energy.power.plant.business.domain.vo.DeviceInfoVo;
......
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.PlantInfo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.PlantInfoVo;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description: 电厂信息服务层
......
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.RuntimeOptionInfo;
import org.springframework.stereotype.Service;
......
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
/**
* @description: 基础接口
* @author: qh
* @create: 2020-05-20 18:00
*/
public interface IService {
/**
* 根据时间和测点查询 数据
*
* @param timeModelQuery 时间段
* @param key 测点
* @return
*/
BaseResponse<String> getDataByTime(TimeModelQuery timeModelQuery, String key);
}
package cn.wise.sc.energy.power.plant.business.service;
/**
* @description: 转轴监控
* @author: qh
* @create: 2020-05-20 18:00
**/
public interface ISpindleService extends IService {
}
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.UnitInfo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
......
package cn.wise.sc.energy.power.plant.business.service2;
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.domain.UserInfo;
import cn.wise.sc.energy.power.plant.business.domain.UserInfoQuery;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import org.springframework.data.domain.Page;
......
//package cn.wise.sc.energy.power.plant.business.service;
//
//import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
//import com.alibaba.fastjson.JSON;
//import org.redisson.api.RBucket;
//import org.redisson.api.RedissonClient;
//import org.springframework.scheduling.annotation.Async;
//import org.springframework.stereotype.Component;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.atomic.AtomicReference;
//
///**
// * @description: 菜单配置
// * @author: qh
// * @create: 2020-05-23 10:20
// **/
//@Component
//public class MenuService {
//
// final
// DataBaseService baseService;
// final
// RedissonClient redissonClient;
//
// public MenuService(DataBaseService baseService, RedissonClient redissonClient) {
// this.baseService = baseService;
// this.redissonClient = redissonClient;
// }
//
// /**
// * 获取菜单信息
// * <p>
// * // * @param plantCode 菜单编码
// *
// * @return String
// */
// public BaseResponse<String> getMenuInfo() {
//
// List<TurbineOption> configJsons = baseService.getAllTurbineOption();
// List<TurbineOption> rts = new ArrayList<>(configJsons.size());
// for (TurbineOption configJson : configJsons) {
// if (JSON.toJSONString(configJson).contains("阻尼器")) {
// continue;
// }
// //去掉配置里面的测点
// configJson.getBasicOption().getDevices().stream()
// .forEach(device -> device.getUnitInfoVos().stream()
// .forEach(unit -> unit.setCharacterParamInfoVo(null)));
// rts.add(configJson);
// }
//
// return BaseResponse.okData(JSON.toJSONString(rts));
// }
//
// /**
// * 初始化redis信息
// */
// @Async
// public void initRedis() {
// List<String> configJsons = baseService.getAllTurbineConfigJson();
// for (String configJson : configJsons) {
// //解析配置文件 拆分部件 初始化redis
// List<UnitInfoVo> units = getUnitInfoVos(configJson);
// //判断是否已经存进去了
// UnitInfoVo firstUnit = units.get(0);
// RBucket<Object> firstUnitInfo = redissonClient.getBucket(firstUnit.getUnitid());
// if (firstUnitInfo.isExists()) {
// return;
// }
// BasicOption basicOption = JSON.parseObject(configJson, BasicOption.class);
//
// //redis缓存机组信息
// for (Devices device : basicOption.getDevices()) {
// RBucket<String> rBucket = redissonClient.getBucket(basicOption.getDepartment() + ":" + device.getDevicename());
// rBucket.set(JSON.toJSONString(device));
// }
//
// //redis缓存部件信息
// for (UnitInfoVo unit : units) {
// RBucket<Object> bucket = redissonClient.getBucket(basicOption.getDepartment() + ":" + unit.getUnitid());
// bucket.set(JSON.toJSONString(unit));
// }
// }
// }
//
// /**
// * 获取部件信息
// *
// * @param configJson 电厂配置文件
// * @return 部件集合
// */
// private List<UnitInfoVo> getUnitInfoVos(String configJson) {
// //解析配置文件 UnitInfoVo
// BasicOption basicOption = JSON.parseObject(configJson, BasicOption.class);
// //获取部件信息
// List<UnitInfoVo> units = new ArrayList<>();
// basicOption.getDevices().stream()
// .forEach(device -> units.addAll(device.getUnitInfoVos()));
// return units;
// }
//
// /**
// * 获取配置文件里面的
// *
// * @param configJson 配置文件
// * @return 测点集合
// */
// private List<CharacterParamInfoVo> getCharacters(String configJson) {
//
// //解析配置文件 拆分characters
// BasicOption basicOption = JSON.parseObject(configJson, BasicOption.class);
//
// //获取测点信息
// List<CharacterParamInfoVo> characters = new ArrayList<>();
// basicOption.getDevices().stream()
// .forEach(device -> device.getUnitInfoVos().stream()
// .forEach(unit -> characters.addAll(unit.getCharacters())));
// return characters;
// }
//
// /**
// * 获取测点信息
// *
// * @param key 部件编号
// * @return String
// */
// public BaseResponse<String> getCharacterInfo(String key) {
// AtomicReference<List<CharacterParamInfoVo>> characters = new AtomicReference<>();
// RBucket<String> bucket = redissonClient.getBucket(key);
// if (bucket.isExists()) {
// return BaseResponse.okData(bucket.get());
// } else {
// List<String> allTurbineConfigJson = baseService.getAllTurbineConfigJson();
// List<BasicOption> basicOptions = new ArrayList<>(allTurbineConfigJson.size());
// for (String turbineConfigJson : allTurbineConfigJson) {
// if (turbineConfigJson.contains("阻尼器")) {
// continue;
// }
// basicOptions.add(JSON.parseObject(turbineConfigJson, BasicOption.class));
// }
// basicOptions.stream().forEach(basicOption -> {
// basicOption.getDevices().stream().forEach(devices -> {
// UnitInfoVo units1 = devices.getUnitInfoVos().stream().filter(units ->
// key.equals(units.getUnitid())
// ).findFirst().orElse(null);
// if (units1 != null) {
// characters.set(units1.getCharacters());
// }
// });
// });
// bucket.set(JSON.toJSONString(characters.get()));
// }
// return BaseResponse.okData(JSON.toJSONString(characters.get()));
// }
//}
package cn.wise.sc.energy.power.plant.business.service;
import cn.wise.sc.energy.power.plant.business.bean.TimeModelQuery;
import cn.wise.sc.energy.power.plant.business.opentsdb.OpentsdbOkHttpClient;
import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryExt;
import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryRequestExt;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import net.opentsdb.client.api.query.response.QueryResponse;
import net.opentsdb.client.bean.Aggregator;
import net.opentsdb.client.bean.QueryResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description: 转轴监控
* @author: qh
* @create: 2020-05-20 17:39
*/
@Service
public class SpindleServiceImpl implements ISpindleService {
@Override
public BaseResponse<String> getDataByTime(TimeModelQuery timeModelQuery, String key) {
QueryResponse queryResponse = null;
try {
queryResponse =
OpentsdbOkHttpClient.query(
QueryRequestExt.builder()
.start("1589529222621")
.end("1589529223621")
.build()
.addQuery(
QueryExt.builder()
.aggregator(Aggregator.AVG)
.metric("rm000000000000000000001292")
.build()));
} catch (Exception e) {
ResponseEnum.BUSINESS_ERROR.assertNotNull(null);
}
ResponseEnum.LICENCE_NOT_FOUND.assertNotNull(queryResponse);
List<QueryResult> results = queryResponse.getResults();
// todo results处理
return null;
}
}
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.wise.sc.energy.power.plant.business.domain.AbstractEntity;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.service2.IBaseService;
import cn.wise.sc.energy.power.plant.business.service.IBaseService;
import cn.wise.sc.energy.power.plant.common.core.bean.EntityQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.energy.power.plant.business.bean.DataPower;
......@@ -13,12 +13,10 @@ import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryExt;
import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryRequestExt;
import cn.wise.sc.energy.power.plant.business.repository.CharacterParamRepository;
import cn.wise.sc.energy.power.plant.business.repository.UnitInfoRepository;
import cn.wise.sc.energy.power.plant.business.service2.ICharacterParamService;
import cn.wise.sc.energy.power.plant.business.service.ICharacterParamService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Range;
import lombok.extern.slf4j.Slf4j;
import net.opentsdb.client.api.query.response.QueryResponse;
import net.opentsdb.client.bean.Aggregator;
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.wise.sc.energy.power.plant.business.domain.DetectionItem;
import cn.wise.sc.energy.power.plant.business.service2.IDetectionService;
import cn.wise.sc.energy.power.plant.business.service.IDetectionService;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import org.redisson.api.RBucket;
import org.redisson.api.RQueue;
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.ListUtil;
import cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo;
import cn.wise.sc.energy.power.plant.business.domain.DeviceInfo;
import cn.wise.sc.energy.power.plant.business.domain.UnitInfo;
......@@ -12,15 +11,11 @@ import cn.wise.sc.energy.power.plant.business.domain.vo.UnitInfoVo;
import cn.wise.sc.energy.power.plant.business.opentsdb.OpentsdbOkHttpClient;
import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryExt;
import cn.wise.sc.energy.power.plant.business.opentsdb.bean.QueryRequestExt;
import cn.wise.sc.energy.power.plant.business.repository.CharacterParamRepository;
import cn.wise.sc.energy.power.plant.business.repository.UnitInfoRepository;
import cn.wise.sc.energy.power.plant.business.service2.ICharacterParamService;
import cn.wise.sc.energy.power.plant.business.service2.IDeviceInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import cn.wise.sc.energy.power.plant.business.service.ICharacterParamService;
import cn.wise.sc.energy.power.plant.business.service.IDeviceInfoService;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import net.opentsdb.client.api.query.request.QueryRequest;
import net.opentsdb.client.api.query.response.QueryResponse;
import net.opentsdb.client.bean.Aggregator;
import net.opentsdb.client.bean.QueryResult;
......@@ -29,12 +24,8 @@ import org.springframework.data.domain.Example;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.wise.sc.energy.power.plant.business.domain.DeviceInfo;
import cn.wise.sc.energy.power.plant.business.domain.PlantInfo;
import cn.wise.sc.energy.power.plant.business.repository.DeviceInfoRepository;
import cn.wise.sc.energy.power.plant.business.service2.IPlantInfoService;
import cn.wise.sc.energy.power.plant.business.service.IPlantInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import com.alibaba.fastjson.JSON;
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
/**
* @description: 运行时设置服务实现
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.wise.sc.energy.power.plant.business.domain.UnitInfo;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.domain.vo.UnitInfoVo;
import cn.wise.sc.energy.power.plant.business.service2.IUnitInfoService;
import cn.wise.sc.energy.power.plant.business.service.IUnitInfoService;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import java.util.ArrayList;
import java.util.List;
......
package cn.wise.sc.energy.power.plant.business.service2.impl;
package cn.wise.sc.energy.power.plant.business.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.energy.power.plant.business.domain.CharacterParamInfo;
import cn.wise.sc.energy.power.plant.business.domain.UserInfo;
import cn.wise.sc.energy.power.plant.business.domain.UserInfoQuery;
import cn.wise.sc.energy.power.plant.business.domain.vo.EntityVo;
import cn.wise.sc.energy.power.plant.business.repository.UserInfoRepository;
import cn.wise.sc.energy.power.plant.business.service2.IUserInfoService;
import cn.wise.sc.energy.power.plant.business.service.IUserInfoService;
import cn.wise.sc.energy.power.plant.common.core.bean.BaseResponse;
import cn.wise.sc.energy.power.plant.common.core.exception.BusinessException;
import cn.wise.sc.energy.power.plant.common.core.exception.BusinessExceptionAssert;
import cn.wise.sc.energy.power.plant.common.core.exception.ResponseEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.List;
import java.util.Optional;
/**
* @description:
......
package cn.wise.sc.energy.power.plant.business.task;
import cn.wise.sc.energy.power.plant.business.bean.DataPower;
import cn.wise.sc.energy.power.plant.business.controller2.IndexRealDataController;
import cn.wise.sc.energy.power.plant.business.domain.vo.CharacterParamInfoVo;
import cn.wise.sc.energy.power.plant.business.service.IndexRealTimeDataService;
import cn.wise.sc.energy.power.plant.business.service.IndexRealTimeDataServiceV2;
import cn.wise.sc.energy.power.plant.business.service2.ICharacterParamService;
import cn.wise.sc.energy.power.plant.business.service.ICharacterParamService;
import com.alibaba.fastjson.JSON;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
......@@ -31,26 +27,13 @@ public class ScheduledModel {
final
WebSocketServer2 webSocketServer2;
final
IndexRealDataController indexRealDataController;
final
IndexRealTimeDataServiceV2 indexRealTimeDataServiceV2;
final
IndexRealTimeDataService indexRealTimeDataService;
final
ICharacterParamService iCharacterParamService;
public ScheduledModel(WebSocketServer webSocketServer,
IndexRealTimeDataService indexRealTimeDataService,
WebSocketServer2 webSocketServer2,
IndexRealDataController indexRealDataController,
IndexRealTimeDataServiceV2 indexRealTimeDataServiceV2,
ICharacterParamService iCharacterParamService) {
this.webSocketServer = webSocketServer;
this.indexRealTimeDataService = indexRealTimeDataService;
this.webSocketServer2 = webSocketServer2;
this.indexRealDataController = indexRealDataController;
this.indexRealTimeDataServiceV2 = indexRealTimeDataServiceV2;
this.iCharacterParamService = iCharacterParamService;
}
......
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