|
@@ -1,196 +0,0 @@
|
|
|
-package com.gyee.wisdom.alarm.sharding.controller;
|
|
|
-
|
|
|
-import com.gyee.wisdom.alarm.sharding.RSA.RSAService;
|
|
|
-import com.gyee.wisdom.alarm.sharding.entity.*;
|
|
|
-import com.gyee.wisdom.alarm.sharding.mapper.*;
|
|
|
-import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.codec.digest.DigestUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import java.security.PrivateKey;
|
|
|
-import java.security.PublicKey;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-/**
|
|
|
- * @descrition: 页面基本信息
|
|
|
- * @author:Wanghs
|
|
|
- * @date:2019-12-06
|
|
|
- */
|
|
|
-@Slf4j
|
|
|
-@RestController
|
|
|
-@RequestMapping("/info")
|
|
|
-@CrossOrigin
|
|
|
-public class InfoController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WindPowerStationMapper windPowerStationMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WindturbineMapper windturbineMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private TestingPointAIMapper testingPointAIMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private TestingPointDIMapper testingPointDIMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WindturbinePartsMapper windturbinePartsMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ElectricalTestingPointAIMapper electricalTestingPointAIMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ElectricalTestingPointDIMapper electricalTestingPointDIMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WarningTypeMapper warningTypeMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private WarningClassifyMapper warningClassifyMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RSAService rsaService;
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping(value = "/station")
|
|
|
- @ResponseBody
|
|
|
- public List<WindPowerStation> getAllStation(@RequestParam(value = "id", required = false) String id) {
|
|
|
-
|
|
|
- String md5Str = DigestUtils.md5Hex("12345678" + "gdnxfd");
|
|
|
-
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- id = "_FDC";
|
|
|
- }
|
|
|
- List<WindPowerStation> lst = windPowerStationMapper.getStationAll(id);
|
|
|
- return lst;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/windturbine")
|
|
|
- @ResponseBody
|
|
|
- public List<Windturbine> getWindturbineByStation(@RequestParam(value = "stationId", required = false) String stationId,
|
|
|
- @RequestParam(value = "modelId", required = false) String modelId) {
|
|
|
- List<Windturbine> lst = windturbineMapper.selectWindturbineByCondition(stationId, modelId);
|
|
|
- return lst;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/testing_point_ai")
|
|
|
- @ResponseBody
|
|
|
- public List<TestingPointAI> getTestingPointAIByStationIdAndModelId(
|
|
|
- @RequestParam(value = "stationId") String stationId,
|
|
|
- @RequestParam(value = "modelId") String modelId
|
|
|
- ) {
|
|
|
-
|
|
|
- List<TestingPointAI> lst = new ArrayList<>();
|
|
|
- if (StringUtils.isNotBlank(stationId) && StringUtils.isNotBlank(modelId)) {
|
|
|
- lst = testingPointAIMapper.selectByStationAndModel(stationId, modelId);
|
|
|
- }
|
|
|
- return lst;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/testing_point_di")
|
|
|
- @ResponseBody
|
|
|
- public List<TestingPointDI> getTestingPointDIByStationIdAndModelId(
|
|
|
- @RequestParam(value = "stationId", required = false) String stationId,
|
|
|
- @RequestParam(value = "modelId", required = false) String modelId
|
|
|
- ) {
|
|
|
- List<TestingPointDI> lst = new ArrayList<>();
|
|
|
- if (StringUtils.isNotBlank(stationId) || StringUtils.isNotBlank(modelId)) {
|
|
|
- lst = testingPointDIMapper.selectByStationAndModel(stationId, modelId);
|
|
|
- }
|
|
|
- return lst;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/electrical_point_ai")
|
|
|
- @ResponseBody
|
|
|
- public List<ElectricalTestingPointAI> getElectricaTestingPointAIByStationId(@RequestParam(value = "stationId") String stationId) {
|
|
|
- return electricalTestingPointAIMapper.selectPointByStation(stationId);
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/electrical_point_di")
|
|
|
- @ResponseBody
|
|
|
- public List<ElectricalTestingPointDI> getElectricaTestingPointDIByStationId(@RequestParam(value = "stationId") String stationId) {
|
|
|
- return electricalTestingPointDIMapper.selectPointByStation(stationId);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @RequestMapping(value = "/windturbine_parts")
|
|
|
- public List<WindturbineParts> getWindturbineParts() {
|
|
|
- List<WindturbineParts> lst = new ArrayList<>();
|
|
|
- try {
|
|
|
- lst = windturbinePartsMapper.selectAllWindturbineParts();
|
|
|
-
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("获取风机部件信息失败" + ex.getMessage() + ex.getStackTrace());
|
|
|
- } finally {
|
|
|
- return lst;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/warning_type")
|
|
|
- public List<WarningType> getWarningType() {
|
|
|
- List<WarningType> lst = new ArrayList<>();
|
|
|
- try {
|
|
|
- lst = warningTypeMapper.getAll();
|
|
|
-
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("获取报警种类信息失败" + ex.getMessage() + ex.getStackTrace());
|
|
|
- } finally {
|
|
|
- return lst;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/warning_classify")
|
|
|
- public List<WarningClassify> getWarningClassify() {
|
|
|
- List<WarningClassify> lst = new ArrayList<>();
|
|
|
- try {
|
|
|
- lst = warningClassifyMapper.getAll();
|
|
|
-
|
|
|
- } catch (Exception ex) {
|
|
|
- log.error("获取报警分类信息失败" + ex.getMessage() + ex.getStackTrace());
|
|
|
- } finally {
|
|
|
- return lst;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/publickey")
|
|
|
- public String getPublicKey() throws Exception {
|
|
|
- //获得密钥对Map
|
|
|
- Map<String, byte[]> keyMap = rsaService.getKeyMap();
|
|
|
- //获得公钥
|
|
|
- String publicKeyStr = rsaService.encryptBASE64(keyMap.get("publicKey"));
|
|
|
- //获得私钥
|
|
|
- String privateKeyStr = rsaService.encryptBASE64(keyMap.get("privateKey"));
|
|
|
-
|
|
|
- PrivateKey privateKey = rsaService.restorePrivateKey(rsaService.decryptBASE64(privateKeyStr));
|
|
|
- PublicKey publicKey = rsaService.restorePublicKey(rsaService.decryptBASE64(publicKeyStr));
|
|
|
- RSAService.keyMap.put(publicKey, privateKey);
|
|
|
- System.out.println(publicKeyStr);
|
|
|
- return publicKeyStr;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @PostMapping(value = "/sendkey")
|
|
|
- @ResponseBody
|
|
|
- public ResponseWrapper sendWebPublickey(@RequestBody String webPublicKey ){
|
|
|
-
|
|
|
-
|
|
|
- System.out.println(webPublicKey);
|
|
|
- PublicKey publicKey=RSAService.restorePublicKey(webPublicKey.getBytes());
|
|
|
- byte [] data=RSAService.encryptionByPublicKey(publicKey,"wanghs的加密信息".getBytes());
|
|
|
- ResponseWrapper wrapper=ResponseWrapper.success("返回数据",data);
|
|
|
-
|
|
|
- return wrapper;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-}
|