Commit 18f578ef authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/developer' into developer

parents 433ee961 dcc774a0
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.HealthLevelSortEnum; import com.yeejoin.amos.boot.module.jxiop.biz.Enum.HealthLevelSortEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.WarningPeriodEnum; import com.yeejoin.amos.boot.module.jxiop.biz.Enum.WarningPeriodEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointTag;
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.IdxBizPvPointTag;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService; import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
...@@ -24,14 +19,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper; ...@@ -24,14 +19,10 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexHourMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexHourMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMomentMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMomentMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexHour;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexMoment;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
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.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -43,11 +34,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -43,11 +34,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.POST;
import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
...@@ -55,8 +43,6 @@ import java.util.*; ...@@ -55,8 +43,6 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
*
*
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
*/ */
...@@ -87,6 +73,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -87,6 +73,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
public final DecimalFormat df = new DecimalFormat("#.0"); public final DecimalFormat df = new DecimalFormat("#.0");
public final DecimalFormat dfSS = new DecimalFormat("#.00"); public final DecimalFormat dfSS = new DecimalFormat("#.00");
/** /**
* 新增 * 新增
* *
...@@ -109,7 +96,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -109,7 +96,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizFanHealthIndexDto> updateBySequenceNbrIdxBizFanHealthIndex(@RequestBody IdxBizFanHealthIndexDto model,@PathVariable(value = "sequenceNbr") String sequenceNbr) { public ResponseModel<IdxBizFanHealthIndexDto> updateBySequenceNbrIdxBizFanHealthIndex(@RequestBody IdxBizFanHealthIndexDto model, @PathVariable(value = "sequenceNbr") String sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.updateWithModel(model));
} }
...@@ -123,7 +110,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -123,7 +110,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.removeById(sequenceNbr));
} }
...@@ -135,7 +122,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -135,7 +122,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<IdxBizFanHealthIndexDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<IdxBizFanHealthIndexDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryBySeq(sequenceNbr));
} }
...@@ -149,8 +136,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -149,8 +136,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询") @ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<IdxBizFanHealthIndexDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<IdxBizFanHealthIndexDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) { (value = "size") int size) {
Page<IdxBizFanHealthIndexDto> page = new Page<IdxBizFanHealthIndexDto>(); Page<IdxBizFanHealthIndexDto> page = new Page<IdxBizFanHealthIndexDto>();
page.setCurrent(current); page.setCurrent(current);
...@@ -164,75 +151,75 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -164,75 +151,75 @@ public class IdxBizFanHealthIndexController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<IdxBizFanHealthIndexDto>> selectForList() { public ResponseModel<List<IdxBizFanHealthIndexDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryForIdxBizFanHealthIndexList()); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryForIdxBizFanHealthIndexList());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测风机层左侧列表", notes = "预警监测风机层左侧列表") @ApiOperation(httpMethod = "GET", value = "预警监测风机层左侧列表", notes = "预警监测风机层左侧列表")
@GetMapping(value = "/tableLeftList") @GetMapping(value = "/tableLeftList")
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableList(@RequestParam(required = false) String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,Integer current,Integer size) { public ResponseModel<Page<Map<String, Object>>> queryForLeftTableList(@RequestParam(required = false) String STATION, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, Integer current, Integer size) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>(); Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = idxBizFanHealthIndexServiceImpl.queryForLeftTableListCount(STATION, HEALTHLEVEL, EQUIPMENTNAME); int total = idxBizFanHealthIndexServiceImpl.queryForLeftTableListCount(STATION, HEALTHLEVEL, EQUIPMENTNAME);
page.setTotal(Long.valueOf(total)); page.setTotal(Long.valueOf(total));
page.setRecords(idxBizFanHealthIndexServiceImpl.queryForLeftTableList(STATION,HEALTHLEVEL,EQUIPMENTNAME,(current-1)*size,size)); page.setRecords(idxBizFanHealthIndexServiceImpl.queryForLeftTableList(STATION, HEALTHLEVEL, EQUIPMENTNAME, (current - 1) * size, size));
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测风机层仪表盘", notes = "预警监测风机层仪表盘") @ApiOperation(httpMethod = "GET", value = "预警监测风机层仪表盘", notes = "预警监测风机层仪表盘")
@GetMapping(value = "/queryForLeftTableListNum") @GetMapping(value = "/queryForLeftTableListNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListNum(@RequestParam(required = false)String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false)String EQUIPMENTNAME) { public ResponseModel<Map<String, Object>> queryForLeftTableListNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME) {
return ResponseHelper.buildResponse( idxBizFanHealthIndexServiceImpl.queryForLeftTableListNum(STATION, HEALTHLEVEL, EQUIPMENTNAME)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryForLeftTableListNum(STATION, HEALTHLEVEL, EQUIPMENTNAME));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点层左侧列表", notes = "预警监测风机层左侧列表") @ApiOperation(httpMethod = "GET", value = "预警监测测点层左侧列表", notes = "预警监测风机层左侧列表")
@GetMapping(value = "/tableLeftByPointList") @GetMapping(value = "/tableLeftByPointList")
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableByPointList(@RequestParam(required = false) String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false)String POINTNAME,Integer current,Integer size) { public ResponseModel<Page<Map<String, Object>>> queryForLeftTableByPointList(@RequestParam(required = false) String STATION, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) String POINTNAME, Integer current, Integer size) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>(); Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = idxBizFanHealthIndexServiceImpl.queryForLeftTableListByPointCount(STATION, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME); int total = idxBizFanHealthIndexServiceImpl.queryForLeftTableListByPointCount(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME);
page.setTotal(Long.valueOf(total)); page.setTotal(Long.valueOf(total));
page.setRecords(idxBizFanHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME,(current-1)*size,size)); page.setRecords(idxBizFanHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME, (current - 1) * size, size));
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点层仪表盘", notes = "预警监测风机层仪表盘") @ApiOperation(httpMethod = "GET", value = "预警监测测点层仪表盘", notes = "预警监测风机层仪表盘")
@GetMapping(value = "/queryForLeftTableListByPointNum") @GetMapping(value = "/queryForLeftTableListByPointNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListByPointNum(@RequestParam(required = false)String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false)String EQUIPMENTNAME,@RequestParam(required = false)String POINTNAME) { public ResponseModel<Map<String, Object>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) String POINTNAME) {
return ResponseHelper.buildResponse( idxBizFanHealthIndexServiceImpl.queryForLeftTableListByPointNum(STATION, HEALTHLEVEL, EQUIPMENTNAME,POINTNAME)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.queryForLeftTableListByPointNum(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计", notes = "预警监测设备级统计") @ApiOperation(httpMethod = "GET", value = "预警监测设备级统计", notes = "预警监测设备级统计")
@GetMapping(value = "/queryForPointNum") @GetMapping(value = "/queryForPointNum")
public ResponseModel<List<Map<String,Object>>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String EQUIPMENTNAME) { public ResponseModel<List<Map<String, Object>>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String EQUIPMENTNAME) {
List<IdxBizFanWarningRecord> idxBizPvWarningRecordList = idxBizFanHealthIndexServiceImpl.warningData(STATION, SUBARRAY, EQUIPMENTNAME); List<IdxBizFanWarningRecord> idxBizPvWarningRecordList = idxBizFanHealthIndexServiceImpl.warningData(STATION, SUBARRAY, EQUIPMENTNAME);
int total = idxBizFanHealthIndexServiceImpl.pointNum(STATION, SUBARRAY, EQUIPMENTNAME); int total = idxBizFanHealthIndexServiceImpl.pointNum(STATION, SUBARRAY, EQUIPMENTNAME);
Map<String,Object> map =new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String,Object> map1 =new HashMap<>(); Map<String, Object> map1 = new HashMap<>();
Map<String,Object> warningNum =new HashMap<>(); Map<String, Object> warningNum = new HashMap<>();
Map<String,Object> pointNum =new HashMap<>(); Map<String, Object> pointNum = new HashMap<>();
map1.put("name","危险"); map1.put("name", "危险");
map1.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("危险")).count()); map1.put("value", idxBizPvWarningRecordList.stream().filter(e -> e.getWarningName().equals("危险")).count());
map.put("name","警告"); map.put("name", "警告");
map.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("警告")).count()); map.put("value", idxBizPvWarningRecordList.stream().filter(e -> e.getWarningName().equals("警告")).count());
warningNum.put("name","注意"); warningNum.put("name", "注意");
warningNum.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("注意")).count()); warningNum.put("value", idxBizPvWarningRecordList.stream().filter(e -> e.getWarningName().equals("注意")).count());
pointNum.put("name","安全"); pointNum.put("name", "安全");
pointNum.put("value",total - idxBizPvWarningRecordList.size()); pointNum.put("value", total - idxBizPvWarningRecordList.size());
List<Map<String,Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
list.add(pointNum); list.add(pointNum);
list.add(warningNum); list.add(warningNum);
list.add(map); list.add(map);
...@@ -241,8 +228,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -241,8 +228,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "测点运行趋势图", notes = "测点运行趋势图") @ApiOperation(httpMethod = "GET", value = "测点运行趋势图", notes = "测点运行趋势图")
@GetMapping(value = "/getqyt") @GetMapping(value = "/getqyt")
public ResponseModel<Object> getqyt( public ResponseModel<Object> getqyt(
String type, String type,
...@@ -253,50 +240,50 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -253,50 +240,50 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime @RequestParam(value = "endTime", required = false) String endTime
) { ) {
if(StringUtils.isEmpty(address) || StringUtils.isEmpty(statioName) || StringUtils.isEmpty(equipmentName) || StringUtils.isEmpty(arae)){ if (StringUtils.isEmpty(address) || StringUtils.isEmpty(statioName) || StringUtils.isEmpty(equipmentName) || StringUtils.isEmpty(arae)) {
throw new RuntimeException("片区,场站,设备名称,子系统,分析变量不能为空"); throw new RuntimeException("片区,场站,设备名称,子系统,分析变量不能为空");
} }
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime,gatewayIds)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt(type, address, statioName, equipmentName, arae, startTime, endTime, gatewayIds));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "工况字典详情", notes = "工况字典详情") @ApiOperation(httpMethod = "GET", value = "工况字典详情", notes = "工况字典详情")
@GetMapping(value = "/getZDXQ") @GetMapping(value = "/getZDXQ")
public ResponseModel<Object> getZDXQ( public ResponseModel<Object> getZDXQ(
String type, String type,
String id String id
) { ) {
Object object=null; Object object = null;
if(type.equals("1")){ if (type.equals("1")) {
object= idxBizPvPointTagMapper.selectById(id); object = idxBizPvPointTagMapper.selectById(id);
}else{ } else {
object= idxBizFanPointTagMapper.selectById(id); object = idxBizFanPointTagMapper.selectById(id);
} }
return ResponseHelper.buildResponse(object); return ResponseHelper.buildResponse(object);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "工况字典修改", notes = "工况字典修改") @ApiOperation(httpMethod = "GET", value = "工况字典修改", notes = "工况字典修改")
@PostMapping (value = "/updateZDXQ") @PostMapping(value = "/updateZDXQ")
public ResponseModel<Object> updateZDXQ( public ResponseModel<Object> updateZDXQ(
String type, String type,
String id, String id,
String pointDirection, String pointDirection,
String tagCode String tagCode
) { ) {
idxBizFanHealthIndexServiceImpl.updatezd( type,id, pointDirection,tagCode); idxBizFanHealthIndexServiceImpl.updatezd(type, id, pointDirection, tagCode);
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点层左侧列表", notes = "预警监测风机层左侧列表") @ApiOperation(httpMethod = "GET", value = "预警监测测点层左侧列表", notes = "预警监测风机层左侧列表")
@GetMapping(value = "/selectPointByANALYSISTYPE") @GetMapping(value = "/selectPointByANALYSISTYPE")
public ResponseModel<Map<String,Object>> selectPointByANALYSISTYPE(@RequestParam(required = false) String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false)String POINTNAME,@RequestParam(required = false)String startTime,@RequestParam(required = false) String endTime) { public ResponseModel<Map<String, Object>> selectPointByANALYSISTYPE(@RequestParam(required = false) String STATION, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) String POINTNAME, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
List<Map<String, Object>> maps = idxBizFanHealthIndexServiceImpl.selectPointByANALYSISTYPE(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME,startTime,endTime); List<Map<String, Object>> maps = idxBizFanHealthIndexServiceImpl.selectPointByANALYSISTYPE(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME, startTime, endTime);
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
...@@ -306,34 +293,34 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -306,34 +293,34 @@ public class IdxBizFanHealthIndexController extends BaseController {
axisData.add(map.get("REC_DATE")); axisData.add(map.get("REC_DATE"));
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "查询场站下设备状态统计", notes = "查询场站下设备状态统计") @ApiOperation(httpMethod = "GET", value = "查询场站下设备状态统计", notes = "查询场站下设备状态统计")
@GetMapping (value = "/getFanEquipStatusByStation") @GetMapping(value = "/getFanEquipStatusByStation")
public ResponseModel<List<Map<String,Object>>> getFanEquipStatusByStation(String STATION) { public ResponseModel<List<Map<String, Object>>> getFanEquipStatusByStation(String STATION) {
Map<String, Object> map = idxBizFanHealthIndexServiceImpl.getFanEquipStatusByStation(STATION); Map<String, Object> map = idxBizFanHealthIndexServiceImpl.getFanEquipStatusByStation(STATION);
List<Map<String,Object>> maps = new ArrayList<>(); List<Map<String, Object>> maps = new ArrayList<>();
Map<String,Object> anquan = new HashMap<>(); Map<String, Object> anquan = new HashMap<>();
anquan.put("name","安全"); anquan.put("name", "安全");
anquan.put("value",map.get("安全")); anquan.put("value", map.get("安全"));
maps.add(anquan); maps.add(anquan);
Map<String,Object> zhuyi = new HashMap<>(); Map<String, Object> zhuyi = new HashMap<>();
zhuyi.put("name","注意"); zhuyi.put("name", "注意");
zhuyi.put("value",map.get("注意")); zhuyi.put("value", map.get("注意"));
maps.add(zhuyi); maps.add(zhuyi);
Map<String,Object> jinggao = new HashMap<>(); Map<String, Object> jinggao = new HashMap<>();
jinggao.put("name","警告"); jinggao.put("name", "警告");
jinggao.put("value",map.get("警告")); jinggao.put("value", map.get("警告"));
maps.add(jinggao); maps.add(jinggao);
Map<String,Object> weixian = new HashMap<>(); Map<String, Object> weixian = new HashMap<>();
weixian.put("name","危险"); weixian.put("name", "危险");
weixian.put("value",map.get("危险")); weixian.put("value", map.get("危险"));
maps.add(weixian); maps.add(weixian);
...@@ -341,60 +328,60 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -341,60 +328,60 @@ public class IdxBizFanHealthIndexController 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 = "/getPvEquipStatusByStation") @GetMapping(value = "/getPvEquipStatusByStation")
public ResponseModel<List<Map<String,Object>>> getPvEquipStatusByStation(String STATION) { public ResponseModel<List<Map<String, Object>>> getPvEquipStatusByStation(String STATION) {
Map<String, Object> map = idxBizFanHealthIndexServiceImpl.getPvEquipStatusByStation(STATION); Map<String, Object> map = idxBizFanHealthIndexServiceImpl.getPvEquipStatusByStation(STATION);
List<Map<String,Object>> maps = new ArrayList<>(); List<Map<String, Object>> maps = new ArrayList<>();
Map<String,Object> anquan = new HashMap<>(); Map<String, Object> anquan = new HashMap<>();
anquan.put("name","安全"); anquan.put("name", "安全");
anquan.put("value",map.get("安全")); anquan.put("value", map.get("安全"));
maps.add(anquan); maps.add(anquan);
Map<String,Object> zhuyi = new HashMap<>(); Map<String, Object> zhuyi = new HashMap<>();
zhuyi.put("name","注意"); zhuyi.put("name", "注意");
zhuyi.put("value",map.get("注意")); zhuyi.put("value", map.get("注意"));
maps.add(zhuyi); maps.add(zhuyi);
Map<String,Object> jinggao = new HashMap<>(); Map<String, Object> jinggao = new HashMap<>();
jinggao.put("name","警告"); jinggao.put("name", "警告");
jinggao.put("value",map.get("警告")); jinggao.put("value", map.get("警告"));
maps.add(jinggao); maps.add(jinggao);
Map<String,Object> weixian = new HashMap<>(); Map<String, Object> weixian = new HashMap<>();
weixian.put("name","危险"); weixian.put("name", "危险");
weixian.put("value",map.get("危险")); weixian.put("value", map.get("危险"));
maps.add(weixian); maps.add(weixian);
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电场站/设备左侧列表通用接口", notes = "TD 风电场站/设备列表通用接口") @ApiOperation(httpMethod = "GET", value = "TD 风电场站/设备左侧列表通用接口", notes = "TD 风电场站/设备列表通用接口")
@GetMapping(value = "/stationHealthIndexTable") @GetMapping(value = "/stationHealthIndexTable")
public ResponseModel<Page<FanHealthIndexDay>> stationHealthIndexTable(@RequestParam(value = "area",required = false) String area, public ResponseModel<Page<FanHealthIndexDay>> stationHealthIndexTable(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "subSystem",required = false) String subSystem, @RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "current",required = false)Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size",required = false)Integer size){ @RequestParam(value = "size", required = false) Integer size) {
Page<FanHealthIndexDay> page = new Page<FanHealthIndexDay>(); Page<FanHealthIndexDay> page = new Page<FanHealthIndexDay>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
if (type.equals("0")){ if (type.equals("0")) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9); Date date = DateUtils.dateAddHours(startDayTime, -9);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
}else{ } else {
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -7); Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -7);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
...@@ -403,17 +390,17 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -403,17 +390,17 @@ public class IdxBizFanHealthIndexController extends BaseController {
} }
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL"; String orgCode = "NULL";
if(gatewayIds.size()>0){ if (gatewayIds.size() > 0) {
orgCode =gatewayIds.get(0)+"%"; orgCode = gatewayIds.get(0) + "%";
} }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, orgCode); List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, orgCode);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,orgCode); int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexDays)){ if (CollectionUtils.isEmpty(fanHealthIndexDays)) {
fanHealthIndexDays = fanHealthIndexDayMapper.selectLatestData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, null, null,(current-1)*size,size, orgCode); fanHealthIndexDays = fanHealthIndexDayMapper.selectLatestData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, null, null, (current - 1) * size, size, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexDays)){ if (CollectionUtils.isEmpty(fanHealthIndexDays)) {
logger.warn("根据条件:area:{},station:{},equipmentName:{},subSystem:{},pointName:{},analysisObjType:{}获取最新的数据为空",area,station,equipmentName,subSystem,pointName,analysisObjType); logger.warn("根据条件:area:{},station:{},equipmentName:{},subSystem:{},pointName:{},analysisObjType:{}获取最新的数据为空", area, station, equipmentName, subSystem, pointName, analysisObjType);
total = 0; total = 0;
}else{ } else {
total = fanHealthIndexDays.size(); total = fanHealthIndexDays.size();
} }
} }
...@@ -427,69 +414,106 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -427,69 +414,106 @@ public class IdxBizFanHealthIndexController extends BaseController {
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电场站/设备仪表盘", notes = "TD 风电场站/设备仪表盘") @ApiOperation(httpMethod = "GET", value = "TD 风电场站/设备仪表盘", notes = "TD 风电场站/设备仪表盘")
@GetMapping(value = "/HealthIndexValue") @GetMapping(value = "/HealthIndexValue")
public ResponseModel<Map<String,Object>> HealthIndexValue(@RequestParam(value = "area",required = false) String area, public ResponseModel<Map<String, Object>> HealthIndexValue(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "subSystem",required = false) String subSystem, @RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "current",required = false)Integer current, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "size",required = false)Integer size){ @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size", required = false) Integer size) {
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL";
if (type.equals("0")){ if (gatewayIds.size() > 0) {
orgCode = gatewayIds.get(0) + "%";
}
if (requiredType.equals(WarningPeriodEnum.DAY.getName())) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8); Date date = DateUtils.dateAddHours(startDayTime, -9);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
}else{ List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, null, null, orgCode);
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); Map<String, Object> map = new HashMap<>();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Double value = 0.00;
endTimeTop = formatter.format(endDate); if (CollectionUtil.isNotEmpty(fanHealthIndexDays)) {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); value = Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex()));
startTimeTop = formatter.format(startDate);
} }
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); map.put("value", value);
String orgCode = "NULL"; return ResponseHelper.buildResponse(map);
if(gatewayIds.size()>0){ } else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())) {
orgCode =gatewayIds.get(0)+"%"; Date date = new Date();
date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
List<FanHealthIndexHour> fanHealthIndexHour = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, null, null, orgCode);
Map<String, Object> map = new HashMap<>();
Double value = 0.00;
if (CollectionUtil.isNotEmpty(fanHealthIndexHour)) {
value = Double.parseDouble(df.format(fanHealthIndexHour.get(0).getHealthIndex()));
} }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode); map.put("value", value);
return ResponseHelper.buildResponse(map);
Map<String,Object> map = new HashMap<>(); } else {
Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
List<FanHealthIndexMoment> fanHealthIndexMoment = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, null, null, orgCode);
Map<String, Object> map = new HashMap<>();
//预防查询结果为空 //预防查询结果为空
if(CollectionUtils.isEmpty(fanHealthIndexDays)){ Double value = 0.00;
map.put("value",0); if (CollectionUtil.isNotEmpty(fanHealthIndexMoment)) {
}else{ value = Double.parseDouble(df.format(fanHealthIndexMoment.get(0).getHealthIndex()));
map.put("value",Double.parseDouble(df.format(Double.parseDouble(fanHealthIndexDays.get(0).getValue()))));
} }
map.put("value", value);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "查询场站下设备状态统计", notes = "查询场站下设备状态统计") @ApiOperation(httpMethod = "GET", value = "查询场站下设备状态统计", notes = "查询场站下设备状态统计")
@GetMapping (value = "/selectEquipStatusByStation") @GetMapping(value = "/selectEquipStatusByStation")
public ResponseModel<List<Map<String,Object>>> getFanEquipStatusByStation(@RequestParam(value = "area",required = false) String area, public ResponseModel<List<Map<String, Object>>> getFanEquipStatusByStation(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "requiredType", required = false) String requiredType
) { ) {
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = fanHealthIndexDayMapper.selectEquipStatusByStation(area, analysisObjType, station, gatewayIds); List<Map<String, Object>> maps;
if (maps.size() == 4){ String startTimeTop;
if (WarningPeriodEnum.DAY.getName().equals(requiredType)) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
maps = fanHealthIndexDayMapper.selectEquipStatusByStation(area, analysisObjType, station, gatewayIds,startTimeTop);
}else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)) {
Date date = new Date();
date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
maps = fanHealthIndexHourMapper.selectEquipStatusByStation(area, analysisObjType, station, gatewayIds,startTimeTop);
}else{
Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
maps = fanHealthIndexMomentMapper.selectEquipStatusByStation(area, analysisObjType, station, gatewayIds,startTimeTop);
}
if (maps.size() == 4) {
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
} }
} else { } else {
...@@ -500,17 +524,17 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -500,17 +524,17 @@ public class IdxBizFanHealthIndexController extends BaseController {
levels.add("危险"); levels.add("危险");
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
String healthlevel = map.get("healthlevel").toString(); String healthlevel = map.get("healthlevel").toString();
levels.remove(healthlevel); levels.remove(healthlevel);
} }
if (levels.size()>0){ if (levels.size() > 0) {
for (String s : levels) { for (String s : levels) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name",s); map.put("name", s);
map.put("value",0); map.put("value", 0);
map.put("sort",HealthLevelSortEnum.getCode(s)); map.put("sort", HealthLevelSortEnum.getCode(s));
maps.add(map); maps.add(map);
} }
maps = maps.stream().sorted(Comparator.comparingLong(e -> Long.valueOf(e.get("sort").toString()))).collect(Collectors.toList()); maps = maps.stream().sorted(Comparator.comparingLong(e -> Long.valueOf(e.get("sort").toString()))).collect(Collectors.toList());
...@@ -520,38 +544,34 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -520,38 +544,34 @@ public class IdxBizFanHealthIndexController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计td 统计分类环图 ", notes = "预警监测设备级统计td 统计分类环图") @ApiOperation(httpMethod = "GET", value = "预警监测设备级统计td 统计分类环图 ", notes = "预警监测设备级统计td 统计分类环图")
@GetMapping(value = "/selectPointNum") @GetMapping(value = "/selectPointNum")
public ResponseModel<List<Map<String,Object>>> selectPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBSYSTEM,@RequestParam(required = false) String EQUIPMENTNAME) { public ResponseModel<List<Map<String, Object>>> selectPointNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBSYSTEM, @RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(value = "requiredType", required = false) String requiredType) {
// List<FanWarningRecord> idxBizPvWarningRecordList = fanWarningRecord.warningData(STATION,EQUIPMENTNAME ,SUBSYSTEM ); List<Map<String, Object>> maps;
List<Map<String, Object>> maps = fanHealthIndexDayMapper.selectEquipStatusByEquipment( "测点", STATION,EQUIPMENTNAME); String startTimeTop;
int total = idxBizFanHealthIndexServiceImpl.pointNum(STATION, SUBSYSTEM, EQUIPMENTNAME); if (WarningPeriodEnum.DAY.getName().equals(requiredType)) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
// Map<String,Object> map =new HashMap<>(); Date date = DateUtils.dateAddHours(startDayTime, -9);
// Map<String,Object> map1 =new HashMap<>(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Map<String,Object> warningNum =new HashMap<>(); startTimeTop = formatter.format(date);
// Map<String,Object> pointNum =new HashMap<>(); maps = fanHealthIndexDayMapper.selectEquipStatusByEquipment("测点", STATION, EQUIPMENTNAME,startTimeTop);
// }else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)) {
// map1.put("name","危险"); Date date = new Date();
// map1.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("危险")).count()); date = DateUtil.offsetHour(date, -8);
// map.put("name","警告"); date = DateUtil.offsetMinute(date, -59);
// map.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("警告")).count()); startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
// warningNum.put("name","注意"); maps = fanHealthIndexHourMapper.selectEquipStatusByEquipment("测点", STATION, EQUIPMENTNAME,startTimeTop);
// warningNum.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("注意")).count()); }else{
// pointNum.put("name","安全"); Date date = DateUtils.dateAddMinutes(null, -9);
// pointNum.put("value",total - idxBizPvWarningRecordList.size()); date = DateUtils.dateAddHours(date, -8);
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// List<Map<String,Object>> list = new ArrayList<>(); startTimeTop = formatter.format(date);
// list.add(pointNum); maps = fanHealthIndexMomentMapper.selectEquipStatusByEquipment("测点", STATION, EQUIPMENTNAME,startTimeTop);
// list.add(warningNum); }
// list.add(map); if (maps.size() == 4) {
// list.add(map1);
//
// return ResponseHelper.buildResponse(list);
if (maps.size() == 4){
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
} }
} else { } else {
...@@ -562,17 +582,17 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -562,17 +582,17 @@ public class IdxBizFanHealthIndexController extends BaseController {
levels.add("危险"); levels.add("危险");
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
String healthlevel = map.get("healthlevel").toString(); String healthlevel = map.get("healthlevel").toString();
levels.remove(healthlevel); levels.remove(healthlevel);
} }
if (levels.size()>0){ if (levels.size() > 0) {
for (String s : levels) { for (String s : levels) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name",s); map.put("name", s);
map.put("value",0); map.put("value", 0);
map.put("sort",HealthLevelSortEnum.getCode(s)); map.put("sort", HealthLevelSortEnum.getCode(s));
maps.add(map); maps.add(map);
} }
maps = maps.stream().sorted(Comparator.comparingLong(e -> Long.valueOf(e.get("sort").toString()))).collect(Collectors.toList()); maps = maps.stream().sorted(Comparator.comparingLong(e -> Long.valueOf(e.get("sort").toString()))).collect(Collectors.toList());
...@@ -582,30 +602,30 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -582,30 +602,30 @@ public class IdxBizFanHealthIndexController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电场站/设备列表通用接口", notes = "TD 风电场站/设备列表通用接口") @ApiOperation(httpMethod = "GET", value = "TD 风电场站/设备列表通用接口", notes = "TD 风电场站/设备列表通用接口")
@GetMapping(value = "/pointHealthIndexTable") @GetMapping(value = "/pointHealthIndexTable")
public ResponseModel<Page> pointHealthIndexTable(@RequestParam(value = "area",required = false) String area, public ResponseModel<Page> pointHealthIndexTable(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "subSystem",required = false) String subSystem, @RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "current",required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size",required = false) Integer size){ @RequestParam(value = "size", required = false) Integer size) {
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL"; String orgCode = "NULL";
if(gatewayIds.size()>0){ if (gatewayIds.size() > 0) {
orgCode =gatewayIds.get(0)+"%"; orgCode = gatewayIds.get(0) + "%";
} }
if (requiredType.equals(WarningPeriodEnum.DAY.getName())){ if (requiredType.equals(WarningPeriodEnum.DAY.getName())) {
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9); Date date = DateUtils.dateAddHours(startDayTime, -9);
...@@ -618,24 +638,24 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -618,24 +638,24 @@ public class IdxBizFanHealthIndexController extends BaseController {
// 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<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size,orgCode ); List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, orgCode);
fanHealthIndexDays.forEach(item -> { fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,orgCode); int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode);
page.setTotal(total); page.setTotal(total);
page.setRecords(fanHealthIndexDays); page.setRecords(fanHealthIndexDays);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
}else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())){ } else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())) {
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date date = new Date(); Date date = new Date();
date = DateUtil.offsetHour(date,-8); date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date,-59); date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date,DatePattern.NORM_DATETIME_PATTERN); startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
// }else{ // }else{
// Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); // Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -643,20 +663,20 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -643,20 +663,20 @@ public class IdxBizFanHealthIndexController extends BaseController {
// 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<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, orgCode); List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, orgCode);
fanHealthIndexHours.forEach(item -> { fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,orgCode); int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode);
page.setTotal(total); page.setTotal(total);
page.setRecords(fanHealthIndexHours); page.setRecords(fanHealthIndexHours);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
}else { } else {
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date date = DateUtils.dateAddMinutes(null,-9); Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8); date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
...@@ -667,14 +687,14 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -667,14 +687,14 @@ public class IdxBizFanHealthIndexController extends BaseController {
// 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<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, orgCode); List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, orgCode);
fanHealthIndexMoments.forEach(item -> { fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,orgCode); int total = fanHealthIndexDayMapper.selectDataTotal(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode);
page.setTotal(total); page.setTotal(total);
page.setRecords(fanHealthIndexMoments); page.setRecords(fanHealthIndexMoments);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
...@@ -682,28 +702,27 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -682,28 +702,27 @@ public class IdxBizFanHealthIndexController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电测点仪表盘", notes = "TD 风电测点仪表盘") @ApiOperation(httpMethod = "GET", value = "TD 风电测点仪表盘", notes = "TD 风电测点仪表盘")
@GetMapping(value = "/pointHealthIndexValue") @GetMapping(value = "/pointHealthIndexValue")
public ResponseModel<Map<String,Object>> pointHealthIndexValue(@RequestParam(value = "area",required = false) String area, public ResponseModel<Map<String, Object>> pointHealthIndexValue(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "subSystem",required = false) String subSystem, @RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "current",required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size",required = false) Integer size){ @RequestParam(value = "size", required = false) Integer size) {
if (requiredType.equals(WarningPeriodEnum.DAY.getName())) {
if (requiredType.equals(WarningPeriodEnum.DAY.getName())){
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9); Date date = DateUtils.dateAddHours(startDayTime, -9);
...@@ -716,17 +735,17 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -716,17 +735,17 @@ public class IdxBizFanHealthIndexController extends BaseController {
// 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<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null); List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, null);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex()))); map.put("value", Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
}else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())){ } else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())) {
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date date = new Date(); Date date = new Date();
date = DateUtil.offsetHour(date,-8); date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date,-59); date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date,DatePattern.NORM_DATETIME_PATTERN); startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
// }else{ // }else{
// Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); // Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
...@@ -734,13 +753,13 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -734,13 +753,13 @@ public class IdxBizFanHealthIndexController extends BaseController {
// 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<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null); List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, null);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex()))); map.put("value", Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
}else { } else {
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date date = DateUtils.dateAddMinutes(null,-9); Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8); date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
...@@ -751,112 +770,108 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -751,112 +770,108 @@ public class IdxBizFanHealthIndexController extends BaseController {
// 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<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null); List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, null);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex()))); map.put("value", Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 风电折线图", notes = "TD风电折线图") @ApiOperation(httpMethod = "GET", value = "TD 风电折线图", notes = "TD风电折线图")
@GetMapping(value = "/pointHealthIndexTrend") @GetMapping(value = "/pointHealthIndexTrend")
public ResponseModel<Object> pointHealthIndexTrend(@RequestParam(value = "area",required = false) String area, public ResponseModel<Object> pointHealthIndexTrend(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "subSystem",required = false) String subSystem) { @RequestParam(value = "subSystem", required = false) String subSystem) {
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL"; String orgCode = "NULL";
if(gatewayIds.size()>0){ if (gatewayIds.size() > 0) {
orgCode =gatewayIds.get(0)+'%'; orgCode = gatewayIds.get(0) + '%';
} }
if (WarningPeriodEnum.DAY.getName().equals(requiredType)){ if (WarningPeriodEnum.DAY.getName().equals(requiredType)) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
if ( null != endTimeTop){ if (null != endTimeTop) {
Date endDate = DateUtils.dateParse(endTimeTop); Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
//处理空指针问题 如果为空差15天前数据 //处理空指针问题 如果为空差15天前数据
if(StrUtil.isEmpty(startTimeTop)){ if (StrUtil.isEmpty(startTimeTop)) {
startTimeTop = LocalDateTime.now().minusDays(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); startTimeTop = LocalDateTime.now().minusDays(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
} }
Date startDate = DateUtils.dateParse(startTimeTop); Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectTrendData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode); List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectTrendData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, null, null, orgCode);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getRecDate)).collect(Collectors.toList()); fanHealthIndexDays = fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getRecDate)).collect(Collectors.toList());
for (FanHealthIndexDay obj : fanHealthIndexDays) { for (FanHealthIndexDay obj : fanHealthIndexDays) {
if (type.equals("0")){ if (type.equals("0")) {
seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex()))); seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex())));
}else { } else {
seriesData.add(obj.getAnomaly() > 7.5?7.5:dfSS.format(obj.getAnomaly())); seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly()));
} }
axisData.add(obj.getRecDate()); axisData.add(obj.getRecDate());
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)){ } else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)) {
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.dateParse(endTimeTop); Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
Date startDate = DateUtils.dateParse(startTimeTop); Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectTrendData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode); List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectTrendData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, null, null, orgCode);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(FanHealthIndexHour::getRecDate)).collect(Collectors.toList()); fanHealthIndexHours = fanHealthIndexHours.stream().sorted(Comparator.comparing(FanHealthIndexHour::getRecDate)).collect(Collectors.toList());
for (FanHealthIndexHour obj : fanHealthIndexHours) { for (FanHealthIndexHour obj : fanHealthIndexHours) {
if (type.equals("0")){ if (type.equals("0")) {
seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex()))); seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex())));
}else { } else {
seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly())); seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly()));
} }
// Date dateTime = DateUtil.parseDateTime(obj.getAnalysisTime());
// String format = DateUtil.format(dateTime, "yyyy-MM-dd HH:00");
axisData.add(obj.getRecDate()); axisData.add(obj.getRecDate());
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}else { } else {
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.dateParse(endTimeTop); Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
Date startDate = DateUtils.dateParse(startTimeTop); Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectTrendData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode); List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectTrendData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, null, null, orgCode);
fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(FanHealthIndexMoment::getRecDate)).collect(Collectors.toList()); fanHealthIndexMoments = fanHealthIndexMoments.stream().sorted(Comparator.comparing(FanHealthIndexMoment::getRecDate)).collect(Collectors.toList());
for (FanHealthIndexMoment obj : fanHealthIndexMoments) { for (FanHealthIndexMoment obj : fanHealthIndexMoments) {
if (type.equals("0")){ if (type.equals("0")) {
seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex()))); seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex())));
}else { } else {
seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly())); seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly()));
} }
// Date dateTime = DateUtil.parseDateTime(obj.getAnalysisTime());
// String format = DateUtil.format(dateTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN);
axisData.add(obj.getRecDate()); axisData.add(obj.getRecDate());
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
} }
......
...@@ -11,10 +11,8 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils; ...@@ -11,10 +11,8 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.HealthLevelSortEnum; import com.yeejoin.amos.boot.module.jxiop.biz.Enum.HealthLevelSortEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.WarningPeriodEnum; import com.yeejoin.amos.boot.module.jxiop.biz.Enum.WarningPeriodEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvHealthIndexDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariableClassification; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointProcessVariableClassificationMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService; import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvHealthIndexServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvHealthIndexServiceImpl;
...@@ -34,7 +32,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -34,7 +32,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
...@@ -42,8 +39,6 @@ import java.util.*; ...@@ -42,8 +39,6 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
*
*
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
*/ */
...@@ -74,6 +69,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -74,6 +69,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
public final DecimalFormat df = new DecimalFormat("0.0"); public final DecimalFormat df = new DecimalFormat("0.0");
public final DecimalFormat dfSS = new DecimalFormat("0.00"); public final DecimalFormat dfSS = new DecimalFormat("0.00");
/** /**
* 新增 * 新增
* *
...@@ -96,7 +92,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -96,7 +92,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizPvHealthIndexDto> updateBySequenceNbrIdxBizPvHealthIndex(@RequestBody IdxBizPvHealthIndexDto model,@PathVariable(value = "sequenceNbr") String sequenceNbr) { public ResponseModel<IdxBizPvHealthIndexDto> updateBySequenceNbrIdxBizPvHealthIndex(@RequestBody IdxBizPvHealthIndexDto model, @PathVariable(value = "sequenceNbr") String sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.updateWithModel(model));
} }
...@@ -110,7 +106,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -110,7 +106,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.removeById(sequenceNbr));
} }
...@@ -122,7 +118,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -122,7 +118,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<IdxBizPvHealthIndexDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<IdxBizPvHealthIndexDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryBySeq(sequenceNbr));
} }
...@@ -136,8 +132,8 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -136,8 +132,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询") @ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<IdxBizPvHealthIndexDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<IdxBizPvHealthIndexDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) { (value = "size") int size) {
Page<IdxBizPvHealthIndexDto> page = new Page<IdxBizPvHealthIndexDto>(); Page<IdxBizPvHealthIndexDto> page = new Page<IdxBizPvHealthIndexDto>();
page.setCurrent(current); page.setCurrent(current);
...@@ -151,80 +147,80 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -151,80 +147,80 @@ public class IdxBizPvHealthIndexController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<IdxBizPvHealthIndexDto>> selectForList() { public ResponseModel<List<IdxBizPvHealthIndexDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForIdxBizPvHealthIndexList()); return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForIdxBizPvHealthIndexList());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级左侧列表", notes = "预警监测设备级左侧列表") @ApiOperation(httpMethod = "GET", value = "预警监测设备级左侧列表", notes = "预警监测设备级左侧列表")
@GetMapping(value = "/queryForLeftTableListByEquip") @GetMapping(value = "/queryForLeftTableListByEquip")
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableListByEquip(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) Integer current, @RequestParam(required = false) Integer size ) { public ResponseModel<Page<Map<String, Object>>> queryForLeftTableListByEquip(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) Integer current, @RequestParam(required = false) Integer size) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>(); Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquipCount(STATION, SUBARRAY, HEALTHLEVEL,EQUIPMENTNAME); int total = idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquipCount(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME);
Long num = Long.valueOf(total); Long num = Long.valueOf(total);
page.setTotal(num); page.setTotal(num);
page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquip(STATION,SUBARRAY,HEALTHLEVEL,EQUIPMENTNAME,(current-1)*size,size)); page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquip(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, (current - 1) * size, size));
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点级左侧列表", notes = "预警监测设备级左侧列表") @ApiOperation(httpMethod = "GET", value = "预警监测测点级左侧列表", notes = "预警监测设备级左侧列表")
@GetMapping(value = "/queryForLeftTableListByPoint") @GetMapping(value = "/queryForLeftTableListByPoint")
public ResponseModel<Page<Map<String,Object>>> queryForLeftTableListByPoint(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false) String POINTNAME,@RequestParam(required = false) Integer current,@RequestParam(required = false) Integer size) { public ResponseModel<Page<Map<String, Object>>> queryForLeftTableListByPoint(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) String POINTNAME, @RequestParam(required = false) Integer current, @RequestParam(required = false) Integer size) {
Page<Map<String,Object>> page = new Page<Map<String,Object>>(); Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
int total = idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPointCount(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME); int total = idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPointCount(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME);
Long num = Long.valueOf(total); Long num = Long.valueOf(total);
page.setTotal(num); page.setTotal(num);
page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION,SUBARRAY,HEALTHLEVEL,EQUIPMENTNAME,POINTNAME,(current-1)*size,size)); page.setRecords(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPoint(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME, (current - 1) * size, size));
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级仪表盘", notes = "预警监测设备级仪表盘") @ApiOperation(httpMethod = "GET", value = "预警监测设备级仪表盘", notes = "预警监测设备级仪表盘")
@GetMapping(value = "/queryForLeftTableListByEquipNum") @GetMapping(value = "/queryForLeftTableListByEquipNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListByEquipNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME) { public ResponseModel<Map<String, Object>> queryForLeftTableListByEquipNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME) {
; ;
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquipNum(STATION, SUBARRAY, HEALTHLEVEL,EQUIPMENTNAME)); return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByEquipNum(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测测点级仪表盘", notes = "预警监测设备级仪表盘") @ApiOperation(httpMethod = "GET", value = "预警监测测点级仪表盘", notes = "预警监测设备级仪表盘")
@GetMapping(value = "/queryForLeftTableListByPointNum") @GetMapping(value = "/queryForLeftTableListByPointNum")
public ResponseModel<Map<String,Object>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false) String POINTNAME) { public ResponseModel<Map<String, Object>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) String POINTNAME) {
return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPointNum(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME)); return ResponseHelper.buildResponse(idxBizPvHealthIndexServiceImpl.queryForLeftTableListByPointNum(STATION, SUBARRAY, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计", notes = "预警监测设备级统计") @ApiOperation(httpMethod = "GET", value = "预警监测设备级统计", notes = "预警监测设备级统计")
@GetMapping(value = "/queryForPointNum") @GetMapping(value = "/queryForPointNum")
public ResponseModel<List<Map<String,Object>>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String EQUIPMENTNAME) { public ResponseModel<List<Map<String, Object>>> queryForLeftTableListByPointNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String EQUIPMENTNAME) {
List<IdxBizPvWarningRecord> idxBizPvWarningRecordList = idxBizPvHealthIndexServiceImpl.warningData(STATION, SUBARRAY, EQUIPMENTNAME); List<IdxBizPvWarningRecord> idxBizPvWarningRecordList = idxBizPvHealthIndexServiceImpl.warningData(STATION, SUBARRAY, EQUIPMENTNAME);
int total = idxBizPvHealthIndexServiceImpl.pointNum(STATION, SUBARRAY, EQUIPMENTNAME); int total = idxBizPvHealthIndexServiceImpl.pointNum(STATION, SUBARRAY, EQUIPMENTNAME);
Map<String,Object> map =new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<String,Object> map1 =new HashMap<>(); Map<String, Object> map1 = new HashMap<>();
Map<String,Object> warningNum =new HashMap<>(); Map<String, Object> warningNum = new HashMap<>();
Map<String,Object> pointNum =new HashMap<>(); Map<String, Object> pointNum = new HashMap<>();
map1.put("name","危险"); map1.put("name", "危险");
map1.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("危险")).count()); map1.put("value", idxBizPvWarningRecordList.stream().filter(e -> e.getWarningName().equals("危险")).count());
map.put("name","警告"); map.put("name", "警告");
map.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("警告")).count()); map.put("value", idxBizPvWarningRecordList.stream().filter(e -> e.getWarningName().equals("警告")).count());
warningNum.put("name","注意"); warningNum.put("name", "注意");
warningNum.put("value",idxBizPvWarningRecordList.stream().filter(e->e.getWarningName().equals("注意")).count()); warningNum.put("value", idxBizPvWarningRecordList.stream().filter(e -> e.getWarningName().equals("注意")).count());
pointNum.put("name","安全"); pointNum.put("name", "安全");
pointNum.put("value", Math.max((total - idxBizPvWarningRecordList.size()), 0)); pointNum.put("value", Math.max((total - idxBizPvWarningRecordList.size()), 0));
List<Map<String,Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
list.add(pointNum); list.add(pointNum);
list.add(warningNum); list.add(warningNum);
list.add(map); list.add(map);
...@@ -232,13 +228,14 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -232,13 +228,14 @@ public class IdxBizPvHealthIndexController extends BaseController {
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计", notes = "预警监测设备级统计") @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "预警监测设备级统计", notes = "预警监测设备级统计")
@GetMapping(value = "/selectPointByANALYSISTYPE") @GetMapping(value = "/selectPointByANALYSISTYPE")
public ResponseModel<Map<String,Object>> selectPointByANALYSISTYPE(@RequestParam(required = false) String STATION, @RequestParam(required = false)String HEALTHLEVEL,@RequestParam(required = false) String EQUIPMENTNAME,@RequestParam(required = false)String POINTNAME,@RequestParam(required = false)String SUBARRAY,@RequestParam(required = false)String startTime,@RequestParam(required = false) String endTime) { public ResponseModel<Map<String, Object>> selectPointByANALYSISTYPE(@RequestParam(required = false) String STATION, @RequestParam(required = false) String HEALTHLEVEL, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(required = false) String POINTNAME, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
List<Map<String, Object>> maps = idxBizPvHealthIndexServiceImpl.selectPointByANALYSISTYPE(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME,SUBARRAY,startTime,endTime); List<Map<String, Object>> maps = idxBizPvHealthIndexServiceImpl.selectPointByANALYSISTYPE(STATION, HEALTHLEVEL, EQUIPMENTNAME, POINTNAME, SUBARRAY, startTime, endTime);
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
Collections.reverse(seriesData); Collections.reverse(seriesData);
...@@ -249,307 +246,315 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -249,307 +246,315 @@ public class IdxBizPvHealthIndexController extends BaseController {
axisData.add(map.get("REC_DATE")); axisData.add(map.get("REC_DATE"));
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result);} return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 光伏场站/设备列表通用接口", notes = "TD 光伏场站/设备列表通用接口") @ApiOperation(httpMethod = "GET", value = "TD 光伏场站/设备列表通用接口", notes = "TD 光伏场站/设备列表通用接口")
@GetMapping(value = "/pointHealthIndexTable") @GetMapping(value = "/pointHealthIndexTable")
public ResponseModel<Page> pointHealthIndexTable(@RequestParam(value = "area",required = false) String area, public ResponseModel<Page> pointHealthIndexTable(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "current",required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size",required = false) Integer size, @RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "subarray",required = false) String subarray){ @RequestParam(value = "subarray", required = false) String subarray) {
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL"; String orgCode = "NULL";
if(gatewayIds.size()>0){ if (gatewayIds.size() > 0) {
orgCode =gatewayIds.get(0)+"%"; orgCode = gatewayIds.get(0) + "%";
} }
if (requiredType.equals(WarningPeriodEnum.DAY.getName())){ if (requiredType.equals(WarningPeriodEnum.DAY.getName())) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9); Date date = DateUtils.dateAddHours(startDayTime, -9);
startTimeTop = DateUtil.format(date,DatePattern.NORM_DATETIME_PATTERN); startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, orgCode); List<PvHealthIndexDay> pvHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
int total = pvHealthIndexDayMapper.selectDataTotal(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, orgCode); int total = pvHealthIndexDayMapper.selectDataTotal(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexDays)){ if (CollectionUtils.isEmpty(pvHealthIndexDays)) {
fanHealthIndexDays = pvHealthIndexDayMapper.selectLatestData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, null, null, equipmentName, (current-1)*size,size,orgCode); pvHealthIndexDays = pvHealthIndexDayMapper.selectLatestData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, null, null, equipmentName, (current - 1) * size, size, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexDays)){ if (CollectionUtils.isEmpty(pvHealthIndexDays)) {
logger.warn("根据条件:area:{},station:{},equipmentName:{},subarray:{},pointName:{},analysisObjType:{}获取最新的数据为空",area,station,equipmentName,subarray,pointName,analysisObjType); logger.warn("根据条件:area:{},station:{},equipmentName:{},subarray:{},pointName:{},analysisObjType:{}获取最新的数据为空", area, station, equipmentName, subarray, pointName, analysisObjType);
total = 0; total = 0;
}else{ } else {
total = fanHealthIndexDays.size(); total = pvHealthIndexDays.size();
} }
} }
fanHealthIndexDays.forEach(item -> { pvHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
page.setRecords(fanHealthIndexDays); page.setRecords(pvHealthIndexDays);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
}else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())){ } else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())) {
Date date = new Date(); Date date = new Date();
date = DateUtil.offsetHour(date,-8); date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date,-59); date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date,DatePattern.NORM_DATETIME_PATTERN); startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, orgCode); List<PvHealthIndexHour> pvHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, orgCode);
int total = pvHealthIndexHourMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode); int total = pvHealthIndexHourMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexHours)){ if (CollectionUtils.isEmpty(pvHealthIndexHours)) {
fanHealthIndexHours = pvHealthIndexHourMapper.selectLatestData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, null, null, equipmentName, (current-1)*size,size,orgCode); pvHealthIndexHours = pvHealthIndexHourMapper.selectLatestData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, null, null, equipmentName, (current - 1) * size, size, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexHours)){ if (CollectionUtils.isEmpty(pvHealthIndexHours)) {
logger.warn("根据条件:area:{},station:{},equipmentName:{},subarray:{},pointName:{},analysisObjType:{}获取最新的数据为空",area,station,equipmentName,subarray,pointName,analysisObjType); logger.warn("根据条件:area:{},station:{},equipmentName:{},subarray:{},pointName:{},analysisObjType:{}获取最新的数据为空", area, station, equipmentName, subarray, pointName, analysisObjType);
total = 0; total = 0;
}else{ } else {
total = fanHealthIndexHours.size(); total = pvHealthIndexHours.size();
} }
} }
fanHealthIndexHours.forEach(item -> { pvHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
page.setRecords(fanHealthIndexHours); page.setRecords(pvHealthIndexHours);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
}else { } else {
Date date = DateUtils.dateAddMinutes(null,-9); Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8); date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, orgCode); List<PvHealthIndexMoment> pvHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, (current - 1) * size, size, orgCode);
int total = pvHealthIndexMomentMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode); int total = pvHealthIndexMomentMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexMoments)){ if (CollectionUtils.isEmpty(pvHealthIndexMoments)) {
fanHealthIndexMoments = pvHealthIndexMomentMapper.selectLatestData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, null, null, equipmentName, (current-1)*size,size,orgCode); pvHealthIndexMoments = pvHealthIndexMomentMapper.selectLatestData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, null, null, equipmentName, (current - 1) * size, size, orgCode);
if(CollectionUtils.isEmpty(fanHealthIndexMoments)){ if (CollectionUtils.isEmpty(pvHealthIndexMoments)) {
logger.warn("根据条件:area:{},station:{},equipmentName:{},subarray:{},pointName:{},analysisObjType:{}获取最新的数据为空",area,station,equipmentName,subarray,pointName,analysisObjType); logger.warn("根据条件:area:{},station:{},equipmentName:{},subarray:{},pointName:{},analysisObjType:{}获取最新的数据为空", area, station, equipmentName, subarray, pointName, analysisObjType);
total = 0; total = 0;
}else{ } else {
total = fanHealthIndexMoments.size(); total = pvHealthIndexMoments.size();
} }
} }
fanHealthIndexMoments.forEach(item -> { pvHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
Page page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
page.setRecords(fanHealthIndexMoments); page.setRecords(pvHealthIndexMoments);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "仪表盘", notes = "仪表盘") @ApiOperation(httpMethod = "GET", value = "仪表盘", notes = "仪表盘")
@GetMapping(value = "/pointHealthIndexTableByPanel") @GetMapping(value = "/pointHealthIndexTableByPanel")
public ResponseModel<Map<String, Object>> pointHealthIndexTableByPanel(@RequestParam(value = "area",required = false) String area, public ResponseModel<Map<String, Object>> pointHealthIndexTableByPanel(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "current",required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size",required = false) Integer size, @RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "subarray",required = false) String subarray){ @RequestParam(value = "subarray", required = false) String subarray) {
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL"; String orgCode = "NULL";
if(gatewayIds.size()>0){ if (gatewayIds.size() > 0) {
orgCode =gatewayIds.get(0)+"%"; orgCode = gatewayIds.get(0) + "%";
} }
if (requiredType.equals(WarningPeriodEnum.DAY.getName())){ if (requiredType.equals(WarningPeriodEnum.DAY.getName())) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9); Date date = DateUtils.dateAddHours(startDayTime, -9);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
List<PvHealthIndexDay> pvHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, requiredType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, orgCode); Map<String, Object> map = new HashMap<>();
Double value = 0.00;
Map<String,Object> map = new HashMap<>(); if (CollectionUtil.isNotEmpty(pvHealthIndexDays)) {
Double value=null; value = Double.parseDouble(df.format(pvHealthIndexDays.get(0).getHealthIndex()));
if(CollectionUtil.isNotEmpty(fanHealthIndexDays)){
value = Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex()));
} }
map.put("value", value); map.put("value", value);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())) {
}else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())){
Date date = new Date(); Date date = new Date();
date = DateUtil.offsetHour(date,-8); date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date,-59); date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date,DatePattern.NORM_DATETIME_PATTERN); startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, orgCode); List<PvHealthIndexHour> pvHealthIndexHours = pvHealthIndexHourMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Double value = 0.00;
if (CollectionUtil.isNotEmpty(pvHealthIndexHours)) {
map.put("value", Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex()))); value = Double.parseDouble(df.format(pvHealthIndexHours.get(0).getHealthIndex()));
}
map.put("value", value);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
}else { } else {
Date date = DateUtils.dateAddMinutes(null,-9); Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8); date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); startTimeTop = formatter.format(date);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, orgCode); List<PvHealthIndexMoment> pvHealthIndexMoment = pvHealthIndexMomentMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Double value = 0.00;
map.put("value", Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex()))); if (CollectionUtil.isNotEmpty(pvHealthIndexMoment)) {
value = Double.parseDouble(df.format(pvHealthIndexMoment.get(0).getHealthIndex()));
}
map.put("value", value);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "TD 光伏折线图", notes = "TD光伏折线图") @ApiOperation(httpMethod = "GET", value = "TD 光伏折线图", notes = "TD光伏折线图")
@GetMapping(value = "/pointHealthIndexTrend") @GetMapping(value = "/pointHealthIndexTrend")
public ResponseModel<Object> pointHealthIndexTrend(@RequestParam(value = "area",required = false) String area, public ResponseModel<Object> pointHealthIndexTrend(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType, @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "analysisType",required = false) String analysisType, @RequestParam(value = "analysisType", required = false) String analysisType,
@RequestParam(value = "endTimeTop",required = false) String endTimeTop, @RequestParam(value = "endTimeTop", required = false) String endTimeTop,
@RequestParam(value = "startTimeTop",required = false) String startTimeTop, @RequestParam(value = "startTimeTop", required = false) String startTimeTop,
@RequestParam(value = "indexAddress",required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "pointName",required = false) String pointName, @RequestParam(value = "pointName", required = false) String pointName,
@RequestParam(value = "equipmentName",required = false) String equipmentName, @RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "healthLevel",required = false) String healthLevel, @RequestParam(value = "healthLevel", required = false) String healthLevel,
@RequestParam(value = "type",required = false) String type, @RequestParam(value = "type", required = false) String type,
@RequestParam(value = "requiredType",required = false) String requiredType, @RequestParam(value = "requiredType", required = false) String requiredType,
@RequestParam(value = "current",required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size",required = false) Integer size, @RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "subarray",required = false) String subarray) { @RequestParam(value = "subarray", required = false) String subarray) {
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>(); List<Object> axisData = new ArrayList<>();
List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes(); List<String> gatewayIds = permissionService.getCurrentUserAmosOrgCodes();
String orgCode = "NULL"; String orgCode = "NULL";
if(gatewayIds.size()>0){ if (gatewayIds.size() > 0) {
orgCode =gatewayIds.get(0)+"%"; orgCode = gatewayIds.get(0) + "%";
} }
if (WarningPeriodEnum.DAY.getName().equals(requiredType)){ if (WarningPeriodEnum.DAY.getName().equals(requiredType)) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
if ( null != endTimeTop){ if (null != endTimeTop) {
Date endDate =DateUtils.dateParse(endTimeTop); Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
//处理空指针问题 如果为空差15天前数据 //处理空指针问题 如果为空差15天前数据
if(StrUtil.isEmpty(startTimeTop)){ if (StrUtil.isEmpty(startTimeTop)) {
startTimeTop = LocalDateTime.now().minusDays(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); startTimeTop = LocalDateTime.now().minusDays(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
} }
Date startDate = DateUtils.dateParse(startTimeTop); Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectTrendData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, null, null, orgCode); List<PvHealthIndexDay> pvHealthIndexDays = pvHealthIndexDayMapper.selectTrendData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, null, null, orgCode);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(PvHealthIndexDay::getRecDate)).collect(Collectors.toList()); pvHealthIndexDays = pvHealthIndexDays.stream().sorted(Comparator.comparing(PvHealthIndexDay::getRecDate)).collect(Collectors.toList());
for (PvHealthIndexDay obj : fanHealthIndexDays) { for (PvHealthIndexDay obj : pvHealthIndexDays) {
if (type.equals("0")){ if (type.equals("0")) {
seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex()))); seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex())));
}else { } else {
seriesData.add(obj.getAnomaly() > 7.5?7.5:dfSS.format(obj.getAnomaly())); seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly()));
} }
axisData.add(obj.getRecDate()); axisData.add(obj.getRecDate());
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)){ } else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)) {
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.dateParse(endTimeTop); Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
Date startDate = DateUtils.dateParse(startTimeTop); Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectTrendData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode); List<PvHealthIndexHour> pvHealthIndexHours = pvHealthIndexHourMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(PvHealthIndexHour::getRecDate)).collect(Collectors.toList()); pvHealthIndexHours = pvHealthIndexHours.stream().sorted(Comparator.comparing(PvHealthIndexHour::getRecDate)).collect(Collectors.toList());
for (PvHealthIndexHour obj : fanHealthIndexHours) { for (PvHealthIndexHour obj : pvHealthIndexHours) {
if (type.equals("0")){ if (type.equals("0")) {
seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex()))); seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex())));
}else { } else {
seriesData.add(obj.getAnomaly() > 7.5?7.5:dfSS.format(obj.getAnomaly())); seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly()));
} }
// Date dateTime = DateUtil.parseDateTime(obj.getAnalysisTime());
// String format = DateUtil.format(dateTime, "yyyy-MM-dd HH:00");
axisData.add(obj.getRecDate()); axisData.add(obj.getRecDate());
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}else { } else {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (null != endTimeTop) {
SimpleDateFormat formatterNYRSF = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if ( null != endTimeTop){
Date endDate = DateUtils.dateParse(endTimeTop); Date endDate = DateUtils.dateParse(endTimeTop);
endTimeTop = formatter.format(endDate); endTimeTop = formatter.format(endDate);
} }
Date startDate = DateUtils.dateParse(startTimeTop); Date startDate = DateUtils.dateParse(startTimeTop);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectTrendData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, orgCode); List<PvHealthIndexMoment> pvHealthIndexMoment = pvHealthIndexMomentMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, orgCode);
fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(PvHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList()); pvHealthIndexMoment = pvHealthIndexMoment.stream().sorted(Comparator.comparing(PvHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexMoment obj : fanHealthIndexMoments) { for (PvHealthIndexMoment obj : pvHealthIndexMoment) {
if (type.equals("0")){ if (type.equals("0")) {
seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex()))); seriesData.add(Double.parseDouble(df.format(obj.getHealthIndex())));
}else { } else {
seriesData.add(obj.getAnomaly() > 7.5?7.5:dfSS.format(obj.getAnomaly())); seriesData.add(obj.getAnomaly() > 7.5 ? 7.5 : dfSS.format(obj.getAnomaly()));
} }
// Date dateTime = DateUtil.parseDateTime(obj.getAnalysisTime());
// String format = DateUtil.format(dateTime, DatePattern.NORM_DATETIME_MINUTE_PATTERN);
axisData.add(obj.getRecDate()); axisData.add(obj.getRecDate());
} }
result.put("seriesData",seriesData); result.put("seriesData", seriesData);
result.put("axisData",axisData); result.put("axisData", axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
} }
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计 TD", notes = "预警监测设备级统计 TD") @ApiOperation(httpMethod = "GET", value = "预警监测设备级统计 TD", notes = "预警监测设备级统计 TD")
@GetMapping(value = "/selectPointNum") @GetMapping(value = "/selectPointNum")
public ResponseModel<List<Map<String,Object>>> selectPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String EQUIPMENTNAME) { public ResponseModel<List<Map<String, Object>>> selectPointNum(@RequestParam(required = false) String STATION, @RequestParam(required = false) String SUBARRAY, @RequestParam(required = false) String EQUIPMENTNAME, @RequestParam(value = "requiredType", required = false) String requiredType) {
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = pvHealthIndexDayMapper.selectEquipStatusByEquipment( "测点", STATION,EQUIPMENTNAME, SUBARRAY, gatewayIds); String startTimeTop;
if (maps.size() == 4){ List<Map<String, Object>> maps;
if (requiredType.equals(WarningPeriodEnum.DAY.getName())) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
maps = pvHealthIndexDayMapper.selectEquipStatusByEquipment("测点", STATION, EQUIPMENTNAME, SUBARRAY, gatewayIds,startTimeTop);
}else if (requiredType.equals(WarningPeriodEnum.HOUR.getName())) {
Date date = new Date();
date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
maps = pvHealthIndexHourMapper.selectEquipStatusByEquipment("测点", STATION, EQUIPMENTNAME, SUBARRAY, gatewayIds,startTimeTop);
} else {
Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
maps = pvHealthIndexMomentMapper.selectEquipStatusByEquipment("测点", STATION, EQUIPMENTNAME, SUBARRAY, gatewayIds,startTimeTop);
}
if (maps.size() == 4) {
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
} }
} else { } else {
List<String> levels = new ArrayList<>(); List<String> levels = new ArrayList<>();
...@@ -559,17 +564,17 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -559,17 +564,17 @@ public class IdxBizPvHealthIndexController extends BaseController {
levels.add("危险"); levels.add("危险");
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
String healthlevel = map.get("healthlevel").toString(); String healthlevel = map.get("healthlevel").toString();
levels.remove(healthlevel); levels.remove(healthlevel);
} }
if (levels.size()>0){ if (levels.size() > 0) {
for (String s : levels) { for (String s : levels) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name",s); map.put("name", s);
map.put("value",0); map.put("value", 0);
map.put("sort",HealthLevelSortEnum.getCode(s)); map.put("sort", HealthLevelSortEnum.getCode(s));
maps.add(map); maps.add(map);
} }
maps = maps.stream().sorted(Comparator.comparingLong(e -> Long.valueOf(e.get("sort").toString()))).collect(Collectors.toList()); maps = maps.stream().sorted(Comparator.comparingLong(e -> Long.valueOf(e.get("sort").toString()))).collect(Collectors.toList());
...@@ -579,43 +584,64 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -579,43 +584,64 @@ public class IdxBizPvHealthIndexController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/selectWarningPoint") @GetMapping(value = "/selectWarningPoint")
@ApiOperation(httpMethod = "GET", value = "预警监测设备右侧预警重复列表", notes = "预警监测设备右侧预警重复列表") @ApiOperation(httpMethod = "GET", value = "预警监测设备右侧预警重复列表", notes = "预警监测设备右侧预警重复列表")
public ResponseModel<Page<PvWarningRecord>> selectFanWarningNum(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam(required = false) String SUBARRAY,Integer current,Integer size) { public ResponseModel<Page<PvWarningRecord>> selectFanWarningNum(@RequestParam String STATION, @RequestParam String EQUIPMENTNAME, @RequestParam(required = false) String SUBARRAY, Integer current, Integer size) {
Page<PvWarningRecord> page = new Page<>(); Page<PvWarningRecord> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
List<PvWarningRecord> maps = pvWaringRecordMapper.selectWarningPoint(STATION,EQUIPMENTNAME,SUBARRAY,(current-1)*size,size, gatewayIds); List<PvWarningRecord> maps = pvWaringRecordMapper.selectWarningPoint(STATION, EQUIPMENTNAME, SUBARRAY, (current - 1) * size, size, gatewayIds);
page.setRecords(maps); page.setRecords(maps);
int total = pvWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME,SUBARRAY, gatewayIds); int total = pvWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME, SUBARRAY, gatewayIds);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/selectEquipWarningTotal") @GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本") @ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<Map<String,Object>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam(required = false) String SUBARRAY) { public ResponseModel<Map<String, Object>> selectEquipWarningTotal(@RequestParam String STATION, @RequestParam String EQUIPMENTNAME, @RequestParam(required = false) String SUBARRAY) {
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
Map<String, Object> map = pvWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME,SUBARRAY, gatewayIds); Map<String, Object> map = pvWaringRecordMapper.selectEquipWarningTotal(STATION, EQUIPMENTNAME, SUBARRAY, gatewayIds);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET",value = "查询场站下设备状态统计", notes = "查询场站下设备状态统计") @ApiOperation(httpMethod = "GET", value = "查询场站下设备状态统计", notes = "查询场站下设备状态统计")
@GetMapping (value = "/selectEquipStatusByStationPv") @GetMapping(value = "/selectEquipStatusByStationPv")
public ResponseModel<List<Map<String,Object>>> selectEquipStatusByStationPv(@RequestParam(value = "area",required = false) String area, public ResponseModel<List<Map<String, Object>>> selectEquipStatusByStationPv(@RequestParam(value = "area", required = false) String area,
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station", required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType @RequestParam(value = "analysisObjType", required = false) String analysisObjType,
@RequestParam(value = "requiredType", required = false) String requiredType
) { ) {
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = pvHealthIndexDayMapper.selectEquipStatusByStationPv(area, analysisObjType, station, gatewayIds); List<Map<String, Object>> maps;
if (maps.size() == 4){ String startTimeTop;
if (WarningPeriodEnum.DAY.getName().equals(requiredType)) {
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
maps = pvHealthIndexDayMapper.selectEquipStatusByStationPv(area, analysisObjType, station, gatewayIds,startTimeTop);
}else if (WarningPeriodEnum.HOUR.getName().equals(requiredType)) {
Date date = new Date();
date = DateUtil.offsetHour(date, -8);
date = DateUtil.offsetMinute(date, -59);
startTimeTop = DateUtil.format(date, DatePattern.NORM_DATETIME_PATTERN);
maps = pvHealthIndexHourMapper.selectEquipStatusByStationPv(area, analysisObjType, station, gatewayIds,startTimeTop);
}else{
Date date = DateUtils.dateAddMinutes(null, -9);
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
maps = pvHealthIndexMomentMapper.selectEquipStatusByStationPv(area, analysisObjType, station, gatewayIds,startTimeTop);
}
if (maps.size() == 4) {
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
} }
} else { } else {
...@@ -626,16 +652,16 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -626,16 +652,16 @@ public class IdxBizPvHealthIndexController extends BaseController {
levels.add("危险"); levels.add("危险");
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name", map.get("healthlevel"));
String healthlevel = map.get("healthlevel").toString(); String healthlevel = map.get("healthlevel").toString();
levels.remove(healthlevel); levels.remove(healthlevel);
} }
if (levels.size()>0){ if (levels.size() > 0) {
for (String s : levels) { for (String s : levels) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name",s); map.put("name", s);
map.put("value",0); map.put("value", 0);
map.put("sort", HealthLevelSortEnum.getCode(s)); map.put("sort", HealthLevelSortEnum.getCode(s));
maps.add(map); maps.add(map);
} }
...@@ -645,10 +671,10 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -645,10 +671,10 @@ public class IdxBizPvHealthIndexController extends BaseController {
return ResponseHelper.buildResponse(maps); return ResponseHelper.buildResponse(maps);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/selectFanWarningNum") @GetMapping(value = "/selectFanWarningNum")
@ApiOperation(httpMethod = "GET", value = "查询各风机预警状况", notes = "查询各风机预警状况") @ApiOperation(httpMethod = "GET", value = "查询各风机预警状况", notes = "查询各风机预警状况")
public ResponseModel<Map<String,Object>> selectFanWarningNum(@RequestParam String station) { public ResponseModel<Map<String, Object>> selectFanWarningNum(@RequestParam String station) {
LambdaQueryWrapper<IdxBizPvPointProcessVariableClassification> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvPointProcessVariableClassification> wrapper = new LambdaQueryWrapper<>();
...@@ -665,7 +691,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -665,7 +691,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
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 : maps) { for (Map<String, Object> map : maps) {
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()));
......
...@@ -50,23 +50,23 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { ...@@ -50,23 +50,23 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
@Select("<script>" + @Select("<script>" +
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= TODAY()-9h" + "SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" + "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" )GROUP BY station,health_level order by sort" + " )GROUP BY station,health_level order by sort" +
"</script>") "</script>")
List<Map<String, Object>> selectEquipStatusByStation(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds); List<Map<String, Object>> selectEquipStatusByStation(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
List<Map<String, Object>> getHealthInfoByArea(); List<Map<String, Object>> getHealthInfoByArea();
@Select("<script>" + @Select("<script>" +
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= TODAY()-8h" + "SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
" )GROUP BY station,health_level,equipment_name order by sort" + " )GROUP BY station,health_level,equipment_name order by sort" +
"</script>") "</script>")
List<Map<String, Object>> selectEquipStatusByEquipment(@Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName); List<Map<String, Object>> selectEquipStatusByEquipment( @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName,@Param("startTimeTop") String startTimeTop);
@Select("<script>" + @Select("<script>" +
"SELECT distinct `health_index` AS healthIndex,anomaly,rec_date as recDate, `health_index` AS `value`, substr(analysis_time,1,10) as analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( 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 org_code is not null" + "SELECT distinct `health_index` AS healthIndex,anomaly,rec_date as recDate, `health_index` AS `value`, substr(analysis_time,1,10) as analysisTime, station,equipment_name AS equipmentName,point_name as pointName, ( 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 org_code is not null" +
......
...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map;
public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> { public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> {
@Select("<script>" + @Select("<script>" +
...@@ -47,4 +48,22 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> ...@@ -47,4 +48,22 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour>
@Param("current") Integer current, @Param("size") Integer size, @Param("current") Integer current, @Param("size") Integer size,
@Param("orgCode") String orgCode @Param("orgCode") String orgCode
); );
@Select("<script>" +
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" )GROUP BY station,health_level order by sort" +
"</script>")
List<Map<String, Object>> selectEquipStatusByStation(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
@Select("<script>" +
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_hour WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
" )GROUP BY station,health_level,equipment_name order by sort" +
"</script>")
List<Map<String, Object>> selectEquipStatusByEquipment( @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName,@Param("startTimeTop") String startTimeTop);
} }
...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map;
public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMoment> { public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMoment> {
@Select("<script>" + @Select("<script>" +
...@@ -46,4 +47,22 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom ...@@ -46,4 +47,22 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom
@Param("current") Integer current, @Param("size") Integer size, @Param("current") Integer current, @Param("size") Integer size,
@Param("orgCode") String orgCode @Param("orgCode") String orgCode
); );
@Select("<script>" +
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" )GROUP BY station,health_level order by sort" +
"</script>")
List<Map<String, Object>> selectEquipStatusByStation(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
@Select("<script>" +
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.fan_health_index_moment WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
" )GROUP BY station,health_level,equipment_name order by sort" +
"</script>")
List<Map<String, Object>> selectEquipStatusByEquipment( @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName,@Param("startTimeTop") String startTimeTop);
} }
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2; package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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 com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndexDay;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
...@@ -59,24 +58,24 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -59,24 +58,24 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
int selectDataTotal(@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,@Param("orgCode") String orgCode); int selectDataTotal(@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,@Param("orgCode") String orgCode);
@Select("<script>"+ @Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= TODAY()-9h" + "SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='area!= null'> AND area = #{area} </if> " + "<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" + "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" ) GROUP BY station,health_level order by sort"+ " ) GROUP BY station,health_level order by sort"+
"</script>") "</script>")
List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area")String area, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("gatewayIds") List<String> gatewayIds); List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
@Select("<script>"+ @Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE health_level WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= TODAY()-8h" + "SELECT station, health_level as healthlevel,( CASE health_level WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if>" + "<if test='subarray!= null'>AND subarray = #{subarray} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" + "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" ) GROUP BY station,health_level,equipment_name order by sort"+ " ) GROUP BY station,health_level,equipment_name order by sort"+
"</script>") "</script>")
List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("equipmentName")String equipmentName, @Param("subarray") String subarray, @Param("gatewayIds") List<String> gatewayIds); List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName, @Param("subarray") String subarray, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
@Select("<script>"+ @Select("<script>"+
......
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2; package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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 com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndexHour; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndexHour;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map;
public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Select("<script>" +
@Select("<script>"+
"SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, anomaly, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex, `health_index` AS `value`, rec_date AS recDate, anomaly, 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 analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" +
"<if test='endTimeTop!= null'> and analysis_time &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and analysis_time &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " + "<if test='area!= null '> AND area = #{area} </if> " +
"<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " + "<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null '>AND point_name = #{pointName} </if> " + "<if test='pointName!= null '>AND point_name = #{pointName} </if> " +
...@@ -24,11 +24,22 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { ...@@ -24,11 +24,22 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" + "<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" +
// "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" + // "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index " + "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<PvHealthIndexHour> selectData(@Param("healthLevel") String healthLevel, @Param("area") String area, @Param("equipmentName") String equipmentName, @Param("subarray") String subarray, @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 List<PvHealthIndexHour> selectData(@Param("station")String station,
, @Param("current") Integer current, @Param("size") Integer size, @Param("orgCode") String orgCode); @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
, @Param("current")Integer current, @Param("size")Integer size,@Param("orgCode") String orgCode);
@Select("<script>" + @Select("<script>" +
"SELECT count(1)" + "SELECT count(1)" +
...@@ -130,4 +141,24 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { ...@@ -130,4 +141,24 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
@Param("endTimeTop")String endTimeTop, @Param("endTimeTop")String endTimeTop,
@Param("equipmentName")String equipmentName @Param("equipmentName")String equipmentName
, @Param("current")Integer current, @Param("size")Integer size,@Param("orgCode") String orgCode); , @Param("current")Integer current, @Param("size")Integer size,@Param("orgCode") String orgCode);
@Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" ) GROUP BY station,health_level order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
@Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE health_level WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" ) GROUP BY station,health_level,equipment_name order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName, @Param("subarray") String subarray, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
} }
...@@ -8,13 +8,15 @@ import org.apache.ibatis.annotations.Param; ...@@ -8,13 +8,15 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
import java.util.Map;
public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> { public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMoment> {
@Select("<script>" +
@Select("<script>"+
"SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, anomaly, analysis_time,station,equipment_name AS equipmentName, ( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status" + "SELECT `health_index` AS healthIndex,`health_index` AS `value`, rec_date AS recDate, anomaly, 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 analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_moment WHERE analysis_obj_type = #{analysisObjType} and org_code is not null" +
"<if test='endTimeTop!= null'> and analysis_time &lt;= #{endTimeTop} </if> " + "<if test='endTimeTop!= null'> and ts &lt;= #{endTimeTop} </if> " +
"<if test='startTimeTop!= null'> and analysis_time &gt;= #{startTimeTop} </if> " + "<if test='startTimeTop!= null'> and ts &gt;= #{startTimeTop} </if> " +
"<if test='area!= null '> AND area = #{area} </if> " + "<if test='area!= null '> AND area = #{area} </if> " +
"<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " + "<if test='indexAddress!= null '> AND index_address = #{indexAddress} </if> " +
"<if test='pointName!= null '>AND point_name = #{pointName} </if> " + "<if test='pointName!= null '>AND point_name = #{pointName} </if> " +
...@@ -22,13 +24,25 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen ...@@ -22,13 +24,25 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
//"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" + "<if test='orgCode!= null'>AND org_code like '${orgCode}' </if>" +
"order by health_index " + // "<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
List<PvHealthIndexMoment> selectData(@Param("healthLevel") String healthLevel, @Param("area") String area, @Param("equipmentName") String equipmentName, @Param("subarray") String subarray, @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 List<PvHealthIndexMoment> selectData(@Param("station")String station,
, @Param("current") Integer current, @Param("size") Integer size, @Param("orgCode") String orgCode); @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
, @Param("current")Integer current, @Param("size")Integer size,@Param("orgCode") String orgCode);
@Select("<script>" + @Select("<script>" +
"SELECT count(1)" + "SELECT count(1)" +
...@@ -127,4 +141,25 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen ...@@ -127,4 +141,25 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
@Param("endTimeTop")String endTimeTop, @Param("endTimeTop")String endTimeTop,
@Param("equipmentName")String equipmentName @Param("equipmentName")String equipmentName
, @Param("current")Integer current, @Param("size")Integer size,@Param("orgCode") String orgCode); , @Param("current")Integer current, @Param("size")Integer size,@Param("orgCode") String orgCode);
@Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" ) GROUP BY station,health_level order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area") String area, @Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
@Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE health_level WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM (select distinct station,health_level,equipment_name from analysis_data.pv_health_index_moment WHERE analysis_obj_type = #{analysisObjType} and org_code is not null AND ts >= #{startTimeTop}" +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" ) GROUP BY station,health_level,equipment_name order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType") String analysisObjType, @Param("station") String station, @Param("equipmentName") String equipmentName, @Param("subarray") String subarray, @Param("gatewayIds") List<String> gatewayIds, @Param("startTimeTop") String startTimeTop);
} }
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