| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- package com.gyee.runeconomy.controller;
- import com.gyee.runeconomy.dto.R;
- import com.gyee.runeconomy.dto.ResultMsg;
- import com.gyee.runeconomy.model.vo.SingleAnalysisVo;
- import com.gyee.runeconomy.service.singleanalysis.SingleAnalysisService;
- import com.gyee.runeconomy.util.DateUtils;
- import com.gyee.runeconomy.util.StringUtils;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import javax.annotation.Resource;
- import java.util.*;
- @Controller
- @RequestMapping("/singleanalysis")
- @Api(value = "单机性能分析" ,tags="单机性能分析")
- public class SingleAnalysisController {
- @Resource
- private SingleAnalysisService singleAnalysisService;
- @PostMapping("/singleanalysisMain")
- @ResponseBody
- @ApiOperation(value = "查询单机性能分析首页", notes = "查询单机性能分析首页")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
- @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
- @ApiImplicitParam(name = "cmId", value = "公司编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "type", value = "光伏(-2)/风场(-1)", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})
- public R singleanalysisMain(Integer pageNum, Integer pageSize,String cmId,String type, String wpId, String year, String month) throws Exception {
- List<SingleAnalysisVo> vos =new ArrayList<>();
- if (StringUtils.notEmp(wpId) && StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
- Calendar cal = Calendar.getInstance();
- int newyear=cal.get(Calendar.YEAR);
- int newmonth=cal.get(Calendar.MONTH)+1;
- Date recordDate=null;
- if(Integer.valueOf(year)==newyear && Integer.valueOf(month) == newmonth)
- {
- cal.add(Calendar.DAY_OF_MONTH,-1);
- recordDate= DateUtils.truncate(cal.getTime());
- }else
- {
- cal.set(Calendar.YEAR,Integer.valueOf(year));
- cal.set(Calendar.MONTH,Integer.valueOf(month)-1);
- cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
- recordDate= DateUtils.truncate(cal.getTime());
- }
- vos =singleAnalysisService.SingleAnalysisList(pageNum, pageSize,cmId,type, wpId,recordDate);
- }
- return R.data(ResultMsg.ok(vos));
- }
- /**
- * 单机信息总览子页面
- * @param wtId
- * @param year
- * @param month
- * @return
- * @throws Exception
- */
- @GetMapping("/singleanalysisSub")
- @ResponseBody
- @ApiOperation(value = "查询单机性能分析子页面", notes = "查询单机性能分析子页面")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})
- public R singleanalysisSub(String wtId, String year, String month) throws Exception {
- Map<String,Object> map=new HashMap<>();
- if (StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
- Calendar cal = Calendar.getInstance();
- int newyear=cal.get(Calendar.YEAR);
- int newmonth=cal.get(Calendar.MONTH)+1;
- Date recordDate=null;
- if(Integer.valueOf(year)==newyear && Integer.valueOf(month) == newmonth)
- {
- cal.add(Calendar.DAY_OF_MONTH,-1);
- recordDate= DateUtils.truncate(cal.getTime());
- }else
- {
- cal.set(Calendar.YEAR,Integer.valueOf(year));
- cal.set(Calendar.MONTH,Integer.valueOf(month)-1);
- cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
- recordDate= DateUtils.truncate(cal.getTime());
- }
- SingleAnalysisVo byzb =singleAnalysisService.SingleAnalysisListByWtId(wtId,recordDate);
- cal.add(Calendar.YEAR,-1);
- Date lastYear=DateUtils.truncate(cal.getTime());
- SingleAnalysisVo tqzb =singleAnalysisService.SingleAnalysisListByWtId(wtId,lastYear);
- SingleAnalysisVo tbzb =singleAnalysisService.SingleAnalysisListByWtId(byzb,tqzb);
- cal.setTime(recordDate);
- cal.add(Calendar.MONTH,-1);
- Date lastMonth=DateUtils.truncate(cal.getTime());
- SingleAnalysisVo hqzb =singleAnalysisService.SingleAnalysisListByWtId(wtId,lastMonth);
- SingleAnalysisVo hbzb =singleAnalysisService.SingleAnalysisListByWtId(byzb,hqzb);
- map.put("byzb",byzb);//本月指标
- map.put("tqzb",tqzb);//全年同期
- map.put("tbzb",tbzb);//同比指标
- map.put("hqzb",hqzb);//上月同期
- map.put("hbzb",hbzb);//环比指标
- }
- // if (null!=map) {
- // return AjaxResult.successData(ResultCode.SUCCESS, map);
- // } else {
- // return AjaxResult.successData(ResultCode.SUCCESS, map);
- // }
- return R.data(ResultMsg.ok(map));
- }
- /**
- * 单机信息总览图表接口(3个)
- * @param wtId
- * @param year
- * @param month
- * @return
- * @throws Exception
- */
- @GetMapping("/singleanalysisChart")
- @ResponseBody
- @ApiOperation(value = "单机信息总览图表接口(3个) 发电量和风速、五项损失、静风频率和待机时间", notes = "单机信息总览图表接口(3个) 发电量和风速、五项损失、静风频率和待机时间")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "string", paramType = "query"),
- @ApiImplicitParam(name = "month", value = "月份", required = true, dataType = "string", paramType = "query")})
- public R singleanalysisChart(String wtId, String year, String month) throws Exception {
- Map<String,List<SingleAnalysisVo>> map =new HashMap<>();
- if (StringUtils.notEmp(wtId) && StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
- Calendar cal = Calendar.getInstance();
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MILLISECOND,0);
- cal.set(Calendar.YEAR, Integer.valueOf(year));
- cal.set(Calendar.MONTH, Integer.valueOf(month) - 1);
- cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
- Date beginDate = cal.getTime();
- cal.add(Calendar.MONTH, 1);
- Date endDate = cal.getTime();
- map =singleAnalysisService.SingleAnalysisListByWtIdDetiml(wtId,beginDate,endDate);
- }
- // map.put("ff",fdlfsls);//发电量和风速
- // map.put("ws",wsls);//五项损失,绑定五个
- // map.put("jd",jfpldjsjls);//静风频率和待机时间
- // if (null!=map) {
- // return AjaxResult.successData(ResultCode.SUCCESS, map);
- // } else {
- // return AjaxResult.successData(ResultCode.SUCCESS, map);
- // }
- return R.data(ResultMsg.ok(map));
- }
- }
|