Browse Source

等级评估日月年接口

shilin 4 years ago
parent
commit
7decfd635d

+ 11 - 0
src/main/java/com/gyee/frame/common/conf/AjaxStatus.java

@@ -0,0 +1,11 @@
+package com.gyee.frame.common.conf;
+
+public enum  AjaxStatus {
+    success(200),
+    error(500),
+    emptyresultset(300);
+    public int code;
+    AjaxStatus(int c) {
+        code = c;
+    }
+}

+ 129 - 0
src/main/java/com/gyee/frame/controller/benchmarking/BenchmarkingController.java

@@ -0,0 +1,129 @@
+package com.gyee.frame.controller.benchmarking;
+
+import com.github.pagehelper.PageInfo;
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.auto.Windturbineinfodaytop3;
+import com.gyee.frame.model.custom.Tablepar;
+import com.gyee.frame.model.custom.ValueVo;
+import com.gyee.frame.service.Windturbineinfodaytop3Service;
+import com.gyee.frame.util.DateUtils;
+import com.gyee.frame.util.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.util.Date;
+import java.util.List;
+
+@Controller
+@RequestMapping("/benchmarking")
+public class BenchmarkingController {
+    @Autowired
+    private Windturbineinfodaytop3Service windturbineinfodaytop3Service;
+
+    /**查询等级评估日所有信息**/
+    @GetMapping("/gadaylist")
+    @ResponseBody
+    public AjaxResult gadaylist(String wpId, String recorddate) {
+
+        Date tempDate=null;
+        if (StringUtils.isNotEmpty(recorddate))
+        {
+            tempDate=DateUtils.parseDate(recorddate);
+        }
+        List<Windturbineinfodaytop3> ls=windturbineinfodaytop3Service.gadaylist(wpId,tempDate);
+
+        if(ls !=null && !ls.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,ls);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.emptyresultset.code,ls);
+        }
+
+    }
+    /**按页查询等级评估日所有信息**/
+    @PostMapping("/gadaylistByPage")
+    @ResponseBody
+    public AjaxResult gadaylistByPage(Tablepar tablepar,String wpId, String recorddate) {
+
+        Date tempDate=null;
+        if (StringUtils.isNotEmpty(recorddate))
+        {
+            tempDate=DateUtils.parseDate(recorddate);
+        }
+        PageInfo<Windturbineinfodaytop3> ls=windturbineinfodaytop3Service.gadaylistByPage(tablepar,wpId,tempDate);
+
+        return	AjaxResult.successData(AjaxStatus.success.code,ls);
+
+    }
+    /**按页查询等级评估月所有信息**/
+    @PostMapping("/gamonthlistByPage")
+    @ResponseBody
+    public AjaxResult gamonthlistByPage(Tablepar tablepar,String wpId, String year,String month) {
+
+
+        PageInfo<Windturbineinfodaytop3> ls=windturbineinfodaytop3Service.gamonthlistByPage(tablepar,wpId,year,month);
+
+        return	AjaxResult.successData(AjaxStatus.success.code,ls);
+
+    }
+    /**按页查询等级评估年所有信息**/
+    @PostMapping("/gayearlistByPage")
+    @ResponseBody
+    public AjaxResult gayearlistByPage(Tablepar tablepar,String wpId, String year) {
+
+
+        PageInfo<Windturbineinfodaytop3> ls=windturbineinfodaytop3Service.gayearlistByPage(tablepar,wpId,year);
+
+        return	AjaxResult.successData(AjaxStatus.success.code,ls);
+
+    }
+    /**按等级评估ID查询相应信息返回玫瑰图**/
+    @GetMapping("/wtchart")
+    @ResponseBody
+    public AjaxResult wtchart(String gaid) {
+
+
+        if (StringUtils.isNotEmpty(gaid))
+        {
+            List<ValueVo> ls=windturbineinfodaytop3Service.wtchart(gaid);
+
+            if( !ls.isEmpty())
+            {
+                return	AjaxResult.successData(AjaxStatus.success.code,ls);
+            }else
+            {
+                return	AjaxResult.successData(AjaxStatus.emptyresultset.code,ls);
+            }
+        }
+
+         return	AjaxResult.error(AjaxStatus.error.code,null);
+    }
+
+    /**按等级评估ID查询相应详细信息**/
+    @GetMapping("/wtinfo")
+    @ResponseBody
+    public AjaxResult wtinfo(String gaid) {
+
+
+        if (StringUtils.isNotEmpty(gaid))
+        {
+            Windturbineinfodaytop3 wtd=windturbineinfodaytop3Service.selectByPrimaryKey(gaid);
+
+            if( null!=wtd)
+            {
+                return	AjaxResult.successData(AjaxStatus.success.code,wtd);
+            }else
+            {
+                return	AjaxResult.successData(AjaxStatus.emptyresultset.code,wtd);
+            }
+        }
+
+        return	AjaxResult.error(AjaxStatus.error.code,null);
+    }
+}

File diff suppressed because it is too large
+ 189 - 190
src/main/java/com/gyee/frame/model/auto/Windturbineinfodaytop3.java


File diff suppressed because it is too large
+ 631 - 631
src/main/java/com/gyee/frame/model/auto/Windturbineinfodaytop3Example.java


+ 70 - 0
src/main/java/com/gyee/frame/model/custom/ValueVo.java

@@ -0,0 +1,70 @@
+package com.gyee.frame.model.custom;
+
+public class ValueVo {
+	private String name;
+	private String value;
+	private Double data1;
+
+	private String warningId;
+	private String shutdowneventId;
+	private String wpId;
+	private String wtId;
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Double getData1() {
+		return data1;
+	}
+
+	public void setData1(Double data1) {
+		this.data1 = data1;
+	}
+
+	public String getWarningId() {
+		return warningId;
+	}
+
+	public void setWarningId(String warningId) {
+		this.warningId = warningId;
+	}
+
+	public String getShutdowneventId() {
+		return shutdowneventId;
+	}
+
+	public void setShutdowneventId(String shutdowneventId) {
+		this.shutdowneventId = shutdowneventId;
+	}
+
+	public String getWpId() {
+		return wpId;
+	}
+
+	public void setWpId(String wpId) {
+		this.wpId = wpId;
+	}
+
+	public String getWtId() {
+		return wtId;
+	}
+
+	public void setWtId(String wtId) {
+		this.wtId = wtId;
+	}
+
+	
+}

+ 218 - 1
src/main/java/com/gyee/frame/service/Windturbineinfodaytop3Service.java

@@ -8,11 +8,14 @@ import com.gyee.frame.mapper.auto.Windturbineinfodaytop3Mapper;
 import com.gyee.frame.model.auto.Windturbineinfodaytop3;
 import com.gyee.frame.model.auto.Windturbineinfodaytop3Example;
 import com.gyee.frame.model.custom.Tablepar;
-
+import com.gyee.frame.model.custom.ValueVo;
+import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -127,6 +130,220 @@ public class Windturbineinfodaytop3Service implements BaseService<Windturbineinf
 	}
 
 
+	public PageInfo<Windturbineinfodaytop3> gadaylistByPage(Tablepar tablepar,String wpId, Date recorddate)  {
+		List<Windturbineinfodaytop3> list=null;
+
+		Windturbineinfodaytop3Example example=new Windturbineinfodaytop3Example();
+		example.setOrderByClause("windturbineid ASC");
+
+		PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+
+		if(recorddate!=null &&  StringUtils.isNotEmpty(wpId)){
+
+
+			example.createCriteria().andWindpowerstationidEqualTo(wpId).andTypeEqualTo(1).andRecorddateGreaterThanOrEqualTo(recorddate).andRecorddateLessThan(DateUtils.addDays(recorddate,1));
+			list= windturbineinfodaytop3Mapper.selectByExample(example);
+		}else
+		{
+			list=new ArrayList<>();
+		}
+		PageInfo<Windturbineinfodaytop3> pageInfo = new PageInfo<Windturbineinfodaytop3>(list);
+
+		return pageInfo;
+	}
+
+
+	public PageInfo<Windturbineinfodaytop3> gamonthlistByPage(Tablepar tablepar,String wpId, String year,String month)  {
+		List<Windturbineinfodaytop3> list=null;
+
+		Windturbineinfodaytop3Example example=new Windturbineinfodaytop3Example();
+		example.setOrderByClause("windturbineid ASC");
+
+		PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+
+		if(StringUtils.isNotEmpty(year) && StringUtils.isNotEmpty(month) &&  StringUtils.isNotEmpty(wpId)){
+
+
+			example.createCriteria().andWindpowerstationidEqualTo(wpId).andTypeEqualTo(2).andYearEqualTo(Integer.valueOf(year)).andMonthEqualTo(Integer.valueOf(month));
+			list= windturbineinfodaytop3Mapper.selectByExample(example);
+		}else
+		{
+			list=new ArrayList<>();
+		}
+		PageInfo<Windturbineinfodaytop3> pageInfo = new PageInfo<Windturbineinfodaytop3>(list);
+
+		return pageInfo;
+	}
+
+
+	public PageInfo<Windturbineinfodaytop3> gayearlistByPage(Tablepar tablepar,String wpId,String year)  {
+		List<Windturbineinfodaytop3> list=null;
+
+		Windturbineinfodaytop3Example example=new Windturbineinfodaytop3Example();
+		example.setOrderByClause("windturbineid ASC");
+
+		PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+
+		if(StringUtils.isNotEmpty(wpId) &&  StringUtils.isNotEmpty(year)){
+
+
+			example.createCriteria().andWindpowerstationidEqualTo(wpId).andTypeEqualTo(3).andYearEqualTo(Integer.valueOf(year));
+			list= windturbineinfodaytop3Mapper.selectByExample(example);
+		}else
+		{
+			list=new ArrayList<>();
+		}
+		PageInfo<Windturbineinfodaytop3> pageInfo = new PageInfo<Windturbineinfodaytop3>(list);
+
+		return pageInfo;
+	}
+	/******************************************************************************************************************/
+	public List<Windturbineinfodaytop3> gadaylist(String wpId, Date recorddate)  {
+		List<Windturbineinfodaytop3> list=null;
+
+		Windturbineinfodaytop3Example example=new Windturbineinfodaytop3Example();
+		example.setOrderByClause("windturbineid ASC");
+
+		if(recorddate!=null &&  StringUtils.isNotEmpty(wpId)){
+
+
+			example.createCriteria().andWindpowerstationidEqualTo(wpId).andTypeEqualTo(1).andRecorddateGreaterThanOrEqualTo(recorddate).andRecorddateLessThan(DateUtils.addDays(recorddate,1));
+			list= windturbineinfodaytop3Mapper.selectByExample(example);
+		}else
+		{
+			list=new ArrayList<>();
+		}
+
+
+		return list;
+	}
+
+	public List<Windturbineinfodaytop3> gamonthlist(String wpId, String year,String month)  {
+		List<Windturbineinfodaytop3> list=null;
+
+		Windturbineinfodaytop3Example example=new Windturbineinfodaytop3Example();
+		example.setOrderByClause("windturbineid ASC");
+
+		if(StringUtils.isNotEmpty(year) && StringUtils.isNotEmpty(month) &&  StringUtils.isNotEmpty(wpId)){
+
+
+			example.createCriteria().andWindpowerstationidEqualTo(wpId).andTypeEqualTo(2).andYearEqualTo(Integer.valueOf(year)).andMonthEqualTo(Integer.valueOf(month));
+			list= windturbineinfodaytop3Mapper.selectByExample(example);
+		}else
+		{
+			list=new ArrayList<>();
+		}
+
+
+		return list;
+	}
+
+	public List<Windturbineinfodaytop3> gayearlist(String wpId, String year)  {
+		List<Windturbineinfodaytop3> list=null;
+
+		Windturbineinfodaytop3Example example=new Windturbineinfodaytop3Example();
+		example.setOrderByClause("windturbineid ASC");
+
+		if(StringUtils.isNotEmpty(wpId) &&  StringUtils.isNotEmpty(year)){
+
+
+			example.createCriteria().andWindpowerstationidEqualTo(wpId).andTypeEqualTo(3).andYearEqualTo(Integer.valueOf(year));
+			list= windturbineinfodaytop3Mapper.selectByExample(example);
+		}else
+		{
+			list=new ArrayList<>();
+		}
+
+
+		return list;
+	}
+	/******************************************************************************************************************/
+	public List<ValueVo> wtchart(String gaid) {
+
+
+		if (StringUtils.isNotEmpty(gaid)) {
+			List<ValueVo> vos = new ArrayList<ValueVo>();
+
+			Windturbineinfodaytop3 wtd = windturbineinfodaytop3Mapper.selectByPrimaryKey(Integer.valueOf(gaid));
+
+			for (int i = 0; i < 10; i++) {
+				ValueVo vo = new ValueVo();
+
+				switch (i) {
+					case 0:
+						// vo.setName("N("+winfo.getN4()+"/"+winfo.getN()+")");
+						vo.setName("平均切入风速");
+						// vo.setData1(wtd.getMonthxfqr());
+						vo.setData1(wtd.getYearxfqr());
+						break;
+					case 1:
+						// vo.setName("NNE("+winfo.getNne4()+"/"+winfo.getNne()+")");
+						vo.setName("性能损失电量");
+						// vo.setData1(wtd.getMonthxnssdl());
+						vo.setData1(wtd.getYearxnssdl());
+						break;
+					case 2:
+						// vo.setName("NE("+winfo.getNe4()+"/"+winfo.getNe()+")");
+						vo.setName("拟合优度");
+						// vo.setData1(wtd.getMonthnhyd());
+						vo.setData1(wtd.getYearnhyd());
+						break;
+					case 3:
+						// vo.setName("ENE("+winfo.getEne4()+"/"+winfo.getEne()+")");
+						vo.setName("功率一致性系数");
+						// vo.setData1(wtd.getMonthglyzxxs());
+						vo.setData1(wtd.getYearglyzxxs());
+						break;
+					case 4:
+						// vo.setName("E("+winfo.getE4()+"/"+winfo.getE()+")");
+						vo.setName("利用小时");
+						// vo.setData1(wtd.getMonthlyxs());
+						vo.setData1(wtd.getYearlyxs());
+						break;
+					case 5:
+						// vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
+						vo.setName("设备可利用率");
+						// vo.setData1(wtd.getMonthsbklyl());
+						vo.setData1(wtd.getYearsbklyl());
+						break;
+					case 6:
+						// vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
+						vo.setName("等效可利用系数");
+						// vo.setData1(wtd.getMonthdxkyxs());
+						vo.setData1(wtd.getYeardxkyxs());
+						break;
+					case 7:
+						// vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
+						vo.setName("有效风时数");
+						// vo.setData1(wtd.getMonthyxfss());
+						vo.setData1(wtd.getYearyxfss());
+						break;
+					case 8:
+						// vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
+						vo.setName("平均风速");
+						// vo.setData1(wtd.getMonthdxkyxs());
+						vo.setData1(wtd.getYeardxkyxs());
+						break;
+					case 9:
+						// vo.setName("ESE("+winfo.getEse()+"/"+winfo.getEse()+")");
+						vo.setName("静风频率");
+						// vo.setData1(wtd.getMonthdxkyxs());
+						vo.setData1(wtd.getYeardxkyxs());
+						break;
+					default:
+						break;
+				}
+
+				vos.add(vo);
+
+			}
+
+		return	vos;
+
+		}
 
+		return new ArrayList<>();
+	}
 
+	
 }

+ 61 - 0
src/test/java/test/BenchmarkingTest.java

@@ -0,0 +1,61 @@
+package test;
+
+import com.github.pagehelper.PageInfo;
+import com.gyee.SpringbootStart;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.common.spring.SpringUtils;
+import com.gyee.frame.controller.benchmarking.BenchmarkingController;
+import com.gyee.frame.model.auto.Windturbineinfodaytop3;
+import com.gyee.frame.model.custom.Tablepar;
+import lombok.SneakyThrows;
+import org.springframework.boot.SpringApplication;
+
+import java.util.Calendar;
+import java.util.Date;
+
+public class BenchmarkingTest {
+
+    @SneakyThrows
+    public static void main(String[] args) {
+
+        SpringApplication.run(SpringbootStart.class, args);
+
+
+        Calendar c = Calendar.getInstance();
+
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+
+        c.set(Calendar.DAY_OF_MONTH,1);
+        c.set(Calendar.MONTH,0);
+        c.set(Calendar.YEAR,2021);
+
+        Date beginDate = c.getTime();
+
+        String wpid="MHS_FDC";
+
+        BenchmarkingController dayBenchmarkingController= SpringUtils.getBean("dayBenchmarkingController");
+//
+//        AjaxResult ajaxResult = dayBenchmarkingController.gadaylist(wpid,"2021-01-01");
+//
+//        List<Windturbineinfodaytop3> test=(List<Windturbineinfodaytop3>)ajaxResult.get("data");
+
+        Tablepar tablepar=new Tablepar();
+        tablepar.setPageNum(1);
+        tablepar.setPageSize(10);
+
+        AjaxResult ajaxResult = dayBenchmarkingController.gadaylistByPage(tablepar,wpid,"2021-01-01");
+
+        PageInfo<Windturbineinfodaytop3> test=(PageInfo<Windturbineinfodaytop3>)ajaxResult.get("data");
+        for(Windturbineinfodaytop3 wtd:test.getList())
+        {
+            System.out.println(wtd.getWindturbineid()+"----------------"+wtd.getDayfdl());
+        }
+        //System.out.println(test);
+    }
+
+
+
+
+}