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.*; /** *

* 停机事件2 前端控制器 *

* * @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 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 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 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 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> 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 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"); } } }