Browse Source

长停分析

wangchangsheng 2 years ago
parent
commit
5ed01676b9

+ 40 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/warn/ShutdowneventController.java

@@ -68,4 +68,44 @@ public class ShutdowneventController {
     }
 
 
+    /**
+     * 长停分析
+     * @param tablepar
+     * @param wpId
+     * @param wtId
+     * @param beginDate
+     * @param endDate
+     * @param type
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/getLonShutdownevent")
+    @ResponseBody
+    @ApiOperation(value = "长停事件查询", notes = "长停事件查询")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "tablepar", value = "分页控件", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "类型", required = false, dataType = "string", paramType = "query")})
+    public AjaxResult getLonShutdownevent(@RequestBody  Tablepar tablepar, String wpId, String wtId, String beginDate, String endDate, String type) throws Exception {
+
+        PageInfo<ShutdowneventVo> result=new PageInfo<>() ;
+        if (StringUtils.notEmp(tablepar) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
+
+            result=shutdowneventService.getLongShutdownevent(tablepar, wpId, wtId, DateUtils.parseDate(beginDate), DateUtils.parseDate(endDate), type);
+
+        }
+        if (null != result) {
+            return AjaxResult.successData(AjaxStatus.success.code, result);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, result);
+        }
+
+    }
+
+
+
+
 }

+ 81 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/ShutdowneventService.java

@@ -546,4 +546,85 @@ public class ShutdowneventService implements BaseService<Shutdownevent, Shutdown
 
 	}
 
+	public PageInfo<ShutdowneventVo> getLongShutdownevent(Tablepar tablepar,String wpId,String wtId, Date beginDate, Date endDate,String type)  {
+
+		PageInfo<ShutdowneventVo> pageInfo=new PageInfo<>();
+		List<Shutdownevent> list =new ArrayList<>();
+		ShutdowneventExample example=new ShutdowneventExample();
+		String order =null;
+		if(StringUtils.isNotEmpty(tablepar.getOrderByColumn()))
+		{
+			StringBuilder sb=new StringBuilder();
+			sb.append(" ").append(tablepar.getOrderByColumn());
+			if(StringUtils.isNotEmpty(tablepar.getIsAsc()))
+			{
+				sb.append(" ").append(tablepar.getIsAsc());
+			}else
+			{
+				sb.append(" asc ");
+			}
+			order=String.valueOf(sb);
+		}else {
+			order=" stoptime desc";
+		}
+
+		ShutdowneventExample.Criteria criteria =example.createCriteria();
+
+		if(StringUtils.isNotEmpty(wpId))
+		{
+			criteria.andWindpowerstationidEqualTo(wpId);
+		}
+		if(StringUtils.isNotEmpty(wtId))
+		{
+			criteria.andWindturbineidEqualTo(wtId);
+		}
+
+		if(StringUtils.isNotEmpty(type))
+		{
+			criteria.andStatuscodeEqualTo(Integer.valueOf(type));
+		}
+
+		criteria.andStophoursGreaterThanOrEqualTo(168.00);//长停168小时
+
+		criteria.andStoptimeGreaterThanOrEqualTo(beginDate).andStoptimeLessThanOrEqualTo(endDate);
+
+
+		PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+		list= shutdowneventMapper.selectByExample(example);
+		List<ShutdowneventVo> sdelist=new ArrayList<>();
+
+
+		if(null!=list && !list.isEmpty())
+		{
+			for(Shutdownevent sde:list)
+			{
+				ShutdowneventVo event = new ShutdowneventVo();
+				event.setId(sde.getId());
+
+				event.setWindPowerStationId(sde.getWindpowerstationid());
+				event.setWpName(InitialRunner.wpmap.get(sde.getWindpowerstationid()).getName());
+				event.setWindTurbineId(sde.getWindturbineid());
+				event.setWtName(InitialRunner.wtmap.get(sde.getWindturbineid()).getCode());
+				event.setWarningId(sde.getWarningid());
+
+				if(InitialRunner.stoptypemap.containsKey(sde.getStoptypeid()))
+				{
+					Stoptype stoptype=InitialRunner.stoptypemap.get(sde.getStoptypeid());
+					event.setWarnDesc(stoptype.getName());
+				}
+				event.setStartTime(sde.getStarttime());
+				event.setStopTime(sde.getStoptime());
+				event.setStopHours(sde.getStophours());
+				event.setStopTypeId(sde.getStoptypeid());
+				event.setStatusCode(sde.getStatuscode());
+				sdelist.add(event);
+			}
+
+			pageInfo = new PageInfo<ShutdowneventVo>(sdelist);
+
+		}
+		return pageInfo;
+
+	}
+
 }