Commit 3498e484 authored by wujiang's avatar wujiang

添加全域指数接口

parent d3916a30
...@@ -129,4 +129,10 @@ public class CommonConstans { ...@@ -129,4 +129,10 @@ public class CommonConstans {
put("按天", DatePattern.NORM_DATE_PATTERN); put("按天", DatePattern.NORM_DATE_PATTERN);
} }
}; };
public static final String ANALYSE_TYPE_MOMENT = "按时刻";
public static final String ANALYSE_TYPE_HOUR = "按小时";
public static final String ANALYSE_TYPE_DAY = "按天";
} }
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.date.DateUtil; import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil; import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -12,9 +41,14 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils; ...@@ -12,9 +41,14 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.feign.RiskWarningFeign; import com.yeejoin.amos.boot.module.jxiop.api.feign.RiskWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper;
...@@ -22,34 +56,24 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper; ...@@ -22,34 +56,24 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.biz.common.utils.DateUtils.DATE_TIME_PATTERN;
@RestController @RestController
@Api(tags = "智能分析 - 大屏API") @Api(tags = "智能分析 - 大屏API")
...@@ -65,7 +89,6 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -65,7 +89,6 @@ public class TDBigScreenAnalyseController extends BaseController {
@Autowired @Autowired
IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper; IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Autowired @Autowired
FanHealthIndexMapper fanHealthIndexMapper; FanHealthIndexMapper fanHealthIndexMapper;
@Autowired @Autowired
...@@ -93,7 +116,6 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -93,7 +116,6 @@ public class TDBigScreenAnalyseController extends BaseController {
@Autowired @Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper; FanHealthIndexDayMapper fanHealthIndexDayMapper;
@Autowired @Autowired
private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService; private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService;
...@@ -104,24 +126,27 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -104,24 +126,27 @@ public class TDBigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘")
@GetMapping(value = "/getHealthScoreInfo") @GetMapping(value = "/getHealthScoreInfo")
public ResponseModel<Map<String, Integer>> getHealthScoreInfo(@RequestParam(required = false) String areaCode, public ResponseModel<Map<String, Integer>> getHealthScoreInfo(@RequestParam(required = false) String areaCode,
@RequestParam(required = false) String stationCode, @RequestParam(required = false) String stationCode, @RequestParam(required = false) String tableName) {
@RequestParam (required = false) String tableName) {
HashMap<String, Integer> stringBigDecimalHashMap = new HashMap<>(); HashMap<String, Integer> stringBigDecimalHashMap = new HashMap<>();
if (CharSequenceUtil.isNotEmpty(stationCode)) { if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId(); stationCode = stationBasic.getFanGatewayId();
stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper.getHealthScoreInfoByStation(stationCode, tableName).toString().replace(".0", ""))); stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper
.getHealthScoreInfoByStation(stationCode, tableName).toString().replace(".0", "")));
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
} }
stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper.getHealthScoreInfoByLatest(areaCode, stationCode).toString().replace(".0", ""))); stringBigDecimalHashMap.put("value", Integer.valueOf(idxBizFanHealthIndexMapper
.getHealthScoreInfoByLatest(areaCode, stationCode).toString().replace(".0", "")));
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode,
@RequestParam(required = false) String stationCode, @RequestParam(required = false) String analysisType,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
if (StrUtil.isNotEmpty(stationCode)) { if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
...@@ -132,20 +157,54 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -132,20 +157,54 @@ public class TDBigScreenAnalyseController extends BaseController {
} }
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map<String, String>> dateInfoBy15 = idxBizFanHealthIndexMapper.getDateInfoBy15(); List<Map<String, String>> dateInfoBy15 = new ArrayList<>();
if (startTime != null && endTime != null) {
if (CommonConstans.ANALYSE_TYPE_DAY.equals(analysisType)) {
dateInfoBy15 = idxBizFanHealthIndexMapper.getDateInfo(startTime, endTime);
} else if (CommonConstans.ANALYSE_TYPE_HOUR.equals(analysisType)) {
dateInfoBy15 = idxBizFanHealthIndexMapper.getHourInfo(startTime, endTime);
} else if (CommonConstans.ANALYSE_TYPE_MOMENT.equals(analysisType)) {
dateInfoBy15 = idxBizFanHealthIndexMapper.getMomentInfo(startTime, endTime);
}
} else {
dateInfoBy15 = idxBizFanHealthIndexMapper.getDateInfoBy15();
}
List<String> valueList = new ArrayList<>(); List<String> valueList = new ArrayList<>();
String finalStationCode = stationCode; String finalStationCode = stationCode;
List<String> dateList = new ArrayList<>(); List<String> dateList = dateInfoBy15.stream().map(i -> i.get("date")).collect(Collectors.toList());
String finalAreaCode = areaCode; String finalAreaCode = areaCode;
dateInfoBy15.forEach(item -> { if (CommonConstans.ANALYSE_TYPE_DAY.equals(analysisType) || analysisType == null) {
String healthListInfo = fanHealthIndexMapper.getInfoByDate(finalAreaCode, finalStationCode, item.get("date")); List<String> fullDateList = dateList.stream().map(s -> {
valueList.add(CharSequenceUtil.isNotEmpty(healthListInfo) ? healthListInfo.replace(".0", "") : "100"); return s + " 00:00:00";
String date = item.get("date"); }).collect(Collectors.toList());
Date date1 = DateUtils.dateAddDays(DateUtil.parse(date, DateUtils.DATE_PATTERN), -1); List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getInfoByDate(finalAreaCode,
String format = DateUtil.format(date1, DateUtils.DATE_PATTERN); finalStationCode, fullDateList);
dateList.add(format); Map<String, Object> map = healthListInfo.stream().collect(Collectors
}); .toMap(i -> String.valueOf(i.get("recdate")), i -> i.get("healthindex"), (key1, key2) -> key2));
for (String date : dateList) {
String value = map.get(date + " 00:00:00") != null ? String.valueOf(map.get(date + " 00:00:00"))
: "100";
valueList.add(String.valueOf(Math.round(Double.valueOf(value) * 10.0) / 10.0));
}
} else if (CommonConstans.ANALYSE_TYPE_HOUR.equals(analysisType)) {
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getInfoByHour(finalAreaCode,
finalStationCode, dateList);
Map<String, Object> map = healthListInfo.stream().collect(Collectors
.toMap(i -> String.valueOf(i.get("recdate")), i -> i.get("healthindex"), (key1, key2) -> key2));
for (String date : dateList) {
String value = map.get(date) != null ? String.valueOf(map.get(date)) : "100";
valueList.add(String.valueOf(Math.round(Double.valueOf(value) * 10.0) / 10.0));
}
} else if (CommonConstans.ANALYSE_TYPE_MOMENT.equals(analysisType)) {
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getInfoByMoment(finalAreaCode,
finalStationCode, dateList);
Map<String, Object> map = healthListInfo.stream().collect(Collectors
.toMap(i -> String.valueOf(i.get("recdate")), i -> i.get("healthindex"), (key1, key2) -> key2));
for (String date : dateList) {
String value = map.get(date) != null ? String.valueOf(map.get(date)) : "100";
valueList.add(String.valueOf(Math.round(Double.valueOf(value) * 10.0) / 10.0));
}
}
List<Map<String, Object>> arrayList = new ArrayList<>(); List<Map<String, Object>> arrayList = new ArrayList<>();
HashMap<String, Object> stringStringHashMap = new HashMap<>(); HashMap<String, Object> stringStringHashMap = new HashMap<>();
...@@ -159,13 +218,14 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -159,13 +218,14 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "全域各片区设备预警情况(条) ", notes = "全域各片区设备预警情况(条) ") @ApiOperation(httpMethod = "GET", value = "全域各片区设备预警情况(条) ", notes = "全域各片区设备预警情况(条) ")
@GetMapping(value = "/getAllEquipAlarmInfo") @GetMapping(value = "/getAllEquipAlarmInfo")
public ResponseModel<Map<String, Object>> getAllEquipAlarmInfo(@RequestParam(required = false) String tableName) throws Exception { public ResponseModel<Map<String, Object>> getAllEquipAlarmInfo(@RequestParam(required = false) String tableName)
throws Exception {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> allEquipAlarmInfo = new ArrayList<>(); List<Map<String, Object>> allEquipAlarmInfo = new ArrayList<>();
if (tableName.contains("fan")){ if (tableName.contains("fan")) {
allEquipAlarmInfo = fanWaringRecordMapper.getAllEquipAlarmInfo(); allEquipAlarmInfo = fanWaringRecordMapper.getAllEquipAlarmInfo();
}else { } else {
allEquipAlarmInfo = pvWaringRecordMapper.getAllEquipAlarmInfo(); allEquipAlarmInfo = pvWaringRecordMapper.getAllEquipAlarmInfo();
} }
HashMap<String, Integer> wxMap = new HashMap<>(); HashMap<String, Integer> wxMap = new HashMap<>();
...@@ -185,8 +245,6 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -185,8 +245,6 @@ public class TDBigScreenAnalyseController extends BaseController {
List<Integer> jgList = new ArrayList<>(); List<Integer> jgList = new ArrayList<>();
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList("AREA"); FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList("AREA");
List<CompanyModel> companyModels = new ArrayList<>(); List<CompanyModel> companyModels = new ArrayList<>();
...@@ -230,15 +288,16 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -230,15 +288,16 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "全域各片区设备健康状态指数 ", notes = "全域各片区设备健康状态指数 ") @ApiOperation(httpMethod = "GET", value = "全域各片区设备健康状态指数 ", notes = "全域各片区设备健康状态指数 ")
@GetMapping(value = "/getHealthInfoByArea") @GetMapping(value = "/getHealthInfoByArea")
public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception { public ResponseModel<Map<String, Object>> getHealthInfoByArea() throws Exception {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByArea(); // List<Map<String, Object>> healthListInfo =
// idxBizFanHealthIndexMapper.getHealthInfoByArea();
List<Map<String, Object>> healthListInfo = fanHealthIndexDayMapper.getHealthInfoByArea(); List<Map<String, Object>> healthListInfo = fanHealthIndexDayMapper.getHealthInfoByArea();
Map<String, Integer> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", "")))); Map<String, Integer> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(),
t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", ""))));
// List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区"); // List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
...@@ -262,11 +321,11 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -262,11 +321,11 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "全域各场站设备实时预警处置信息", notes = "全域各场站设备实时预警处置信息") @ApiOperation(httpMethod = "GET", value = "全域各场站设备实时预警处置信息", notes = "全域各场站设备实时预警处置信息")
@GetMapping(value = "/getEquipWarningInfoByPage") @GetMapping(value = "/getEquipWarningInfoByPage")
public ResponseModel<IPage<FanWarningRecord>> getEquipWarningInfoByPage(@RequestParam(value = "arae", required = false) String arae, public ResponseModel<IPage<FanWarningRecord>> getEquipWarningInfoByPage(
@RequestParam(value = "arae", required = false) String arae,
@RequestParam(value = "station", required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "stationType", required = false) String stationType, @RequestParam(value = "stationType", required = false) String stationType,
@RequestParam(value = "current", required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
...@@ -276,16 +335,21 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -276,16 +335,21 @@ public class TDBigScreenAnalyseController extends BaseController {
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate) { @RequestParam(value = "endDate", required = false) String endDate) {
if (StrUtil.isNotEmpty(stationId)) { if (StrUtil.isNotEmpty(stationId)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
stationId = stationBasic.getFanGatewayId(); stationId = stationBasic.getFanGatewayId();
} }
if (arae != null ) { if (arae != null) {
arae = "%"+arae +"%"; } arae = "%" + arae + "%";
Integer count = fanWaringRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType, warningName, stationId, startDate, endDate); }
// List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName, stationId, startDate, endDate); Integer count = fanWaringRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType, warningName,
List<FanWarningRecord> idxBizFanWarningRecordIPage = fanWaringRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName, stationId, startDate, endDate); stationId, startDate, endDate);
// List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage =
// idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station,
// stationType, (current - 1) * size, size, warningName, stationId, startDate,
// endDate);
List<FanWarningRecord> idxBizFanWarningRecordIPage = fanWaringRecordMapper.getEquipWarningInfoByPage(arae,
station, stationType, (current - 1) * size, size, warningName, stationId, startDate, endDate);
Page<FanWarningRecord> idxBizFanWarningRecordPage = new Page<>(current, size); Page<FanWarningRecord> idxBizFanWarningRecordPage = new Page<>(current, size);
idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage); idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage);
...@@ -293,15 +357,15 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -293,15 +357,15 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(idxBizFanWarningRecordPage); return ResponseHelper.buildResponse(idxBizFanWarningRecordPage);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "各场站设备预警情况(条) ", notes = "各场站设备预警情况(条) ") @ApiOperation(httpMethod = "GET", value = "各场站设备预警情况(条) ", notes = "各场站设备预警情况(条) ")
@GetMapping(value = "/getAllEquipAlarmInfoByStation") @GetMapping(value = "/getAllEquipAlarmInfoByStation")
public ResponseModel<Map<String, Object>> getAllEquipAlarmInfoByStation(String area) { public ResponseModel<Map<String, Object>> getAllEquipAlarmInfoByStation(String area) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
// List<Map<String, Object>> allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoByStation(); // List<Map<String, Object>> allEquipAlarmInfo =
if (StrUtil.isNotEmpty(area) ){ // idxBizFanHealthIndexMapper.getAllEquipAlarmInfoByStation();
area = "%"+area +"%"; if (StrUtil.isNotEmpty(area)) {
area = "%" + area + "%";
} }
List<Map<String, Object>> allEquipAlarmInfo = fanWaringRecordMapper.getAllEquipAlarmInfoByStation(area); List<Map<String, Object>> allEquipAlarmInfo = fanWaringRecordMapper.getAllEquipAlarmInfoByStation(area);
HashMap<String, Integer> wxMap = new HashMap<>(); HashMap<String, Integer> wxMap = new HashMap<>();
...@@ -345,7 +409,6 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -345,7 +409,6 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "各场站健康状态指数 ", notes = "各场站健康状态指数 ") @ApiOperation(httpMethod = "GET", value = "各场站健康状态指数 ", notes = "各场站健康状态指数 ")
@GetMapping(value = "/getHealthInfoByStation") @GetMapping(value = "/getHealthInfoByStation")
...@@ -368,18 +431,18 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -368,18 +431,18 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET") @ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET")
@GetMapping("/equipWarningRadarMap") @GetMapping("/equipWarningRadarMap")
public ResponseModel<List<Map<String, Object>>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) { public ResponseModel<List<Map<String, Object>>> assessIndexRadarMap(
@RequestParam(required = false, value = "stationCode") String stationCode) {
if (CharSequenceUtil.isNotEmpty(stationCode)) { if (CharSequenceUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId(); stationCode = stationBasic.getFanGatewayId();
} }
List<Map<String, Object>> list = fanHealthIndexMapper.equipWarningRadarMapByTd(stationCode); List<Map<String, Object>> list = fanHealthIndexMapper.equipWarningRadarMapByTd(stationCode);
Map<String, Integer> warningNumMap = list.stream().collect(Collectors.toMap(t -> t.get("warningname").toString(), t -> Integer.parseInt(t.get("num").toString()))); Map<String, Integer> warningNumMap = list.stream().collect(
Collectors.toMap(t -> t.get("warningname").toString(), t -> Integer.parseInt(t.get("num").toString())));
List<String> warningList = Arrays.asList("注意", "警告", "危险"); List<String> warningList = Arrays.asList("注意", "警告", "危险");
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
warningList.forEach(item -> { warningList.forEach(item -> {
...@@ -391,12 +454,11 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -391,12 +454,11 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultList); return ResponseHelper.buildResponse(resultList);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "片区设备预警统计分析 - 右下角柱状图 ", notes = "片区设备预警统计分析 - 右下角柱状图 ") @ApiOperation(httpMethod = "GET", value = "片区设备预警统计分析 - 右下角柱状图 ", notes = "片区设备预警统计分析 - 右下角柱状图 ")
@GetMapping(value = "/getAllEquipAlarmInfoAnalysis") @GetMapping(value = "/getAllEquipAlarmInfoAnalysis")
public ResponseModel<Map<String, Object>> getAllEquipAlarmInfoAnalysis(@RequestParam(required = false) String stationType, public ResponseModel<Map<String, Object>> getAllEquipAlarmInfoAnalysis(
@RequestParam(required = false) String areaCode) { @RequestParam(required = false) String stationType, @RequestParam(required = false) String areaCode) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> allEquipAlarmInfo = new ArrayList<>(); List<Map<String, Object>> allEquipAlarmInfo = new ArrayList<>();
if (CharSequenceUtil.isNotEmpty(stationType)) { if (CharSequenceUtil.isNotEmpty(stationType)) {
...@@ -407,15 +469,15 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -407,15 +469,15 @@ public class TDBigScreenAnalyseController extends BaseController {
} }
} }
if (areaCode != null){ if (areaCode != null) {
areaCode = "%"+areaCode+"%"; areaCode = "%" + areaCode + "%";
} }
allEquipAlarmInfo = fanWaringRecordMapper.getAllEquipAlarmInfoAnalysisByArea(areaCode,stationType); allEquipAlarmInfo = fanWaringRecordMapper.getAllEquipAlarmInfoAnalysisByArea(areaCode, stationType);
List<Integer> wxList = new ArrayList<>(); List<Integer> wxList = new ArrayList<>();
List<Integer> zyList = new ArrayList<>(); List<Integer> zyList = new ArrayList<>();
List<Integer> jgList = new ArrayList<>(); List<Integer> jgList = new ArrayList<>();
List<String> list =new ArrayList<>(); List<String> list = new ArrayList<>();
for (Map<String, Object> map : allEquipAlarmInfo) { for (Map<String, Object> map : allEquipAlarmInfo) {
wxList.add(Integer.valueOf(map.get("危险").toString())); wxList.add(Integer.valueOf(map.get("危险").toString()));
zyList.add(Integer.valueOf(map.get("注意").toString())); zyList.add(Integer.valueOf(map.get("注意").toString()));
...@@ -440,17 +502,19 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -440,17 +502,19 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站 左侧风机信息列表") @ApiOperation(value = "风站 左侧风机信息列表")
@GetMapping("/getFanInfoByPage") @GetMapping("/getFanInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage(@RequestParam(value = "stationId", required = false) String stationId) { public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage(
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getFanInfoByPage(stationBasic.getFanGatewayId()); List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getFanInfoByPage(stationBasic.getFanGatewayId());
List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper.getFanHealthInfoList(stationBasic.getFanGatewayId()); List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors.toMap(t -> t.get("equipmentName"), t -> Double.parseDouble(t.get("avgHealthIndex").toString()))); .getFanHealthInfoList(stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors
.toMap(t -> t.get("equipmentName"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
equipmentList.forEach(item -> { equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0); Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
...@@ -474,7 +538,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -474,7 +538,7 @@ public class TDBigScreenAnalyseController extends BaseController {
String equipmentName = item.get("equipmentName").toString(); String equipmentName = item.get("equipmentName").toString();
String str1 = equipmentName.substring(0, equipmentName.indexOf("#")); String str1 = equipmentName.substring(0, equipmentName.indexOf("#"));
String str2 = equipmentName.substring(str1.length()+1, equipmentName.length()); String str2 = equipmentName.substring(str1.length() + 1, equipmentName.length());
String str3 = CharSequenceUtil.replace(str2, "风机", ""); String str3 = CharSequenceUtil.replace(str2, "风机", "");
item.put("equipmentNameSimple", str3); item.put("equipmentNameSimple", str3);
...@@ -488,24 +552,25 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -488,24 +552,25 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(mapPage); return ResponseHelper.buildResponse(mapPage);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站 风机子系统状态指数 柱状图") @ApiOperation(value = "风站 风机子系统状态指数 柱状图")
@GetMapping("/getSubSystemInfo") @GetMapping("/getSubSystemInfo")
public ResponseModel<Map<String, Object>> getSubSystemInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName, public ResponseModel<Map<String, Object>> getSubSystemInfo(
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName, stationBasic.getFanGatewayId()); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName,
Map<Object, Integer> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem"), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", "")))); stationBasic.getFanGatewayId());
Map<Object, Integer> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(
t -> t.get("subSystem"), t -> Integer.valueOf(t.get("healthIndex").toString().replace(".0", ""))));
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName); List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName);
equipmentList.forEach(item -> { equipmentList.forEach(item -> {
Integer equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100); Integer equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100);
seriesData.add(equipmentHealthScore); seriesData.add(equipmentHealthScore);
...@@ -519,14 +584,18 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -519,14 +584,18 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "该子系统各指标预警 - 风站中间 下方列表") @ApiOperation(value = "该子系统各指标预警 - 风站中间 下方列表")
@GetMapping("/getSubSystemPointInfo") @GetMapping("/getSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getSubSystemPointInfo(@RequestParam(value = "subSystem", required = false) String subSystem, public ResponseModel<Page<Map<String, Object>>> getSubSystemPointInfo(
@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "stationId", required = false) String stationId) throws UnsupportedEncodingException { @RequestParam(value = "stationId", required = false) String stationId) throws UnsupportedEncodingException {
subSystem = java.net.URLDecoder.decode(subSystem,"UTF-8"); subSystem = java.net.URLDecoder.decode(subSystem, "UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId()); // List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getWarningInfoBySubSystemTd(subSystem, stationBasic.getFanGatewayId()); List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getWarningInfoBySubSystemTd(subSystem,
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointname"), t -> t.get("warningname").toString())); stationBasic.getFanGatewayId());
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem); Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("pointname"), t -> t.get("warningname").toString()));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper
.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem);
pointNameList.forEach(item -> { pointNameList.forEach(item -> {
String warningName = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全"); String warningName = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全");
int sort = 4; int sort = 4;
...@@ -550,19 +619,19 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -550,19 +619,19 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(mapPage); return ResponseHelper.buildResponse(mapPage);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 左侧风机信息列表") @ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage") @GetMapping("/getPvInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage(@RequestParam(value = "stationId", required = false) String stationId) { public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage(
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getPvInfoByPage(stationBasic.getFanGatewayId()); List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getPvInfoByPage(stationBasic.getFanGatewayId());
List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper.getPvHealthInfoList(stationBasic.getFanGatewayId()); List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors.toMap(t -> t.get("subarray"), t -> Double.parseDouble(t.get("avgHealthIndex").toString()))); .getPvHealthInfoList(stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(
Collectors.toMap(t -> t.get("subarray"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
equipmentList.forEach(item -> { equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subarray"), 100.0); Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subarray"), 100.0);
...@@ -590,24 +659,25 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -590,24 +659,25 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(mapPage); return ResponseHelper.buildResponse(mapPage);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 子阵下各设备状态指数 柱状图") @ApiOperation(value = "光伏 子阵下各设备状态指数 柱状图")
@GetMapping("/getPvSubSystemInfo") @GetMapping("/getPvSubSystemInfo")
public ResponseModel<Map<String, Object>> getPvSubSystemInfo(@RequestParam(value = "subarray", required = false) String subarray, public ResponseModel<Map<String, Object>> getPvSubSystemInfo(
@RequestParam(value = "subarray", required = false) String subarray,
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray, stationBasic.getFanGatewayId()); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray,
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex").toString().replace(".0", ""))); stationBasic.getFanGatewayId());
Map<Object, Object> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors
.toMap(t -> t.get("equipmentName"), t -> t.get("avgHealthIndex").toString().replace(".0", "")));
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray); List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper
.getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray);
equipmentList.forEach(item -> { equipmentList.forEach(item -> {
Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100); Object equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100);
seriesData.add(equipmentHealthScore); seriesData.add(equipmentHealthScore);
...@@ -621,14 +691,18 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -621,14 +691,18 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表") @ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表")
@GetMapping("/getPvSubSystemPointInfo") @GetMapping("/getPvSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName, public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) throws UnsupportedEncodingException { @RequestParam(value = "stationId", required = false) String stationId) throws UnsupportedEncodingException {
equipmentName = java.net.URLDecoder.decode(equipmentName,"UTF-8"); equipmentName = java.net.URLDecoder.decode(equipmentName, "UTF-8");
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId()); // List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getPvWarningInfoBySubSystemTd(equipmentName, stationBasic.getFanGatewayId()); List<Map<String, Object>> healthListInfo = fanHealthIndexMapper.getPvWarningInfoBySubSystemTd(equipmentName,
Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointname"), t -> t.get("warningname").toString())); stationBasic.getFanGatewayId());
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName); Map<Object, String> equipmentHealthIndexMap = healthListInfo.stream()
.collect(Collectors.toMap(t -> t.get("pointname"), t -> t.get("warningname").toString()));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper
.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
pointNameList.forEach(item -> { pointNameList.forEach(item -> {
String equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全"); String equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), "安全");
int sort = 4; int sort = 4;
...@@ -652,25 +726,25 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -652,25 +726,25 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(mapPage); return ResponseHelper.buildResponse(mapPage);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势") @ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddress") @GetMapping("/getTrendInfoByAddress")
public ResponseModel<Map<String, Object>> getTrendInfoByAddress(@RequestParam(value = "indexAddress", required = false) String indexAddress, public ResponseModel<Map<String, Object>> getTrendInfoByAddress(
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId, @RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "tableName", required = false) String tableName, @RequestParam(value = "tableName", required = false) String tableName,
@RequestParam(value = "tableName2", required = false) String tableName2) throws ParseException { @RequestParam(value = "tableName2", required = false) String tableName2) throws ParseException {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> resultListData = new ArrayList<>(); List<Map<String, Object>> resultListData = new ArrayList<>();
String recDate = fanHealthIndexMapper.getRecDateByIndexAddressTs(stationBasic.getFanGatewayId(), indexAddress, tableName); String recDate = fanHealthIndexMapper.getRecDateByIndexAddressTs(stationBasic.getFanGatewayId(), indexAddress,
tableName);
if (CharSequenceUtil.isNotEmpty(recDate)) { if (CharSequenceUtil.isNotEmpty(recDate)) {
Date date = DateUtils.dateParse(recDate, DATE_TIME_PATTERN); Date date = DateUtils.dateParse(recDate, DATE_TIME_PATTERN);
String datejian8 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -8), DATE_TIME_PATTERN); String datejian8 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -8), DATE_TIME_PATTERN);
String datejian20 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -20), DATE_TIME_PATTERN); String datejian20 = DateUtils.dateFormat(DateUtils.dateAddHours(date, -20), DATE_TIME_PATTERN);
resultListData = fanHealthIndexMapper.getInfoListByTableNameTs(stationBasic.getFanGatewayId(), indexAddress, tableName2, datejian8, datejian20); resultListData = fanHealthIndexMapper.getInfoListByTableNameTs(stationBasic.getFanGatewayId(), indexAddress,
tableName2, datejian8, datejian20);
} }
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
...@@ -678,11 +752,14 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -678,11 +752,14 @@ public class TDBigScreenAnalyseController extends BaseController {
resultListData.forEach(item -> { resultListData.forEach(item -> {
String date = ""; String date = "";
try { try {
date = DateUtils.convertDateToString(DateUtils.dateParse(item.get("recdate").toString(), DateUtils.DATE_TIME_PATTERN), "MM-dd HH:mm:ss"); date = DateUtils.convertDateToString(
DateUtils.dateParse(item.get("recdate").toString(), DateUtils.DATE_TIME_PATTERN),
"MM-dd HH:mm:ss");
} catch (ParseException e) { } catch (ParseException e) {
} }
time.add(date); time.add(date);
String value = CharSequenceUtil.isEmpty(item.get("healthindex").toString().replace(".0", "")) ? "100" : item.get("healthindex").toString().replace(".0", ""); String value = CharSequenceUtil.isEmpty(item.get("healthindex").toString().replace(".0", "")) ? "100"
: item.get("healthindex").toString().replace(".0", "");
valueList.add(value); valueList.add(value);
}); });
List<Map<String, Object>> arrayList = new ArrayList<>(); List<Map<String, Object>> arrayList = new ArrayList<>();
...@@ -697,14 +774,17 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -697,14 +774,17 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据测点ID查询测点名称") @ApiOperation(value = "根据测点ID查询测点名称")
@GetMapping("/getMapStringByString") @GetMapping("/getMapStringByString")
public ResponseModel<Map<String, Object>> getMapStringByString(@RequestParam(value = "indexAddress", required = false) String indexAddress, public ResponseModel<Map<String, Object>> getMapStringByString(
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "tableName", required = true) String tableName, @RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId", required = true) String stationId, @RequestParam(value = "stationId", required = true) String stationId,
@RequestParam(value = "tableName2", required = false) String tableName2) { @RequestParam(value = "tableName2", required = false) String tableName2) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName, stationBasic.getFanGatewayId()); String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName,
stationBasic.getFanGatewayId());
int num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(), tableName2); int num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(),
tableName2);
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("text", nameByIndexAddress); resultMap.put("text", nameByIndexAddress);
...@@ -715,12 +795,14 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -715,12 +795,14 @@ public class TDBigScreenAnalyseController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下诊断分析") @ApiOperation(value = "风站/光伏 右下诊断分析")
@GetMapping("/getRiskHandleByVarDesc") @GetMapping("/getRiskHandleByVarDesc")
public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(@RequestParam(value = "varDesc", required = false) String varDesc, public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(
@RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName, @RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId") String stationId) { @RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName, stationBasic.getFanGatewayId()); varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null; FeignClientResult<List<String>> sevenEntityMcb = null;
try { try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc); sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
...@@ -742,13 +824,14 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -742,13 +824,14 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(stringStringHashMap); return ResponseHelper.buildResponse(stringStringHashMap);
} }
private IdxBizFanHealthLevel getHealthLevelByScore(List<IdxBizFanHealthLevel> healthLevelInfoList, String station,
private IdxBizFanHealthLevel getHealthLevelByScore(List<IdxBizFanHealthLevel> healthLevelInfoList, String station, String type, Double score) { String type, Double score) {
IdxBizFanHealthLevel resultDto = new IdxBizFanHealthLevel(); IdxBizFanHealthLevel resultDto = new IdxBizFanHealthLevel();
String stationType = "风电站"; String stationType = "风电站";
List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList()); List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream()
.filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList());
for (IdxBizFanHealthLevel item : collect) { for (IdxBizFanHealthLevel item : collect) {
if (!item.getAnalysisObjType().contains("子系统")) { if (!item.getAnalysisObjType().contains("子系统")) {
stationType = "光伏站"; stationType = "光伏站";
...@@ -756,25 +839,30 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -756,25 +839,30 @@ public class TDBigScreenAnalyseController extends BaseController {
} }
for (IdxBizFanHealthLevel item : collect) { for (IdxBizFanHealthLevel item : collect) {
if (type.equals("设备") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) { if (type.equals("设备") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type)
&& score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
resultDto = item; resultDto = item;
break; break;
} }
if (type.equals("子系统") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) { if (type.equals("子系统") && stationType.equals("风电站") && item.getAnalysisObjType().contains(type)
&& score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
resultDto = item; resultDto = item;
break; break;
} }
if (type.equals("测点") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) { if (type.equals("测点") && item.getAnalysisObjType().contains(type) && score >= item.getGroupLowerLimit()
&& score <= item.getGroupUpperLimit()) {
resultDto = item; resultDto = item;
break; break;
} }
if (type.equals("设备") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("子阵") && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) { if (type.equals("设备") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("子阵")
&& score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
resultDto = item; resultDto = item;
break; break;
} }
if (type.equals("子系统") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("设备") && score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit() ) { if (type.equals("子系统") && stationType.equals("光伏站") && item.getAnalysisObjType().contains("设备")
&& score >= item.getGroupLowerLimit() && score <= item.getGroupUpperLimit()) {
resultDto = item; resultDto = item;
break; break;
} }
...@@ -790,25 +878,27 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -790,25 +878,27 @@ public class TDBigScreenAnalyseController extends BaseController {
HashMap<String, Object> resultMapFinally = new HashMap<>(); HashMap<String, Object> resultMapFinally = new HashMap<>();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo(); List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors
.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfo(); List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfo();
Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(
t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfo(); List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfo();
Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors
.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfo(); List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfo();
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream()
.collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(),
t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(); List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList();
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(); List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall();
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream() Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list
.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation, Collectors.groupingBy(FullViewRecallDataDTO::getStation,
Collectors.groupingBy(FullViewRecallDataDTO::getEquipmentName, Collectors.groupingBy(FullViewRecallDataDTO::getEquipmentName,
...@@ -841,11 +931,13 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -841,11 +931,13 @@ public class TDBigScreenAnalyseController extends BaseController {
allMapDto.setCategory("category"); allMapDto.setCategory("category");
fullViewRecallList.add(allMapDto); fullViewRecallList.add(allMapDto);
for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap.entrySet()) { for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap
.entrySet()) {
Double areaLowScore = null; Double areaLowScore = null;
Double areaHighScore = null; Double areaHighScore = null;
Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(areaMap.getKey(), null).doubleValue(); Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(areaMap.getKey(), null)
.doubleValue();
LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>();
areaQuery.isNull(IdxBizFanHealthLevel::getStatus); areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
...@@ -865,7 +957,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -865,7 +957,8 @@ public class TDBigScreenAnalyseController extends BaseController {
areaMapFromTo.put("to", areaMapDto.getKey()); areaMapFromTo.put("to", areaMapDto.getKey());
resultMapFromToList.add(areaMapFromTo); resultMapFromToList.add(areaMapFromTo);
areaInt++; areaInt++;
for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap.getValue().entrySet()) { for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap
.getValue().entrySet()) {
Double stationLowScore = null; Double stationLowScore = null;
Double stationHighScore = null; Double stationHighScore = null;
if (areaLowScore == null && areaHighScore == null) { if (areaLowScore == null && areaHighScore == null) {
...@@ -910,9 +1003,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -910,9 +1003,8 @@ public class TDBigScreenAnalyseController extends BaseController {
stationMapFromTo.put("to", stationDto.getKey()); stationMapFromTo.put("to", stationDto.getKey());
resultMapFromToList.add(stationMapFromTo); resultMapFromToList.add(stationMapFromTo);
stationInt++; stationInt++;
for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap.getValue().entrySet()) { for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap
.getValue().entrySet()) {
if (stationLowScore == null && stationHighScore == null) { if (stationLowScore == null && stationHighScore == null) {
stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0); stationLowScore = equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0);
...@@ -926,15 +1018,14 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -926,15 +1018,14 @@ public class TDBigScreenAnalyseController extends BaseController {
} }
} }
FullViewRecallInfoDTO equipmentMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO equipmentMapDto = new FullViewRecallInfoDTO();
equipmentMapDto.setKey(stationDto.getKey() + "-" + equipmentInt); equipmentMapDto.setKey(stationDto.getKey() + "-" + equipmentInt);
equipmentMapDto.setName(equipmentMap.getKey()); equipmentMapDto.setName(equipmentMap.getKey());
equipmentMapDto.setLoc(1000 + " " + (400 + 200 * (equipmentInt - 1))); equipmentMapDto.setLoc(1000 + " " + (400 + 200 * (equipmentInt - 1)));
equipmentMapDto.setScoreRange(""); equipmentMapDto.setScoreRange("");
IdxBizFanHealthLevel levelInfo = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "设备", equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0)); IdxBizFanHealthLevel levelInfo = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(),
"设备", equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
equipmentMapDto.setStatus(levelInfo.getHealthLevel()); equipmentMapDto.setStatus(levelInfo.getHealthLevel());
equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0)); equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
fullViewRecallList.add(equipmentMapDto); fullViewRecallList.add(equipmentMapDto);
...@@ -943,7 +1034,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -943,7 +1034,8 @@ public class TDBigScreenAnalyseController extends BaseController {
equipmentMapFromTo.put("to", equipmentMapDto.getKey()); equipmentMapFromTo.put("to", equipmentMapDto.getKey());
resultMapFromToList.add(equipmentMapFromTo); resultMapFromToList.add(equipmentMapFromTo);
equipmentInt++; equipmentInt++;
for (Map.Entry<String, Map<String, List<FullViewRecallDataDTO>>> subSystemMap : equipmentMap.getValue().entrySet()) { for (Map.Entry<String, Map<String, List<FullViewRecallDataDTO>>> subSystemMap : equipmentMap
.getValue().entrySet()) {
FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO();
subSystemMapDto.setKey(equipmentMapDto.getKey() + "-" + subSystemInt); subSystemMapDto.setKey(equipmentMapDto.getKey() + "-" + subSystemInt);
subSystemMapDto.setName(subSystemMap.getKey()); subSystemMapDto.setName(subSystemMap.getKey());
...@@ -951,7 +1043,9 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -951,7 +1043,9 @@ public class TDBigScreenAnalyseController extends BaseController {
subSystemMapDto.setScoreRange(""); subSystemMapDto.setScoreRange("");
// subSystemMapDto.setStatus(null); // subSystemMapDto.setStatus(null);
IdxBizFanHealthLevel levelInfoZxt = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "子系统", subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0)); IdxBizFanHealthLevel levelInfoZxt = getHealthLevelByScore(healthLevelInfoList,
stationMap.getKey(), "子系统",
subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
subSystemMapDto.setStatus(levelInfoZxt.getHealthLevel()); subSystemMapDto.setStatus(levelInfoZxt.getHealthLevel());
subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0)); subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
...@@ -961,7 +1055,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -961,7 +1055,8 @@ public class TDBigScreenAnalyseController extends BaseController {
subSystemMapFromTo.put("to", subSystemMapDto.getKey()); subSystemMapFromTo.put("to", subSystemMapDto.getKey());
resultMapFromToList.add(subSystemMapFromTo); resultMapFromToList.add(subSystemMapFromTo);
subSystemInt++; subSystemInt++;
for (Map.Entry<String, List<FullViewRecallDataDTO>> pointNameMap : subSystemMap.getValue().entrySet()) { for (Map.Entry<String, List<FullViewRecallDataDTO>> pointNameMap : subSystemMap.getValue()
.entrySet()) {
FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO(); FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO();
pointNameMapDto.setKey(subSystemMapDto.getKey() + "-" + pointNameInt); pointNameMapDto.setKey(subSystemMapDto.getKey() + "-" + pointNameInt);
pointNameMapDto.setName(pointNameMap.getKey()); pointNameMapDto.setName(pointNameMap.getKey());
...@@ -971,10 +1066,15 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -971,10 +1066,15 @@ public class TDBigScreenAnalyseController extends BaseController {
pointNameMapDto.setLoc(3800 + " " + (250 + 80 * (pointNameInt - 1))); pointNameMapDto.setLoc(3800 + " " + (250 + 80 * (pointNameInt - 1)));
pointNameMapDto.setScoreRange(""); pointNameMapDto.setScoreRange("");
IdxBizFanHealthLevel levelInfoBL = getHealthLevelByScore(healthLevelInfoList, stationMap.getKey(), "测点", pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0)); IdxBizFanHealthLevel levelInfoBL = getHealthLevelByScore(healthLevelInfoList,
stationMap.getKey(), "测点",
pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_"
+ fullViewRecallDataDTO.getIndexAddress(), 100.0));
pointNameMapDto.setStatus(levelInfoBL.getHealthLevel()); pointNameMapDto.setStatus(levelInfoBL.getHealthLevel());
pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0)); pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(
fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(),
100.0));
fullViewRecallList.add(pointNameMapDto); fullViewRecallList.add(pointNameMapDto);
HashMap<String, String> pointNameMapFromTo = new HashMap<>(); HashMap<String, String> pointNameMapFromTo = new HashMap<>();
pointNameMapFromTo.put("from", subSystemMapDto.getKey()); pointNameMapFromTo.put("from", subSystemMapDto.getKey());
...@@ -998,11 +1098,11 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -998,11 +1098,11 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMapFinally); return ResponseHelper.buildResponse(resultMapFinally);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取区域信息,根据层级查询单位信息 key 和 value都是区域名称") @ApiOperation(value = "获取区域信息,根据层级查询单位信息 key 和 value都是区域名称")
@GetMapping("/getAreaListByLevel") @GetMapping("/getAreaListByLevel")
public ResponseModel<List<Map<String, String>>> getAreaListByLevel(@RequestParam("level") String level) throws Exception { public ResponseModel<List<Map<String, String>>> getAreaListByLevel(@RequestParam("level") String level)
throws Exception {
FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList(level); FeignClientResult<List<CompanyModel>> listFeignClientResult = Privilege.companyClient.queryAgencyList(level);
ArrayList<Map<String, String>> maps = new ArrayList<>(); ArrayList<Map<String, String>> maps = new ArrayList<>();
if (!ObjectUtils.isEmpty(listFeignClientResult)) { if (!ObjectUtils.isEmpty(listFeignClientResult)) {
...@@ -1024,16 +1124,18 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -1024,16 +1124,18 @@ public class TDBigScreenAnalyseController extends BaseController {
@ApiOperation(value = "风电-场站风速 、 光伏-辐照强度 (WTX-801_25_WTX-801_总辐射)") @ApiOperation(value = "风电-场站风速 、 光伏-辐照强度 (WTX-801_25_WTX-801_总辐射)")
@GetMapping("/getFanWindSpeedInfo") @GetMapping("/getFanWindSpeedInfo")
public ResponseModel<Map<String, Object>> getFanWindSpeedInfo(@RequestParam("stationId") String stationId, public ResponseModel<Map<String, Object>> getFanWindSpeedInfo(@RequestParam("stationId") String stationId,
@RequestParam("equipmentIndexName") String equipmentIndexName, @RequestParam("equipmentIndexName") String equipmentIndexName, @RequestParam("limitNum") Integer limitNum,
@RequestParam("limitNum") Integer limitNum,
@RequestParam(value = "stationType", required = false) String stationType) throws Exception { @RequestParam(value = "stationType", required = false) String stationType) throws Exception {
if (StrUtil.isNotEmpty(stationId)) { if (StrUtil.isNotEmpty(stationId)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
stationId = StrUtil.isNotEmpty(stationType) ? stationBasic.getBoosterGatewayId() : stationBasic.getFanGatewayId(); stationId = StrUtil.isNotEmpty(stationType) ? stationBasic.getBoosterGatewayId()
: stationBasic.getFanGatewayId();
} }
String date = DateUtils.convertDateToString(DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8), DateUtils.DATE_TIME_PATTERN); String date = DateUtils.convertDateToString(
List<IndicatorData> indicatorDataList = indicatorDataMapper.selectByIndexNameAndDate(equipmentIndexName, stationId, date, limitNum); DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8), DateUtils.DATE_TIME_PATTERN);
Map<String,Object> map = new HashMap<>(); List<IndicatorData> indicatorDataList = indicatorDataMapper.selectByIndexNameAndDate(equipmentIndexName,
stationId, date, limitNum);
Map<String, Object> map = new HashMap<>();
List<Object> valueList = new ArrayList<>(); List<Object> valueList = new ArrayList<>();
List<Object> time = new ArrayList<>(); List<Object> time = new ArrayList<>();
Collections.reverse(indicatorDataList); Collections.reverse(indicatorDataList);
...@@ -1044,78 +1146,45 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -1044,78 +1146,45 @@ public class TDBigScreenAnalyseController extends BaseController {
time.add(s); time.add(s);
} }
map.put("seriesData", valueList); map.put("seriesData", valueList);
map.put("axisData",time); map.put("axisData", time);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "修改业务事实表的一条数据") @ApiOperation(value = "修改业务事实表的一条数据")
@PutMapping("/updateRowAndManyTable") @PutMapping("/updateRowAndManyTable")
public ResponseModel<Boolean> updateRowAndManyTable(@RequestBody Map<String, Object> kv) { public ResponseModel<Boolean> updateRowAndManyTable(@RequestBody Map<String, Object> kv) {
if ("安全".equals(kv.get("HEALTH_LEVEL").toString()) if ("安全".equals(kv.get("HEALTH_LEVEL").toString()) && (!"100.0".equals(kv.get("GROUP_UPPER_LIMIT").toString())
&& (!"100.0".equals(kv.get("GROUP_UPPER_LIMIT").toString())
&& !"100".equals(kv.get("GROUP_UPPER_LIMIT").toString()))) { && !"100".equals(kv.get("GROUP_UPPER_LIMIT").toString()))) {
throw new RuntimeException("安全的分数上限只能是100"); throw new RuntimeException("安全的分数上限只能是100");
} }
if ("危险".equals(kv.get("HEALTH_LEVEL").toString()) if ("危险".equals(kv.get("HEALTH_LEVEL").toString()) && (!"0.0".equals(kv.get("GROUP_LOWER_LIMIT").toString())
&& (!"0.0".equals(kv.get("GROUP_LOWER_LIMIT").toString())
&& !"0".equals(kv.get("GROUP_LOWER_LIMIT").toString()))) { && !"0".equals(kv.get("GROUP_LOWER_LIMIT").toString()))) {
throw new RuntimeException("危险的分数下限只能是0"); throw new RuntimeException("危险的分数下限只能是0");
} }
idxBizFanHealthLevelMapper.updateByInfo( idxBizFanHealthLevelMapper.updateByInfo("idx_biz_pv_health_level", kv.get("GROUP_UPPER_LIMIT").toString(),
"idx_biz_pv_health_level", kv.get("GROUP_LOWER_LIMIT").toString(), kv.get("ANALYSIS_OBJ_TYPE").toString(),
kv.get("GROUP_UPPER_LIMIT").toString(),
kv.get("GROUP_LOWER_LIMIT").toString(),
kv.get("ANALYSIS_OBJ_TYPE").toString(),
kv.get("HEALTH_LEVEL").toString()); kv.get("HEALTH_LEVEL").toString());
idxBizFanHealthLevelMapper.updateByInfo( idxBizFanHealthLevelMapper.updateByInfo("idx_biz_fan_health_level", kv.get("GROUP_UPPER_LIMIT").toString(),
"idx_biz_fan_health_level", kv.get("GROUP_LOWER_LIMIT").toString(), kv.get("ANALYSIS_OBJ_TYPE").toString(),
kv.get("GROUP_UPPER_LIMIT").toString(),
kv.get("GROUP_LOWER_LIMIT").toString(),
kv.get("ANALYSIS_OBJ_TYPE").toString(),
kv.get("HEALTH_LEVEL").toString()); kv.get("HEALTH_LEVEL").toString());
if ("安全".equals(kv.get("HEALTH_LEVEL").toString())) { if ("安全".equals(kv.get("HEALTH_LEVEL").toString())) {
idxBizFanHealthLevelMapper.updateByInfoIsNull( idxBizFanHealthLevelMapper.updateByInfoIsNull("idx_biz_fan_health_level",
"idx_biz_fan_health_level", kv.get("GROUP_LOWER_LIMIT").toString(), null, kv.get("ANALYSIS_OBJ_TYPE").toString(), "注意");
kv.get("GROUP_LOWER_LIMIT").toString(), idxBizFanHealthLevelMapper.updateByInfoIsNull("idx_biz_pv_health_level",
null, kv.get("GROUP_LOWER_LIMIT").toString(), null, kv.get("ANALYSIS_OBJ_TYPE").toString(), "注意");
kv.get("ANALYSIS_OBJ_TYPE").toString(),
"注意");
idxBizFanHealthLevelMapper.updateByInfoIsNull(
"idx_biz_pv_health_level",
kv.get("GROUP_LOWER_LIMIT").toString(),
null,
kv.get("ANALYSIS_OBJ_TYPE").toString(),
"注意");
} else if ("注意".equals(kv.get("HEALTH_LEVEL").toString())) { } else if ("注意".equals(kv.get("HEALTH_LEVEL").toString())) {
idxBizFanHealthLevelMapper.updateByInfoIsNull( idxBizFanHealthLevelMapper.updateByInfoIsNull("idx_biz_fan_health_level",
"idx_biz_fan_health_level", kv.get("GROUP_LOWER_LIMIT").toString(), null, kv.get("ANALYSIS_OBJ_TYPE").toString(), "警告");
kv.get("GROUP_LOWER_LIMIT").toString(), idxBizFanHealthLevelMapper.updateByInfoIsNull("idx_biz_pv_health_level",
null, kv.get("GROUP_LOWER_LIMIT").toString(), null, kv.get("ANALYSIS_OBJ_TYPE").toString(), "警告");
kv.get("ANALYSIS_OBJ_TYPE").toString(),
"警告");
idxBizFanHealthLevelMapper.updateByInfoIsNull(
"idx_biz_pv_health_level",
kv.get("GROUP_LOWER_LIMIT").toString(),
null,
kv.get("ANALYSIS_OBJ_TYPE").toString(),
"警告");
} else if ("警告".equals(kv.get("HEALTH_LEVEL").toString())) { } else if ("警告".equals(kv.get("HEALTH_LEVEL").toString())) {
idxBizFanHealthLevelMapper.updateByInfoIsNull( idxBizFanHealthLevelMapper.updateByInfoIsNull("idx_biz_fan_health_level",
"idx_biz_fan_health_level", kv.get("GROUP_LOWER_LIMIT").toString(), null, kv.get("ANALYSIS_OBJ_TYPE").toString(), "危险");
kv.get("GROUP_LOWER_LIMIT").toString(), idxBizFanHealthLevelMapper.updateByInfoIsNull("idx_biz_pv_health_level",
null, kv.get("GROUP_LOWER_LIMIT").toString(), null, kv.get("ANALYSIS_OBJ_TYPE").toString(), "危险");
kv.get("ANALYSIS_OBJ_TYPE").toString(),
"危险");
idxBizFanHealthLevelMapper.updateByInfoIsNull(
"idx_biz_pv_health_level",
kv.get("GROUP_LOWER_LIMIT").toString(),
null,
kv.get("ANALYSIS_OBJ_TYPE").toString(),
"危险");
} }
if ("测点".equals(kv.get("ANALYSIS_OBJ_TYPE").toString())) { if ("测点".equals(kv.get("ANALYSIS_OBJ_TYPE").toString())) {
LambdaUpdateWrapper<IdxBizFanWarningRuleSet> lambda1 = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizFanWarningRuleSet> lambda1 = new LambdaUpdateWrapper<>();
...@@ -1131,35 +1200,39 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -1131,35 +1200,39 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(true); return ResponseHelper.buildResponse(true);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "全域/片区折线图", notes = "全域/片区折线图") @ApiOperation(httpMethod = "GET", value = "全域/片区折线图", notes = "全域/片区折线图")
@GetMapping(value = "/queryIndexByArae") @GetMapping(value = "/queryIndexByArae")
public ResponseModel<Map<String, Object>> queryIndexByArae(@RequestParam(required = false) String area, String analysisType, String startTimeTop, String endTimeTop) { public ResponseModel<Map<String, Object>> queryIndexByArae(@RequestParam(required = false) String area,
String analysisType, String startTimeTop, String endTimeTop) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){ if (null != endTimeTop) {
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop); List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectData(null, area, null, null, analysisType,
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区", null, null, null, startTimeTop, endTimeTop); "片区", null, null, null, startTimeTop, endTimeTop);
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.selectData(null, area, null, null, analysisType, "片区",
null, null, null, startTimeTop, endTimeTop);
for (PvHealthIndex pvHealthIndex : pvHealthIndices) { for (PvHealthIndex pvHealthIndex : pvHealthIndices) {
FanHealthIndex fanHealthIndex = new FanHealthIndex(); FanHealthIndex fanHealthIndex = new FanHealthIndex();
BeanUtils.copyProperties(pvHealthIndex,fanHealthIndex); BeanUtils.copyProperties(pvHealthIndex, fanHealthIndex);
fanHealthIndices.add(fanHealthIndex); fanHealthIndices.add(fanHealthIndex);
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
Map<String, List<FanHealthIndex>> mapList = fanHealthIndices.stream().collect(Collectors.groupingBy(FanHealthIndex::getAnalysisTime)); Map<String, List<FanHealthIndex>> mapList = fanHealthIndices.stream()
.collect(Collectors.groupingBy(FanHealthIndex::getAnalysisTime));
for (String s : mapList.keySet()) { for (String s : mapList.keySet()) {
List<FanHealthIndex> fanHealthIndices1 = mapList.get(s); List<FanHealthIndex> fanHealthIndices1 = mapList.get(s);
Double healtnIndex = fanHealthIndices1.stream().collect(Collectors.averagingDouble(FanHealthIndex::getHealthIndex)); Double healtnIndex = fanHealthIndices1.stream()
.collect(Collectors.averagingDouble(FanHealthIndex::getHealthIndex));
seriesData.add(healtnIndex.intValue()); seriesData.add(healtnIndex.intValue());
axisData.add(s); axisData.add(s);
} }
......
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2; package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto;
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.IdxBizFanHealthLevel; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -22,15 +22,25 @@ import java.util.Map; ...@@ -22,15 +22,25 @@ import java.util.Map;
public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> { public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIndex> {
BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode); BigDecimal getHealthScoreInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByLatest(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode); BigDecimal getHealthScoreInfoByLatest(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode, @Param("tableName") String tableName); BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode,
@Param("tableName") String tableName);
BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("analysisType") String analysisType); BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode,
@Param("analysisType") String analysisType);
List<Map<String, String>> getDateInfoBy15(); List<Map<String, String>> getDateInfoBy15();
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode); List<Map<String, String>> getDateInfo(Date startTime, Date endTime);
List<Map<String, String>> getHourInfo(Date startTime, Date endTime);
List<Map<String, String>> getMomentInfo(Date startTime, Date endTime);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode,
@Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName); List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
...@@ -38,59 +48,54 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -38,59 +48,54 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getAllEquipAlarmInfoByStation(); List<Map<String, Object>> getAllEquipAlarmInfoByStation();
List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode); List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode);
List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode); List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName, List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode, @Param("areaCode") String areaCode, @Param("stationType") String stationType);
@Param("stationType") String stationType);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode); List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode);
List<Map<String, Object>> getSubSystemInfo(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getSubSystemInfo(@Param("equipmentName") String equipmentName,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanInfoByPage(@Param("gatewayId") String gatewayId); List<Map<String, Object>> getFanInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanHealthInfoList(@Param("gatewayId") String gatewayId); List<Map<String, Object>> getFanHealthInfoList(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getSumSystemListByEquipment(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName); List<Map<String, Object>> getSumSystemListByEquipment(@Param("gatewayId") String gatewayId,
@Param("equipmentName") String equipmentName);
List<Map<String, Object>> getPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("subSystem") String subSystem);
List<Map<String, Object>> getHealthInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPointNameListBySumSystem(@Param("gatewayId") String gatewayId,
@Param("subSystem") String subSystem);
List<Map<String, Object>> getHealthInfoBySubSystem(@Param("subSystem") String subSystem,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getWarningInfoBySubSystem(@Param("subSystem") String subSystem,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvInfoByPage(@Param("gatewayId") String gatewayId); List<Map<String, Object>> getPvInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvHealthInfoList(@Param("gatewayId") String gatewayId); List<Map<String, Object>> getPvHealthInfoList(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvSubSystemInfo(@Param("subarray") String subarray,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvSumSystemListByEquipment(@Param("gatewayId") String gatewayId,
@Param("subarray") String subarray);
List<Map<String, Object>> getPvSubSystemInfo(@Param("subarray") String subarray, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvSumSystemListByEquipment(@Param("gatewayId") String gatewayId, @Param("subarray") String subarray);
List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvWarningInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName);
List<Map<String, Object>> getPvWarningInfoBySubSystem(@Param("equipmentName") String equipmentName,
@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId,
@Param("equipmentName") String equipmentName);
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName,
@Param("tableName") String tableName,
@Param("gatewayId") String gatewayId); @Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(); List<FullViewRecallDataDTO> getFullViewRecall();
...@@ -103,7 +108,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -103,7 +108,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPointNameIndexInfo(); List<Map<String, Object>> getPointNameIndexInfo();
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType);
...@@ -112,44 +116,46 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -112,44 +116,46 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType); List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType);
List<IdxBizFanHealthLevel> getHealthLevelInfoList(); List<IdxBizFanHealthLevel> getHealthLevelInfoList();
List<String> getAddressInfo(); List<String> getAddressInfo();
List<Map<String,Object>> queryForLeftTableList(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,Integer current,Integer size); List<Map<String, Object>> queryForLeftTableList(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
Integer current, Integer size);
int queryForLeftTableListCount(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME);
int queryForLeftTableListCount(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME); Map<String, Object> queryForLeftTableListNum(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME);
Map<String,Object> queryForLeftTableListNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME); List<Map<String, Object>> queryForLeftTableListByPoint(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
String POINTNAME, Integer current, Integer size);
List<Map<String,Object>> queryForLeftTableListByPoint(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME,Integer current,Integer size); List<Map<String, Object>> selectPointByANALYSISTYPE(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
String POINTNAME, String startTime, String endTime);
List<Map<String,Object>> selectPointByANALYSISTYPE(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME,String startTime,String endTime); Map<String, Object> getFanEquipStatusByStation(String STATION);
Map<String,Object> getFanEquipStatusByStation(String STATION);
int queryForLeftTableListByPointCount(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME); int queryForLeftTableListByPointCount(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME, String POINTNAME);
Map<String,Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL,String EQUIPMENTNAME,String POINTNAME); Map<String, Object> queryForLeftTableListByPointNum(String STATION, String HEALTHLEVEL, String EQUIPMENTNAME,
String POINTNAME);
List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME); List<IdxBizFanWarningRecord> warningData(String STATION, String SUBARRAY, String EQUIPMENTNAME);
Integer pointNum(String STATION, String SUBSYSTEM, String EQUIPMENTNAME); Integer pointNum(String STATION, String SUBSYSTEM, String EQUIPMENTNAME);
Map<String, Object> getPvEquipStatusByStation(String station); Map<String, Object> getPvEquipStatusByStation(String station);
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName); String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId, List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName,
@Param("tableName") String tableName,
@Param("recDate") String recDate); @Param("recDate") String recDate);
int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId,
@Param("tableName") String tableName);
List<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop,
int getIsWarningByPointId(@Param("indexAddress") String indexAddress, @Param("fanGatewayId") String fanGatewayId, @Param("tableName") String tableName); String endTimeTop);
List<Map<String,Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE,String startTimeTop,String endTimeTop);
} }
...@@ -95,5 +95,9 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { ...@@ -95,5 +95,9 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId); List<Map<String, Object>> getWarningInfoBySubSystemTd(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
String getInfoByDate(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("date") String date); List<Map<String,Object>> getInfoByDate(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
List<Map<String,Object>> getInfoByHour(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
List<Map<String,Object>> getInfoByMoment(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("list") List<String> list);
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper">
<select id="getHealthScoreInfo" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfo" resultType="java.math.BigDecimal">
SELECT SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex CEILING(avg( a.avgHealthIndex )) AS healthIndex
...@@ -22,11 +21,9 @@ ...@@ -22,11 +21,9 @@
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
UNION ALL UNION ALL
( (
...@@ -52,7 +49,6 @@ ...@@ -52,7 +49,6 @@
) )
) a ) a
</select> </select>
<select id="getHealthScoreInfoByParam" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByParam" resultType="java.math.BigDecimal">
SELECT SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex CEILING(avg( a.avgHealthIndex )) AS healthIndex
...@@ -75,7 +71,6 @@ ...@@ -75,7 +71,6 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
...@@ -84,11 +79,9 @@ ...@@ -84,11 +79,9 @@
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
UNION ALL UNION ALL
( (
...@@ -124,7 +117,6 @@ ...@@ -124,7 +117,6 @@
) )
) a ) a
</select> </select>
<select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByStation" resultType="java.math.BigDecimal">
SELECT SELECT
CEILING(IFNULL( HEALTH_INDEX , 100 )) AS healthIndex CEILING(IFNULL( HEALTH_INDEX , 100 )) AS healthIndex
...@@ -140,9 +132,6 @@ ...@@ -140,9 +132,6 @@
</where> </where>
limit 1 limit 1
</select> </select>
<select id="getHealthListInfo" resultType="java.util.Map"> <select id="getHealthListInfo" resultType="java.util.Map">
SELECT SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex, CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
...@@ -204,7 +193,6 @@ ...@@ -204,7 +193,6 @@
GROUP BY GROUP BY
a.date a.date
</select> </select>
<select id="getAllEquipAlarmInfo" resultType="java.util.Map"> <select id="getAllEquipAlarmInfo" resultType="java.util.Map">
SELECT ARAE as area, SELECT ARAE as area,
WARNING_NAME as warningName, WARNING_NAME as warningName,
...@@ -215,7 +203,6 @@ ...@@ -215,7 +203,6 @@
group by ARAE, group by ARAE,
WARNING_NAME WARNING_NAME
</select> </select>
<select id="getHealthInfoByArea" resultType="java.util.Map"> <select id="getHealthInfoByArea" resultType="java.util.Map">
SELECT ARAE as area, SELECT ARAE as area,
CEILING(avg(a.avgHealthIndex)) AS healthIndex CEILING(avg(a.avgHealthIndex)) AS healthIndex
...@@ -240,7 +227,6 @@ ...@@ -240,7 +227,6 @@
) a ) a
GROUP BY a.ARAE GROUP BY a.ARAE
</select> </select>
<select id="getAllEquipAlarmInfoByStation" resultType="java.util.Map"> <select id="getAllEquipAlarmInfoByStation" resultType="java.util.Map">
SELECT a.* SELECT a.*
FROM ( FROM (
...@@ -278,8 +264,6 @@ ...@@ -278,8 +264,6 @@
) a ) a
ORDER BY a.allNum ASC ORDER BY a.allNum ASC
</select> </select>
<select id="getHealthInfoByStation" resultType="java.util.Map"> <select id="getHealthInfoByStation" resultType="java.util.Map">
SELECT SELECT
a.STATION as station, a.STATION as station,
...@@ -322,7 +306,6 @@ ...@@ -322,7 +306,6 @@
GROUP BY GROUP BY
a.STATION a.STATION
</select> </select>
<select id="equipWarningRadarMap" resultType="java.util.Map"> <select id="equipWarningRadarMap" resultType="java.util.Map">
SELECT SELECT
a.warningName, a.warningName,
...@@ -356,7 +339,6 @@ ...@@ -356,7 +339,6 @@
GROUP BY GROUP BY
a.warningName a.warningName
</select> </select>
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map"> <select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map">
SELECT SELECT
concat(#{stationType}, '-', a.POINT_NAME) as pointName, concat(#{stationType}, '-', a.POINT_NAME) as pointName,
...@@ -387,7 +369,6 @@ ...@@ -387,7 +369,6 @@
AND pointName != '' AND pointName != ''
order by totalNum asc order by totalNum asc
</select> </select>
<select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map"> <select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map">
SELECT SELECT
a.* a.*
...@@ -406,7 +387,6 @@ ...@@ -406,7 +387,6 @@
and ARAE like concat('%', #{areaCode}, '%') and ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
) AS allNum ) AS allNum
FROM FROM
idx_biz_pv_warning_record wr idx_biz_pv_warning_record wr
...@@ -433,7 +413,6 @@ ...@@ -433,7 +413,6 @@
and ARAE like concat('%', #{areaCode}, '%') and ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
) AS allNum ) AS allNum
FROM FROM
idx_biz_fan_warning_record wr idx_biz_fan_warning_record wr
...@@ -453,7 +432,6 @@ ...@@ -453,7 +432,6 @@
AND a.pointName != '' AND a.pointName != ''
order by a.allNum ASC order by a.allNum ASC
</select> </select>
<select id="getSubSystemInfo" resultType="java.util.Map"> <select id="getSubSystemInfo" resultType="java.util.Map">
SELECT SELECT
CEILING(IFNULL( HEALTH_INDEX, 100 )) AS healthIndex, CEILING(IFNULL( HEALTH_INDEX, 100 )) AS healthIndex,
...@@ -472,9 +450,7 @@ ...@@ -472,9 +450,7 @@
</if> </if>
</where> </where>
group by subSystem group by subSystem
</select> </select>
<select id="getFanInfoByPage" resultType="java.util.Map"> <select id="getFanInfoByPage" resultType="java.util.Map">
SELECT SELECT
EQUIPMENT_NAME as equipmentName, EQUIPMENT_NAME as equipmentName,
...@@ -493,7 +469,6 @@ ...@@ -493,7 +469,6 @@
ORDER BY ORDER BY
RIGHT(EQUIPMENT_NAME, 6) ASC RIGHT(EQUIPMENT_NAME, 6) ASC
</select> </select>
<select id="getFanHealthInfoList" resultType="java.util.Map"> <select id="getFanHealthInfoList" resultType="java.util.Map">
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex,
...@@ -511,7 +486,6 @@ ...@@ -511,7 +486,6 @@
GROUP BY GROUP BY
EQUIPMENT_NAME EQUIPMENT_NAME
</select> </select>
<select id="getSumSystemListByEquipment" resultType="java.util.Map"> <select id="getSumSystemListByEquipment" resultType="java.util.Map">
SELECT SELECT
SUB_SYSTEM as subSystem, SUB_SYSTEM as subSystem,
...@@ -530,7 +504,6 @@ ...@@ -530,7 +504,6 @@
GROUP BY GROUP BY
SUB_SYSTEM SUB_SYSTEM
</select> </select>
<select id="getPointNameListBySumSystem" resultType="java.util.Map"> <select id="getPointNameListBySumSystem" resultType="java.util.Map">
SELECT SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
...@@ -549,7 +522,6 @@ ...@@ -549,7 +522,6 @@
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getHealthInfoBySubSystem" resultType="java.util.Map"> <select id="getHealthInfoBySubSystem" resultType="java.util.Map">
SELECT SELECT
IFNULL( avg( HEALTH_INDEX ), 100 ) AS healthIndex, IFNULL( avg( HEALTH_INDEX ), 100 ) AS healthIndex,
...@@ -572,8 +544,6 @@ ...@@ -572,8 +544,6 @@
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getWarningInfoBySubSystem" resultType="java.util.Map"> <select id="getWarningInfoBySubSystem" resultType="java.util.Map">
SELECT SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
...@@ -594,8 +564,6 @@ ...@@ -594,8 +564,6 @@
ORDER BY ORDER BY
WARNING_NAME ASC WARNING_NAME ASC
</select> </select>
<select id="getPvInfoByPage" resultType="java.util.Map"> <select id="getPvInfoByPage" resultType="java.util.Map">
SELECT SELECT
SUBARRAY as subarray, SUBARRAY as subarray,
...@@ -612,7 +580,6 @@ ...@@ -612,7 +580,6 @@
ORDER BY ORDER BY
SUBARRAY SUBARRAY
</select> </select>
<select id="getPvHealthInfoList" resultType="java.util.Map"> <select id="getPvHealthInfoList" resultType="java.util.Map">
SELECT SELECT
IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex, IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex,
...@@ -630,7 +597,6 @@ ...@@ -630,7 +597,6 @@
GROUP BY SUBARRAY GROUP BY SUBARRAY
order by SUBARRAY order by SUBARRAY
</select> </select>
<select id="getPvSubSystemInfo" resultType="java.util.Map"> <select id="getPvSubSystemInfo" resultType="java.util.Map">
SELECT SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex, CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
...@@ -650,8 +616,6 @@ ...@@ -650,8 +616,6 @@
</where> </where>
group by EQUIPMENT_NAME group by EQUIPMENT_NAME
</select> </select>
<select id="getPvSumSystemListByEquipment" resultType="java.util.Map"> <select id="getPvSumSystemListByEquipment" resultType="java.util.Map">
SELECT SELECT
EQUIPMENT_NAME as equipmentName EQUIPMENT_NAME as equipmentName
...@@ -670,10 +634,7 @@ ...@@ -670,10 +634,7 @@
GROUP BY GROUP BY
EQUIPMENT_NAME EQUIPMENT_NAME
</select> </select>
<select id="getPvHealthInfoBySubSystem" resultType="java.util.Map"> <select id="getPvHealthInfoBySubSystem" resultType="java.util.Map">
SELECT SELECT
IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex, IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex,
POINT_NAME AS pointName POINT_NAME AS pointName
...@@ -695,7 +656,6 @@ ...@@ -695,7 +656,6 @@
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getPvWarningInfoBySubSystem" resultType="java.util.Map"> <select id="getPvWarningInfoBySubSystem" resultType="java.util.Map">
SELECT SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
...@@ -716,8 +676,6 @@ ...@@ -716,8 +676,6 @@
ORDER BY ORDER BY
WARNING_NAME ASC WARNING_NAME ASC
</select> </select>
<select id="getPvPointNameListBySumSystem" resultType="java.util.Map"> <select id="getPvPointNameListBySumSystem" resultType="java.util.Map">
SELECT SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
...@@ -736,7 +694,6 @@ ...@@ -736,7 +694,6 @@
GROUP BY GROUP BY
POINT_NAME POINT_NAME
</select> </select>
<select id="getPointNameByIndexAddress" resultType="java.lang.String"> <select id="getPointNameByIndexAddress" resultType="java.lang.String">
select POINT_NAME select POINT_NAME
from ${tableName} from ${tableName}
...@@ -746,7 +703,6 @@ ...@@ -746,7 +703,6 @@
</select> </select>
<select id="getFullViewRecall" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO"> <select id="getFullViewRecall" resultType="com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO">
SELECT a.*, SELECT a.*,
row_number() over ( ORDER BY pointName ) AS id row_number() over ( ORDER BY pointName ) AS id
...@@ -787,7 +743,6 @@ ...@@ -787,7 +743,6 @@
) a ) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
</select> </select>
<select id="getStationIndexInfo" resultType="java.util.Map"> <select id="getStationIndexInfo" resultType="java.util.Map">
SELECT a.STATION AS station, SELECT a.STATION AS station,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
...@@ -812,7 +767,6 @@ ...@@ -812,7 +767,6 @@
) a ) a
GROUP BY a.STATION GROUP BY a.STATION
</select> </select>
<select id="getEquipmentIndexInfo" resultType="java.util.Map"> <select id="getEquipmentIndexInfo" resultType="java.util.Map">
SELECT a.equipmentName AS equipmentName, SELECT a.equipmentName AS equipmentName,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
...@@ -840,7 +794,6 @@ ...@@ -840,7 +794,6 @@
GROUP BY GROUP BY
a.equipmentName a.equipmentName
</select> </select>
<select id="getSubSystemIndexInfo" resultType="java.util.Map"> <select id="getSubSystemIndexInfo" resultType="java.util.Map">
SELECT a.subSystem AS subSystem, SELECT a.subSystem AS subSystem,
...@@ -870,7 +823,6 @@ ...@@ -870,7 +823,6 @@
a.subSystem a.subSystem
</select> </select>
<select id="getPointNameIndexInfo" resultType="java.util.Map"> <select id="getPointNameIndexInfo" resultType="java.util.Map">
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex, SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
...@@ -891,7 +843,6 @@ ...@@ -891,7 +843,6 @@
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
) )
</select> </select>
<select id="getHealthLevelInfoList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel"> <select id="getHealthLevelInfoList" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel">
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType, SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel, HEALTH_LEVEL AS healthLevel,
...@@ -909,14 +860,12 @@ ...@@ -909,14 +860,12 @@
WHERE STATUS IS NOT NULL WHERE STATUS IS NOT NULL
OR STATUS != '' OR STATUS != ''
</select> </select>
<select id="getAddressInfo" resultType="java.lang.String"> <select id="getAddressInfo" resultType="java.lang.String">
select index_address select index_address
from wl_equipment_specific_index from wl_equipment_specific_index
where gateway_id = '1668801435891929089' where gateway_id = '1668801435891929089'
and data_type = 'analog' limit 100 and data_type = 'analog' limit 100
</select> </select>
<select id="queryForLeftTableList" resultType="map"> <select id="queryForLeftTableList" resultType="map">
SELECT SELECT
b.*, b.*,
...@@ -958,7 +907,6 @@ ...@@ -958,7 +907,6 @@
order by HEALTH_INDEX ASC order by HEALTH_INDEX ASC
limit ${current},${size} limit ${current},${size}
</select> </select>
<select id="queryForLeftTableListCount" resultType="int"> <select id="queryForLeftTableListCount" resultType="int">
SELECT SELECT
count(1) count(1)
...@@ -991,7 +939,6 @@ ...@@ -991,7 +939,6 @@
</if> </if>
</where> </where>
</select> </select>
<select id="queryForLeftTableListNum" resultType="map"> <select id="queryForLeftTableListNum" resultType="map">
SELECT SELECT
...@@ -1025,8 +972,6 @@ ...@@ -1025,8 +972,6 @@
</if> </if>
</where> </where>
</select> </select>
<select id="queryForLeftTableListByPoint" resultType="map"> <select id="queryForLeftTableListByPoint" resultType="map">
SELECT SELECT
b.* b.*
...@@ -1073,8 +1018,6 @@ ...@@ -1073,8 +1018,6 @@
order by b.HEALTH_INDEX ASC order by b.HEALTH_INDEX ASC
limit ${current},${size} limit ${current},${size}
</select> </select>
<select id="queryForLeftTableListByPointCount" resultType="int"> <select id="queryForLeftTableListByPointCount" resultType="int">
SELECT SELECT
count(1) count(1)
...@@ -1119,8 +1062,6 @@ ...@@ -1119,8 +1062,6 @@
</if> </if>
</where> </where>
</select> </select>
<select id="queryForLeftTableListByPointNum" resultType="map"> <select id="queryForLeftTableListByPointNum" resultType="map">
SELECT SELECT
b.HEALTH_INDEX as value b.HEALTH_INDEX as value
...@@ -1165,7 +1106,6 @@ ...@@ -1165,7 +1106,6 @@
</if> </if>
</where> </where>
</select> </select>
<select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord"> <select id="warningData" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord">
SELECT SELECT
* *
...@@ -1182,8 +1122,7 @@ ...@@ -1182,8 +1122,7 @@
<if test="STATION != null and STATION != '' "> <if test="STATION != null and STATION != '' ">
AND re.STATION = #{STATION} AND re.STATION = #{STATION}
</if> </if>
</select> </select>
<select id="pointNum" resultType="int"> <select id="pointNum" resultType="int">
SELECT SELECT
count(1) count(1)
...@@ -1201,8 +1140,6 @@ ...@@ -1201,8 +1140,6 @@
AND cl.STATION = #{STATION} AND cl.STATION = #{STATION}
</if> </if>
</select> </select>
<select id="selectPointByANALYSISTYPE" resultType="map"> <select id="selectPointByANALYSISTYPE" resultType="map">
SELECT SELECT
b.* b.*
...@@ -1254,9 +1191,7 @@ ...@@ -1254,9 +1191,7 @@
AND b.POINT_NAME = #{POINTNAME} AND b.POINT_NAME = #{POINTNAME}
</if> </if>
</where> </where>
</select> </select>
<select id="getFanEquipStatusByStation" resultType="map"> <select id="getFanEquipStatusByStation" resultType="map">
SELECT SELECT
max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全, max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全,
...@@ -1283,7 +1218,6 @@ ...@@ -1283,7 +1218,6 @@
HEALTH_LEVEL HEALTH_LEVEL
) a ) a
</select> </select>
<select id="getPvEquipStatusByStation" resultType="java.util.Map"> <select id="getPvEquipStatusByStation" resultType="java.util.Map">
SELECT SELECT
max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全, max( CASE WHEN a.HEALTH_LEVEL = '安全' THEN num ELSE 0 END ) AS 安全,
...@@ -1309,9 +1243,7 @@ ...@@ -1309,9 +1243,7 @@
STATION, STATION,
HEALTH_LEVEL HEALTH_LEVEL
) a ) a
</select> </select>
<select id="getRecDateByIndexAddress" resultType="java.lang.String"> <select id="getRecDateByIndexAddress" resultType="java.lang.String">
SELECT SELECT
a.REC_DATE a.REC_DATE
...@@ -1341,7 +1273,6 @@ ...@@ -1341,7 +1273,6 @@
LIMIT 1 LIMIT 1
) a ) a
</select> </select>
<select id="getInfoListByTableName" resultType="java.util.Map"> <select id="getInfoListByTableName" resultType="java.util.Map">
SELECT SELECT
*, *,
...@@ -1355,14 +1286,12 @@ ...@@ -1355,14 +1286,12 @@
AND INDEX_ADDRESS = #{indexAddress} AND INDEX_ADDRESS = #{indexAddress}
AND GATEWAY_ID = #{fanGatewayId} AND GATEWAY_ID = #{fanGatewayId}
</select> </select>
<select id="getIsWarningByPointId" resultType="int"> <select id="getIsWarningByPointId" resultType="int">
select count(1) from ${tableName} select count(1) from ${tableName}
where INDEX_ADDRESS = #{indexAddress} where INDEX_ADDRESS = #{indexAddress}
AND GATEWAY_ID = #{fanGatewayId} AND GATEWAY_ID = #{fanGatewayId}
and DISPOSOTION_STATE = '未处置' and DISPOSOTION_STATE = '未处置'
</select> </select>
<select id="getStationIndexInfoByParam" resultType="java.util.Map"> <select id="getStationIndexInfoByParam" resultType="java.util.Map">
SELECT a.STATION AS station, SELECT a.STATION AS station,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
...@@ -1411,7 +1340,6 @@ ...@@ -1411,7 +1340,6 @@
) a ) a
GROUP BY a.STATION GROUP BY a.STATION
</select> </select>
<select id="getEquipmentIndexInfoByParam" resultType="java.util.Map"> <select id="getEquipmentIndexInfoByParam" resultType="java.util.Map">
SELECT a.equipmentName AS equipmentName, SELECT a.equipmentName AS equipmentName,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
...@@ -1419,7 +1347,6 @@ ...@@ -1419,7 +1347,6 @@
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName EQUIPMENT_NAME AS equipmentName
FROM fan_health_index_latest_data FROM fan_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '设备' ANALYSIS_OBJ_TYPE = '设备'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
...@@ -1441,7 +1368,6 @@ ...@@ -1441,7 +1368,6 @@
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex, SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUBARRAY AS equipmentName SUBARRAY AS equipmentName
FROM pv_health_index_latest_data FROM pv_health_index_latest_data
<where> <where>
ANALYSIS_OBJ_TYPE = '子阵' ANALYSIS_OBJ_TYPE = '子阵'
<if test="analysisType == '按天' or analysisType == null or analysisType == ''"> <if test="analysisType == '按天' or analysisType == null or analysisType == ''">
...@@ -1465,9 +1391,7 @@ ...@@ -1465,9 +1391,7 @@
GROUP BY GROUP BY
a.equipmentName a.equipmentName
</select> </select>
<select id="getSubSystemIndexInfoByParam" resultType="java.util.Map"> <select id="getSubSystemIndexInfoByParam" resultType="java.util.Map">
SELECT a.subSystem AS subSystem, SELECT a.subSystem AS subSystem,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM ( FROM (
...@@ -1517,11 +1441,8 @@ ...@@ -1517,11 +1441,8 @@
and subSystem != '' and subSystem != ''
GROUP BY GROUP BY
a.subSystem a.subSystem
</select> </select>
<select id="getPointNameIndexInfoByParam" resultType="java.util.Map"> <select id="getPointNameIndexInfoByParam" resultType="java.util.Map">
SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex, SELECT IFNULL(HEALTH_INDEX, 100) AS healthIndex,
concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress concat(STATION, '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM fan_health_index_latest_data FROM fan_health_index_latest_data
...@@ -1540,7 +1461,6 @@ ...@@ -1540,7 +1461,6 @@
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </if>
</where> </where>
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
UNION ALL UNION ALL
( (
...@@ -1565,7 +1485,6 @@ ...@@ -1565,7 +1485,6 @@
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
) )
</select> </select>
<select id="queryIndexByArae" resultType="map"> <select id="queryIndexByArae" resultType="map">
SELECT SELECT
CAST(AVG(b.HEALTH_INDEX) as SIGNED) HEALTHINDEX, CAST(AVG(b.HEALTH_INDEX) as SIGNED) HEALTHINDEX,
...@@ -1580,16 +1499,16 @@ ...@@ -1580,16 +1499,16 @@
FROM FROM
`idx_biz_fan_health_index` `idx_biz_fan_health_index`
<where> <where>
<if test = 'startTimeTop != null and startTimeTop != ""' > <if test='startTimeTop != null and startTimeTop != ""'>
AND REC_DATE >= #{startTimeTop} AND REC_DATE >= #{startTimeTop}
</if> </if>
<if test = 'endTimeTop != null and endTimeTop != ""' > <if test='endTimeTop != null and endTimeTop != ""'>
<![CDATA[ AND REC_DATE <= #{endTimeTop}]]> <![CDATA[ AND REC_DATE <= #{endTimeTop}]]>
</if> </if>
<if test = 'ARAE != null and ARAE != ""' > <if test='ARAE != null and ARAE != ""'>
AND ARAE = #{ARAE} AND ARAE = #{ARAE}
</if> </if>
<if test = 'ANALYSISTYPE != null and ANALYSISTYPE != ""' > <if test='ANALYSISTYPE != null and ANALYSISTYPE != ""'>
AND ANALYSIS_TYPE = #{ANALYSISTYPE} AND ANALYSIS_TYPE = #{ANALYSISTYPE}
</if> </if>
</where> </where>
...@@ -1601,23 +1520,22 @@ ...@@ -1601,23 +1520,22 @@
FROM FROM
`idx_biz_PV_health_index` `idx_biz_PV_health_index`
<where> <where>
<if test = ' startTimeTop != null and startTimeTop != ""' > <if test=' startTimeTop != null and startTimeTop != ""'>
AND REC_DATE >= #{startTimeTop} AND REC_DATE >= #{startTimeTop}
</if> </if>
<if test = 'endTimeTop != null and endTimeTop != ""' > <if test='endTimeTop != null and endTimeTop != ""'>
<![CDATA[ AND REC_DATE <= #{endTimeTop}]]> <![CDATA[ AND REC_DATE <= #{endTimeTop}]]>
</if> </if>
<if test = 'ARAE != null and ARAE != ""' > <if test='ARAE != null and ARAE != ""'>
AND ARAE = #{ARAE} AND ARAE = #{ARAE}
</if> </if>
<if test = 'ANALYSISTYPE != null and ANALYSISTYPE !=""' > <if test='ANALYSISTYPE != null and ANALYSISTYPE !=""'>
AND ANALYSIS_TYPE = #{ANALYSISTYPE} AND ANALYSIS_TYPE = #{ANALYSISTYPE}
</if> </if>
</where> </where>
)b )b
GROUP BY REC_DATE GROUP BY REC_DATE
</select> </select>
<select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal"> <select id="getHealthScoreInfoByLatest" resultType="java.math.BigDecimal">
SELECT SELECT
CEILING(avg( a.avgHealthIndex )) AS healthIndex CEILING(avg( a.avgHealthIndex )) AS healthIndex
...@@ -1638,11 +1556,9 @@ ...@@ -1638,11 +1556,9 @@
AND GATEWAY_ID = #{stationCode} AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站' AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
UNION ALL UNION ALL
( (
...@@ -1668,7 +1584,6 @@ ...@@ -1668,7 +1584,6 @@
) )
) a ) a
</select> </select>
<select id="getDateInfoBy15" resultType="java.util.Map"> <select id="getDateInfoBy15" resultType="java.util.Map">
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date, DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
...@@ -1679,4 +1594,34 @@ ...@@ -1679,4 +1594,34 @@
WHERE WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
</select> </select>
<select id="getDateInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( #{endTime}, DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY )) ) >= @s
</select>
<select id="getHourInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select>
<select id="getMomentInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select>
</mapper> </mapper>
...@@ -334,14 +334,18 @@ ...@@ -334,14 +334,18 @@
group by point_name group by point_name
</select> </select>
<select id="getInfoByDate" resultType="java.lang.String"> <select id="getInfoByDate" resultType="java.util.Map">
select ceil(avg(b.health_index)) as healthIndex from select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT (SELECT
health_index health_index,
rec_date
FROM FROM
pv_health_index_day pv_health_index_day
<where> <where>
rec_date = concat(#{date}, ' 00:00:00') rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area like #{areaCode} AND area like #{areaCode}
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
...@@ -357,12 +361,15 @@ ...@@ -357,12 +361,15 @@
UNION ALL UNION ALL
( (
SELECT SELECT
health_index health_index,
rec_date
FROM FROM
fan_health_index_day fan_health_index_day
<where> <where>
rec_date = concat(#{date}, ' 00:00:00') rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND area like #{areaCode} AND area like #{areaCode}
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
...@@ -375,10 +382,110 @@ ...@@ -375,10 +382,110 @@
AND analysis_obj_type = '片区' AND analysis_obj_type = '片区'
</if> </if>
</where> </where>
)) b )) b GROUP BY b.rec_date
</select>
<select id="getInfoByHour" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index,
rec_date
FROM
pv_health_index_hour
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
UNION ALL
(
SELECT
health_index,
rec_date
FROM
fan_health_index_hour
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
)) b GROUP BY b.rec_date
</select>
<select id="getInfoByMoment" resultType="java.util.Map">
select avg(b.health_index) as healthIndex,b.rec_date AS recDate from
(SELECT
health_index,
rec_date
FROM
pv_health_index_moment
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
UNION ALL
(
SELECT
health_index,
rec_date
FROM
fan_health_index_moment
<where>
rec_date IN
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
<if test="areaCode != null and areaCode != ''">
AND area like #{areaCode}
AND analysis_obj_type = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND gateway_id = #{stationCode}
AND analysis_obj_type = '场站'
</if>
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND analysis_obj_type = '片区'
</if>
</where>
)) b GROUP BY b.rec_date
</select> </select>
<select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex"> <select id="getInfoListByGroupByQgFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
......
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