123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- package com.gyee.alarm.controller;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.gyee.alarm.init.CacheContext;
- import com.gyee.alarm.model.auto.ProBasicEquipment;
- import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
- import com.gyee.alarm.model.auto.ProEconShutdownEvent2;
- import com.gyee.alarm.model.vo.AjaxResult;
- import com.gyee.alarm.model.vo.AjaxStatus;
- import com.gyee.alarm.service.auto.IProEconShutdownEvent2Service;
- import com.gyee.alarm.util.StringUtils;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * <p>
- * 停机事件2 前端控制器
- * </p>
- *
- * @author shilin
- * @since 2022-10-21
- */
- @RestController
- @RequestMapping("//shutdownevent2")
- public class ProEconShutdownEvent2Controller {
- @Resource
- private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
- @GetMapping(value = "/queryshutdowneventlist")
- @ApiOperation(value = "查询停机事件记录", notes = "查询停机事件记录")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "wtId", value = "设备编号", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "description", value = "故障描述 模糊查询", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "pageNum", value = "当前页号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "type", value = "类型(gz 故障、wh 维护)", required = true, dataType = "string", paramType = "query")
- })
- public AjaxResult queryshutdowneventlist(String wpId, String wtId,String description,String begin,String end,Integer pageNum, Integer pageSize,String type) {
- IPage<ProEconShutdownEvent2> vos=new Page<>();
- if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) && StringUtils.notEmp(pageNum) && StringUtils.notEmp(pageSize) && StringUtils.notEmp(type)) {
- vos=proEconShutdownEvent2Service.queryShutdownEvent2(wpId, wtId, description, begin, end, pageNum, pageSize,type);
- }
- for(ProEconShutdownEvent2 vo:vos.getRecords())
- {
- if(StringUtils.notEmp(vo.getWindturbineId()) && CacheContext.wtmap.containsKey(vo.getWindturbineId()))
- {
- vo.setCode(CacheContext.wtmap.get(vo.getWindturbineId()).getNemCode());
- }
- if(StringUtils.notEmp(vo.getWindturbineId()) && CacheContext.wtmap.containsKey(vo.getWindturbineId()))
- {
- vo.setWindturbineName(CacheContext.wtmap.get(vo.getWindturbineId()).getName());
- }
- }
- if (StringUtils.notEmp(vos)) {
- return AjaxResult.successData(AjaxStatus.success.code, vos);
- } else {
- return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
- }
- }
- @GetMapping(value = "/queryShutdownEvent2ByType")
- @ApiOperation(value = "停机记录按分类统计", notes = "停机记录按分类统计")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
- })
- public AjaxResult queryShutdownEvent2ByType(String wpId, String modelId,String begin,String end) throws ParseException {
- List<ProEconShutdownEvent2> vos=new ArrayList();
- if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
- Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
- Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
- vos=proEconShutdownEvent2Service.queryShutdownEvent2ByType(wpId, modelId,beginDate, endDate);
- }
- if (StringUtils.notEmp(vos)) {
- return AjaxResult.successData(AjaxStatus.success.code, vos);
- } else {
- return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
- }
- }
- @GetMapping(value = "/queryShutdownEvent2ByDay")
- @ApiOperation(value = "停机记录按日期统计", notes = "停机记录按日期统计")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
- })
- public AjaxResult queryShutdownEvent2ByDay(String wpId, String modelId,String begin,String end) throws ParseException {
- List<ProEconShutdownEvent2> vos=new ArrayList();
- if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
- Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
- Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
- vos=proEconShutdownEvent2Service.queryShutdownEvent2ByDay(wpId, modelId,beginDate, endDate);
- }
- if (StringUtils.notEmp(vos)) {
- return AjaxResult.successData(AjaxStatus.success.code, vos);
- } else {
- return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
- }
- }
- @GetMapping(value = "/queryShutdownEvent2ByMonth")
- @ApiOperation(value = "停机记录按日期统计", notes = "停机记录按日期统计")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
- })
- public AjaxResult queryShutdownEvent2ByMonth(String wpId, String modelId,String begin,String end) throws ParseException {
- List<ProEconShutdownEvent2> vos=new ArrayList();
- if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
- Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
- Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
- vos=proEconShutdownEvent2Service.queryShutdownEvent2ByMonth(wpId, modelId,beginDate, endDate);
- }
- if (StringUtils.notEmp(vos)) {
- return AjaxResult.successData(AjaxStatus.success.code, vos);
- } else {
- return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
- }
- }
- @GetMapping(value = "/queryShutdownEvent2ByMap")
- @ApiOperation(value = "非停机记录按统计", notes = "非停机记录按统计")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "modelId", value = "型号", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "begin", value = "开始时间", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "end", value = "结束时间", required = true, dataType = "string", paramType = "query")
- })
- public AjaxResult queryShutdownEvent2ByMap(String wpId, String modelId,String begin,String end) throws ParseException {
- Map<String,List<ProEconShutdownEvent2>> map=new HashMap<>();
- if (StringUtils.notEmp(begin) && StringUtils.notEmp(end) ) {
- Date beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(begin);
- Date endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(end);
- List<ProEconShutdownEvent2> vos=new ArrayList();
- vos=proEconShutdownEvent2Service.queryShutdownEvent2ByJX(wpId, modelId,beginDate, endDate);
- map.put("机械故障",vos);
- vos=proEconShutdownEvent2Service.queryShutdownEvent2ByDQ(wpId, modelId,beginDate, endDate);
- map.put("电气故障",vos);
- vos=proEconShutdownEvent2Service.queryShutdownEvent2ByOther(wpId, modelId,beginDate, endDate);
- map.put("其它",vos);
- }
- if (StringUtils.notEmp(map)) {
- return AjaxResult.successData(AjaxStatus.success.code, map);
- } else {
- return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
- }
- }
- }
|