Commit 5567c659 authored by tangwei's avatar tangwei

解决冲突

parents 1d10d20d 258f14c8
......@@ -30,6 +30,7 @@ import org.typroject.tyboot.core.foundation.context.SpringContextHelper;
import java.io.*;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -69,6 +70,9 @@ public class ClientHandler<path> implements Runnable {
}
private String upload2Maas(InputStream inputStream, String hostAndPort) throws IOException {
InputStream intercept = intercept(inputStream);
AmosRequestContext robotAuthentication = SpringContextHelper.getBean(AmosRequestContext.class);
if (Objects.nonNull(robotAuthentication)) {
String token = robotAuthentication.getToken();
......@@ -93,16 +97,16 @@ public class ClientHandler<path> implements Runnable {
}
};
params.add("file", resource);
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, getHeader(token,product,appKey,hostAndPort,true));
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, getHeader(token, product, appKey, hostAndPort, true));
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.exchange(uploadUrl, HttpMethod.POST, requestEntity, String.class);
String body = responseEntity.getBody();
JSONObject jsonObject = JSONObject.parseObject(body);
String result = jsonObject.getString("result");
String path = jsonObject.getString("path");
if (jsonObject.getString("status").equals("200")){
log.info("路径:"+path+"/"+result);
}else {
if (jsonObject.getString("status").equals("200")) {
log.info("路径:" + path + "/" + result);
} else {
throw new RuntimeException("返回状态码错误");
}
......@@ -152,14 +156,14 @@ public class ClientHandler<path> implements Runnable {
return null;
}
private HttpHeaders getHeader(String token,String product,String appKey,String hostAndPort,Boolean isUpload){
private HttpHeaders getHeader(String token, String product, String appKey, String hostAndPort, Boolean isUpload) {
HttpHeaders header = new HttpHeaders();
header.add(Constant.TOKEN, token);
header.add(Constant.PRODUCT, product);
header.add(Constant.APPKEY, appKey);
if (isUpload){
if (isUpload) {
header.setContentType(MediaType.MULTIPART_FORM_DATA);
}else {
} else {
header.setContentType(MediaType.APPLICATION_JSON);
}
return header;
......@@ -169,6 +173,58 @@ public class ClientHandler<path> implements Runnable {
requestInfoToSocketServer();
}
//截取文件流
public static InputStream intercept(InputStream is) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "/n");
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
String string1 = sb.toString();
int startFilePath = string1.indexOf("##STATITLE##");
int endFilePath = string1.indexOf("##ENDTITLE##");
int startFile = string1.indexOf("##STAFILE##");
int endFile = string1.indexOf("##ENDFILE##");
if (startFilePath < 0) {
log.info("不存在文件名开始标志");
return null;
}
if (endFilePath < 0) {
log.info("不存在文件名结束标志");
return null;
}
if (startFile < 0) {
log.info("不存在文件开始标志");
return null;
}
if (endFile < 0) {
log.info("不存在文件结束标志");
return null;
}
String filePath = string1.substring(startFilePath, endFilePath).substring("##STATITLE##".length());
log.info("文件名:" + filePath);
String file = string1.substring(startFile, endFile).substring("##STAFILE##".length());
log.info("文件:" + file);
InputStream fileInputStream = new ByteArrayInputStream(file.getBytes());
return fileInputStream;
}
private static void requestInfoToSocketServer() {
try {
Socket socket = new Socket("127.0.0.1", 7777);
......
package com.yeejoin.amos.boot.module.cas.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.cas.api.entity.IdxBizXnzs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Value;
import java.util.List;
import java.sql.*;
import java.util.*;
public interface IdxBizSyncService extends IService<IdxBizXnzs> {
// 多个查询(分页)
List selectAllPageQuery(String tableName, Map params, int current, int size);
String getSql(String tableName, Map params, int current, int size);
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.cas.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.cas.api.service.IdxBizSyncService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/idx-biz-sync", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class IdxBizSyncController {
@Autowired
private IdxBizSyncService idxBizSyncService;
@TycloudOperation(ApiLevel = UserType.AGENCY ,needAuth = false)
@RequestMapping(value = "/page/{tableName}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
@ResponseBody
public List listPage(@PathVariable String tableName,
@RequestParam(value = "current",defaultValue = "1") int current,
@RequestParam(value = "size",defaultValue = "10") int size,
@RequestBody Map params) throws Exception{
List list = idxBizSyncService.selectAllPageQuery(tableName, params, current, size);
return list;
}
}
package com.yeejoin.amos.boot.module.cas.service.impl;
import com.yeejoin.amos.boot.module.cas.api.dto.IdxBizXnzsDto;
import com.yeejoin.amos.boot.module.cas.api.entity.IdxBizXnzs;
import com.yeejoin.amos.boot.module.cas.api.mapper.IdxBizXnzsMapper;
import com.yeejoin.amos.boot.module.cas.api.service.IIdxBizXnzsService;
import com.yeejoin.amos.boot.module.cas.api.service.IdxBizSyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service
public class IdxBizSyncServiceImpl extends BaseService<IdxBizXnzsDto, IdxBizXnzs, IdxBizXnzsMapper> implements IdxBizSyncService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List selectAllPageQuery(String tableName, Map params, int current, int size) {
List<Map<String, Object>> list = jdbcTemplate.queryForList(getSql(tableName, params, current, size));
return list;
}
@Override
public String getSql(String tableName, Map params, int current, int size) {
String sql = "select * from " + tableName;
sql += " where ";
Iterator<Map.Entry<String, Object>> it = params.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
sql = sql + entry.getKey() + " = " + "'" + entry.getValue() + "'" + " AND ";
}
sql += "1 = 1 ";
sql += " limit " + (current - 1) * size + "," + size;
return sql;
}
}
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.10.210:3306/amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://39.98.45.134:3306/amos_idx?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8&useSSL=false&autoReconnect=true&zeroDateTimeBehavior=CONVERT_TO_NULL
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
......
......@@ -58,7 +58,7 @@ public class AmosJxiopAnalyseApplication {
@Autowired
private EmqKeeper emqKeeper;
//本地是否执行健康指数算法开关
@Value("${openHealth:true}")
@Value("${openHealth:false}")
Boolean openHealth;
@Autowired
private SyncESDataToTdengineMqttListener syncESDataToTdengineMqttListener;
......@@ -79,7 +79,7 @@ public class AmosJxiopAnalyseApplication {
@Bean
public void initMqtt() throws Exception {
if (!openHealth) {
if (openHealth) {
//订阅固化周期性数据成功的消息
emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener);
}
......
......@@ -112,6 +112,14 @@ public class CommonConstans {
}
};
public static final HashMap<String, String> waringPeriodTowaringCycle = new HashMap<String, String>() {
{
put("按时刻", "分钟");
put("按小时", "小时");
put("按天", "天");
}
};
public static final HashMap<String, String> waringPeriodDateFormate = new HashMap<String, String>() {
{
......
......@@ -16,10 +16,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -162,20 +159,20 @@ public class KafkaAnalyseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "全景诊断回溯")
@GetMapping("/getFullViewRecall")
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall() {
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(@RequestParam(required = false, value = "analysisType") String analysisType) {
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType);
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.getEquipmentIndexInfoByParam(analysisType);
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.getSubSystemIndexInfoByParam(analysisType);
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.getPointNameIndexInfoByParam(analysisType);
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
......@@ -193,7 +190,7 @@ public class KafkaAnalyseController {
int stationInt = 1;
int equipmentInt = 1;
int subSystemInt = 1;
Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(null, null).doubleValue();
Double healthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(null, null, analysisType).doubleValue();
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
......@@ -211,14 +208,14 @@ public class KafkaAnalyseController {
allMapDto.setScore(healthScoreInfo);
allMapDto.setIsRoot(true);
allMapDto.setCategory("category");
allMapDto.setChildList(new ArrayList<>());
allMapDto.setChildren(new ArrayList<>());
allMapDto.setParentKey("0");
for (Map.Entry<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> areaMap : resultMap.entrySet()) {
Double areaLowScore = null;
Double areaHighScore = null;
Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfo(areaMap.getKey(), null).doubleValue();
Double areaHealthScoreInfo = idxBizFanHealthIndexMapper.getHealthScoreInfoByParam(areaMap.getKey(), null, analysisType).doubleValue();
LambdaQueryWrapper<IdxBizFanHealthLevel> areaQuery = new LambdaQueryWrapper<>();
areaQuery.isNull(IdxBizFanHealthLevel::getStatus);
......@@ -233,7 +230,7 @@ public class KafkaAnalyseController {
areaMapDto.setStatus(areaIdxBizFanHealthLevel.getHealthLevel());
areaMapDto.setScore(areaHealthScoreInfo);
areaMapDto.setParentKey(allMapDto.getKey());
allMapDto.getChildList().add(areaMapDto);
allMapDto.getChildren().add(areaMapDto);
areaInt++;
List<FullViewRecallInfoDTO> areaMapList = new ArrayList<>();
for (Map.Entry<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>> stationMap : areaMap.getValue().entrySet()) {
......@@ -276,7 +273,7 @@ public class KafkaAnalyseController {
}
}
stationDto.setParentKey(areaMapDto.getKey());
areaMapDto.getChildList().add(stationDto);
areaMapDto.getChildren().add(stationDto);
stationInt++;
for (Map.Entry<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>> equipmentMap : stationMap.getValue().entrySet()) {
......@@ -301,7 +298,7 @@ public class KafkaAnalyseController {
equipmentMapDto.setStatus(levelInfo.getHealthLevel());
equipmentMapDto.setScore(equipmentIndexInfoMap.getOrDefault(equipmentMap.getKey(), 100.0));
equipmentMapDto.setParentKey(stationDto.getKey());
stationDto.getChildList().add(equipmentMapDto);
stationDto.getChildren().add(equipmentMapDto);
equipmentInt++;
for (Map.Entry<String, Map<String, List<FullViewRecallDataDTO>>> subSystemMap : equipmentMap.getValue().entrySet()) {
FullViewRecallInfoDTO subSystemMapDto = new FullViewRecallInfoDTO();
......@@ -315,7 +312,7 @@ public class KafkaAnalyseController {
subSystemMapDto.setScore(subSystemIndexInfoMap.getOrDefault(subSystemMap.getKey(), 100.0));
subSystemMapDto.setParentKey(equipmentMapDto.getKey());
equipmentMapDto.getChildList().add(subSystemMapDto);
equipmentMapDto.getChildren().add(subSystemMapDto);
subSystemInt++;
for (Map.Entry<String, List<FullViewRecallDataDTO>> pointNameMap : subSystemMap.getValue().entrySet()) {
FullViewRecallInfoDTO pointNameMapDto = new FullViewRecallInfoDTO();
......@@ -331,7 +328,7 @@ public class KafkaAnalyseController {
pointNameMapDto.setScore(pointNameIndexInfoMap.getOrDefault(fullViewRecallDataDTO.getStation() + "_" + fullViewRecallDataDTO.getIndexAddress(), 100.0));
pointNameMapDto.setParentKey(subSystemMapDto.getKey());
subSystemMapDto.getChildList().add(pointNameMapDto);
subSystemMapDto.getChildren().add(pointNameMapDto);
pointNameInt++;
}
......@@ -355,8 +352,9 @@ public class KafkaAnalyseController {
String stationType = "风电站";
List<IdxBizFanHealthLevel> collect = healthLevelInfoList.stream().filter(item -> item.getAnalysisObjType().contains(station)).collect(Collectors.toList());
for (IdxBizFanHealthLevel item : collect) {
if (!item.getAnalysisObjType().contains("子系统")) {
if (item.getAnalysisObjType().contains("子阵")) {
stationType = "光伏站";
break;
}
}
for (IdxBizFanHealthLevel item : collect) {
......
......@@ -13,11 +13,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
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 java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
......@@ -46,11 +48,11 @@ public class TestController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test2", notes = "test1")
@GetMapping("/test2")
public void test2 () {
public void test2 (@RequestParam(value = "startTime") String startTime, @Param("recDate") String recDate) {
// List<FanHealthIndex> infoListByGroupByCD = fanHealthIndexMapper.getInfoListByGroupByCdFan(startTime, recDate);
// commonService.healthWarningMinuteByFJ();
commonService.healthWarningMinuteByFan();
// commonService.healthWarningMinuteByPv();
// return infoListByGroupByCD;
}
@Autowired
......@@ -64,7 +66,6 @@ public class TestController extends BaseController {
@PostMapping("/saveTest")
public void saveTest () {
tdengineTimeService.insertHourData();
// QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>();
// List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper);
//
......
......@@ -15,6 +15,6 @@ public class FullViewRecallInfoDTO {
private String status = "";
private Boolean isRoot = false;
private String category = "";
private List<FullViewRecallInfoDTO> childList = new ArrayList<>();
private List<FullViewRecallInfoDTO> children = new ArrayList<>();
private String parentKey;
}
......@@ -25,6 +25,8 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
BigDecimal getHealthScoreInfoByStation(@Param("stationCode") String stationCode, @Param("tableName") String tableName);
BigDecimal getHealthScoreInfoByParam(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode, @Param("analysisType") String analysisType);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, @Param("stationCode") String stationCode);
......@@ -99,6 +101,15 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPointNameIndexInfo();
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType);
List<IdxBizFanHealthLevel> getHealthLevelInfoList();
......@@ -132,4 +143,6 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
@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,String endTimeTop);
}
......@@ -119,6 +119,7 @@ public class HealthStatusIndicatorServiceImpl {
if (!openHealth){
return;
}
log.info("光伏---------------------预警时间----"+time);
// Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......@@ -555,6 +556,7 @@ public class HealthStatusIndicatorServiceImpl {
return;
}
// Calendar calendar = Calendar.getInstance();
log.info("风机---------------------预警时间----"+time);
calendar.set(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY)-1);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
......
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='indexAddress!= null'> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null'>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("equipmentName")String equipmentName,@Param("subSystem")String subSystem,@Param("analysisType")String analysisType,@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("pointName")String pointName, @Param("indexAddress")String indexAddress,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexHour;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='indexAddress!= null'> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null'>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
......@@ -3,11 +3,63 @@ package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_data WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='indexAddress!= null'> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null'>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
/**
* 测点
*
* @return
*/
List<FanHealthIndex> getInfoListByGroupByCdFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
/**
* 子系统
*/
List<FanHealthIndex> getInfoListByGroupByZxtFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
/**
* 设备
*/
List<FanHealthIndex> getInfoListByGroupBySbFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
/**
* 场站
*/
List<FanHealthIndex> getInfoListByGroupByCzFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
/**
* 区域
*/
List<FanHealthIndex> getInfoListByGroupByQyFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexMoment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMoment> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time AS analysisTime, station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status FROM analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='indexAddress!= null'> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null'>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndexDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_day WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
"<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null '>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<PvHealthIndexDay> selectData(@Param("station")String station,@Param("analysisType")String analysisType,@Param("indexAddress")String indexAddress,@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("analysisObjType")String analysisObjType, @Param("subarray")String subarray, @Param("pointName")String pointName,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("equipmentName")String equipmentName);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndexHour;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_hour WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
"<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null '>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
......@@ -3,13 +3,49 @@ package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_data WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
"<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null '>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
List<PvHealthIndex> getInfoListByGroupByCdPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoListByGroupBySbPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoListByGroupByZzPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoListByGroupByCzPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoListByGroupByQyPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndexMoment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> {
@Select("<script>"+
"SELECT `health_index` AS healthIndex, created_time AS createdTime, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" +
"FROM analysis_data.pv_health_index_moment WHERE and analysis_obj_type = #{analysisObjType} and analysis_type = #{analysisType}" +
"<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " +
"<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null '>AND point_name = #{pointName} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord;
public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdengine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "", autoResultMap = true)
public class FanWarningRecord {
private Long ts;
private String recDate;
private String disposotionState;
private String healthIndex;
private String analysisPointId;
private String warningName;
private String arae;
private String station;
private String subSystem;
private String number;
private String gatewayId;
private String indexAddress;
private String equipmentName;
private String content;
private String pointName;
private String healthLevel;
private String disposotionDate;
private String kks;
private String warningPeriod;
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdengine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value = "", autoResultMap = true)
public class PvWarningRecord {
private Long ts;
private String recDate;
private String disposotionState;
private String healthIndexSeq;
private String analysisPointId;
private String warningName;
private String arae;
private String station;
private String subarray;
private String manufacturer;
private String deviceType;
private String gatewayId;
private String indexAddress;
private String equipmentName;
private String content;
private String pointName;
private String healthLevel;
private String disposotionDate;
private String kks;
private String warningPeriod;
}
......@@ -4,12 +4,12 @@
<insert id="saveBatchHealthIndexList">
insert into
<foreach collection="list" separator="," item="item" index="index">
${tableName}
using fan_health_index_data TAGS (#{item.analysisType})
using fan_health_index_data TAGS ('按时刻')
values
<foreach collection="list" separator="," item="item" index="index">
(
now + #{index}a,
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
......@@ -32,4 +32,124 @@
)
</foreach>
</insert>
<select id="getInfoListByGroupByCdFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
select
index_address,
gateway_id ,
station,
analysis_obj_type,
analysis_obj_seq,
weight,
area,
sub_system,
number,
equipment_name,
avg(anomaly) as anomaly,
point_name,
kks,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
index_address,
station,
analysis_obj_type,
analysis_obj_seq,
weight,
area,
sub_system,
number,
equipment_name,
point_name,
kks
</select>
<select id="getInfoListByGroupByZxtFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
select
gateway_id ,
station,
'子系统' as analysis_obj_type,
area,
sub_system,
equipment_name,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
station,
analysis_obj_type,
area,
sub_system,
equipment_name
</select>
<select id="getInfoListByGroupBySbFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
select
gateway_id ,
station,
'设备' as analysis_obj_type,
area,
number,
equipment_name,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
station,
analysis_obj_type,
area,
number,
equipment_name
</select>
<select id="getInfoListByGroupByCzFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
select
gateway_id,
station,
'场站' as analysis_obj_type,
area,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
station,
analysis_obj_type,
area
</select>
<select id="getInfoListByGroupByQyFan" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
select
'片区' as analysis_obj_type,
area,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
analysis_obj_type,
area
</select>
</mapper>
<?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">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper">
</mapper>
......@@ -2,12 +2,45 @@
<!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.tdMapper2.PvHealthIndexMapper">
<insert id="saveBatchHealthIndexList">
insert into
<foreach collection="list" separator="," item="item" index="index">
${tableName}
using pv_health_index_data TAGS (#{item.analysisType})
<!--<insert id="saveBatchHealthIndexList">-->
<!-- insert into-->
<!-- <foreach collection="list" separator=" " item="item" index="index">-->
<!-- ${tableName}-->
<!-- using pv_health_index_data TAGS (#{item.analysisType})-->
<!-- values-->
<!-- (-->
<!-- now,-->
<!-- #{item.recDate, jdbcType=VARCHAR},-->
<!-- #{item.analysisObjType, jdbcType=VARCHAR},-->
<!-- #{item.analysisObjSeq, jdbcType=VARCHAR},-->
<!-- #{item.weight, jdbcType=FLOAT},-->
<!-- #{item.healthIndex, jdbcType=FLOAT},-->
<!-- #{item.healthLevel, jdbcType=VARCHAR},-->
<!-- #{item.analysisStartTime, jdbcType=VARCHAR},-->
<!-- #{item.analysisEndTime, jdbcType=VARCHAR},-->
<!-- #{item.area, jdbcType=VARCHAR},-->
<!-- #{item.station, jdbcType=VARCHAR},-->
<!-- #{item.subarray, jdbcType=VARCHAR},-->
<!-- #{item.manufacturer, jdbcType=VARCHAR},-->
<!-- #{item.deviceType, jdbcType=VARCHAR},-->
<!-- #{item.equipmentName, jdbcType=VARCHAR},-->
<!-- #{item.gatewayId, jdbcType=VARCHAR},-->
<!-- #{item.indexAddress, jdbcType=VARCHAR},-->
<!-- #{item.anomaly, jdbcType=FLOAT},-->
<!-- #{item.pointName, jdbcType=VARCHAR},-->
<!-- #{item.analysisTime, jdbcType=VARCHAR},-->
<!-- #{item.kks, jdbcType=VARCHAR},-->
<!-- )-->
<!-- </foreach>-->
<!-- </insert>-->
<insert id="saveBatchHealthIndexList">
insert into ${tableName}
using pv_health_index_data TAGS ('按时刻')
values
<foreach collection="list" separator="," item="item" index="index">
(
now,
#{item.recDate, jdbcType=VARCHAR},
......@@ -29,8 +62,128 @@
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</insert>
<select id="getInfoListByGroupByCdPv" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
select
index_address,
gateway_id ,
station,
'测点' as analysis_obj_type,
analysis_obj_seq,
weight,
area,
subarray,
manufacturer,
equipment_name,
avg(anomaly) as anomaly,
point_name,
device_type,
kks,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
index_address,
station,
analysis_obj_type,
analysis_obj_seq,
weight,
area,
subarray,
manufacturer,
equipment_name,
point_name,
device_type,
kks
</select>
<select id="getInfoListByGroupBySbPv" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
select
gateway_id ,
station,
'设备' as analysis_obj_type,
area,
subarray,
equipment_name,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
station,
analysis_obj_type,
area,
subarray,
equipment_name
</select>
<select id="getInfoListByGroupByZzPv" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
select
gateway_id ,
station,
'子阵' as analysis_obj_type,
area,
subarray,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
station,
analysis_obj_type,
area,
subarray
</select>
<select id="getInfoListByGroupByCzPv" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
select
gateway_id ,
station,
'场站' as analysis_obj_type,
area,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
gateway_id,
station,
analysis_obj_type,
area
</select>
<select id="getInfoListByGroupByQyPv" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
select
'片区' as analysis_obj_type,
area,
avg(anomaly) as anomaly,
AVG(health_index) as health_index
from
#{tableName}
where
analysis_obj_type = #{analysisObjectType}
and ts > #{startTime}
group by
analysis_obj_type,
area
</select>
</mapper>
<?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">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper">
</mapper>
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