Browse Source

Merge branch 'master' of http://49.4.49.126:3000/Gyee_web/Gyee_sis_phone

wangjiawen 4 years ago
parent
commit
17b93eada5

+ 185 - 0
src/main/java/com/gyee/frame/service/WindpowerinfodayService.java

@@ -0,0 +1,185 @@
+package com.gyee.frame.service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.mapper.auto.WindpowerinfodayMapper;
+import com.gyee.frame.model.auto.Windpowerinfoday;
+import com.gyee.frame.model.auto.WindpowerinfodayExample;
+import com.gyee.frame.model.custom.Tablepar;
+import com.gyee.frame.netty.websocket.util.SocketToolService;
+import com.gyee.frame.util.DateUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *  WeatherfdService
+ * @Title: WeatherfdService.java 
+ * @Package com.gyee.frame.service 
+ * @author Wang Jiawen_自动生成
+ * @email 1@qq.com
+ * @date 2020-01-07 16:13:24  
+ **/
+@Service
+public class WindpowerinfodayService extends SocketToolService implements BaseService<Windpowerinfoday, WindpowerinfodayExample>{
+	@Resource
+	private WindpowerinfodayMapper windpowerinfodayMapper;
+	
+      	   	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	
+	/**
+	 * 分页查询
+	 * @param windpowerstationid
+	 * @return
+	 */
+	 public PageInfo<Windpowerinfoday> list(Tablepar tablepar,String name,String windpowerstationid) throws ParseException {
+		    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		    Date recodedate = sdf.parse(name);
+	        WindpowerinfodayExample testExample=new WindpowerinfodayExample();
+	        testExample.setOrderByClause("id ASC");
+	        if(name!=null&&!"".equals(name)){
+				testExample.createCriteria().andRecorddateEqualTo(recodedate);
+	        }
+
+	        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+	        List<Windpowerinfoday> list= windpowerinfodayMapper.selectByExample(testExample);
+	        for(Windpowerinfoday windpowerinfoday:list){
+				String windpowerstationid1 = windpowerinfoday.getWindpowerstationid();
+				if(windpowerstationid1.equalsIgnoreCase(windpowerstationid)){
+					list.remove(windpowerinfoday);
+				}
+			}
+	        PageInfo<Windpowerinfoday> pageInfo = new PageInfo<Windpowerinfoday>(list);
+	        return  pageInfo;
+	 }
+
+
+	/**
+	 *
+	 * @return
+	 * @throws ParseException
+	 */
+	public Windpowerinfoday findListByDate(String wpid,String recorddate) throws ParseException {
+
+		Windpowerinfoday wpi=null;
+
+		if(recorddate!=null&&!"".equals(recorddate) && wpid!=null&&!"".equals(wpid)){
+
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			Date recodedatebegin =sdf.parse(recorddate);
+			Date recodedateend = DateUtils.addDays(recodedatebegin,1);
+			WindpowerinfodayExample testExample=new WindpowerinfodayExample();
+			testExample.setOrderByClause("id ASC");
+			testExample.createCriteria().andForeignkeyidEqualTo(wpid).andRecorddateBetween(recodedatebegin,recodedateend);
+			List<Windpowerinfoday> list= windpowerinfodayMapper.selectByExample(testExample);
+
+			if(!list.isEmpty())
+			{
+				wpi=list.get(0);
+			}
+		}
+		return wpi;
+	
+	}
+	
+
+	
+
+
+    @Override
+	public String convertmessage(Object message){
+		return "123456";
+	}
+
+
+
+	@Override
+	public int deleteByPrimaryKey(String ids) {
+				
+		
+			return -1;
+			
+				
+	}
+	
+	
+	@Override
+	public Windpowerinfoday selectByPrimaryKey(String id) {
+				
+			return windpowerinfodayMapper.selectByPrimaryKey(Integer.valueOf(id));
+				
+	}
+
+	
+	@Override
+	public int updateByPrimaryKeySelective(Windpowerinfoday record) {
+		return windpowerinfodayMapper.updateByPrimaryKeySelective(record);
+	}
+	
+	
+	/**
+	 * 添加
+	 */
+	@Override
+	public int insertSelective(Windpowerinfoday record) {
+				
+		
+			
+				
+		return -1;
+	}
+	
+	
+	@Override
+	public int updateByExampleSelective(Windpowerinfoday record, WindpowerinfodayExample example) {
+		
+		return windpowerinfodayMapper.updateByExampleSelective(record, example);
+	}
+
+	
+	@Override
+	public int updateByExample(Windpowerinfoday record, WindpowerinfodayExample example) {
+		
+		return windpowerinfodayMapper.updateByExample(record, example);
+	}
+
+	@Override
+	public List<Windpowerinfoday> selectByExample(WindpowerinfodayExample example) {
+		
+		return windpowerinfodayMapper.selectByExample(example);
+	}
+
+	
+	@Override
+	public long countByExample(WindpowerinfodayExample example) {
+		
+		return windpowerinfodayMapper.countByExample(example);
+	}
+
+	
+	@Override
+	public int deleteByExample(WindpowerinfodayExample example) {
+		
+		return windpowerinfodayMapper.deleteByExample(example);
+	}
+	
+	/**
+	 * 检查name
+	 * @param windpowerinfoday
+	 * @return
+	 */
+	public int checkNameUnique(Windpowerinfoday windpowerinfoday){
+		WindpowerinfodayExample example=new WindpowerinfodayExample();
+		example.createCriteria().andRecorddateEqualTo(windpowerinfoday.getRecorddate());
+		List<Windpowerinfoday> list=windpowerinfodayMapper.selectByExample(example);
+		return list.size();
+	}
+
+
+
+
+}

+ 183 - 0
src/main/java/com/gyee/frame/service/WindturbineinfodayService.java

@@ -0,0 +1,183 @@
+package com.gyee.frame.service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.mapper.auto.WindturbineinfodayMapper;
+import com.gyee.frame.model.auto.Windturbineinfoday;
+import com.gyee.frame.model.auto.WindturbineinfodayExample;
+import com.gyee.frame.model.custom.Tablepar;
+import com.gyee.frame.netty.websocket.util.SocketToolService;
+import com.gyee.frame.util.DateUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *  WeatherfdService
+ * @Title: WeatherfdService.java 
+ * @Package com.gyee.frame.service 
+ * @author Wang Jiawen_自动生成
+ * @email 1@qq.com
+ * @date 2020-01-07 16:13:24  
+ **/
+@Service
+public class WindturbineinfodayService extends SocketToolService implements BaseService<Windturbineinfoday, WindturbineinfodayExample>{
+	@Resource
+	private WindturbineinfodayMapper windturbineinfodayMapper;
+
+
+	/**
+	 * 分页查询
+	 * @param windpowerstationid
+	 * @return
+	 */
+	 public PageInfo<Windturbineinfoday> list(Tablepar tablepar,String name,String windpowerstationid) throws ParseException {
+		    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		    Date recodedate = sdf.parse(name);
+	        WindturbineinfodayExample testExample=new WindturbineinfodayExample();
+	        testExample.setOrderByClause("id ASC");
+	        if(name!=null&&!"".equals(name)){
+				testExample.createCriteria().andRecorddateEqualTo(recodedate);
+	        }
+
+	        PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+	        List<Windturbineinfoday> list= windturbineinfodayMapper.selectByExample(testExample);
+	        for(Windturbineinfoday windturbineinfoday:list){
+				String windpowerstationid1 = windturbineinfoday.getWindpowerstationid();
+				if(windpowerstationid1.equalsIgnoreCase(windpowerstationid)){
+					list.remove(windturbineinfoday);
+				}
+			}
+	        PageInfo<Windturbineinfoday> pageInfo = new PageInfo<Windturbineinfoday>(list);
+	        return  pageInfo;
+	 }
+
+
+	/**
+	 *
+	 * @return
+	 * @throws ParseException
+	 */
+	public Windturbineinfoday findListByDate(String wtid,String recorddate) throws ParseException {
+
+		Windturbineinfoday wpi=null;
+
+		if(wtid!=null&&!"".equals(wtid) && recorddate!=null&&!"".equals(recorddate)){
+
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			Date recodedatebegin =sdf.parse(recorddate);
+			Date recodedateend = DateUtils.addDays(recodedatebegin,1);
+			WindturbineinfodayExample testExample=new WindturbineinfodayExample();
+			testExample.setOrderByClause("id ASC");
+			testExample.createCriteria().andWindturbineidEqualTo(wtid).andRecorddateBetween(recodedatebegin,recodedateend);
+			List<Windturbineinfoday> list= windturbineinfodayMapper.selectByExample(testExample);
+
+			if(!list.isEmpty())
+			{
+				wpi=list.get(0);
+			}
+		}
+		return wpi;
+
+	}
+
+
+
+    @Override
+	public String convertmessage(Object message){
+		return "123456";
+	}
+
+
+
+	@Override
+	public int deleteByPrimaryKey(String ids) {
+
+
+			return -1;
+
+
+	}
+
+
+	@Override
+	public Windturbineinfoday selectByPrimaryKey(String id) {
+
+			return windturbineinfodayMapper.selectByPrimaryKey(Integer.valueOf(id));
+
+	}
+
+
+	@Override
+	public int updateByPrimaryKeySelective(Windturbineinfoday record) {
+		return windturbineinfodayMapper.updateByPrimaryKeySelective(record);
+	}
+
+
+	/**
+	 * 添加
+	 */
+	@Override
+	public int insertSelective(Windturbineinfoday record) {
+
+
+
+
+		return -1;
+	}
+
+
+	@Override
+	public int updateByExampleSelective(Windturbineinfoday record, WindturbineinfodayExample example) {
+
+		return windturbineinfodayMapper.updateByExampleSelective(record, example);
+	}
+
+
+	@Override
+	public int updateByExample(Windturbineinfoday record, WindturbineinfodayExample example) {
+
+		return windturbineinfodayMapper.updateByExample(record, example);
+	}
+
+	@Override
+	public List<Windturbineinfoday> selectByExample(WindturbineinfodayExample example) {
+
+		return windturbineinfodayMapper.selectByExample(example);
+	}
+
+
+	@Override
+	public long countByExample(WindturbineinfodayExample example) {
+
+		return windturbineinfodayMapper.countByExample(example);
+	}
+
+
+	@Override
+	public int deleteByExample(WindturbineinfodayExample example) {
+
+		return windturbineinfodayMapper.deleteByExample(example);
+	}
+
+	/**
+	 * 检查name
+	 * @param windturbineinfoday
+	 * @return
+	 */
+	public int checkNameUnique(Windturbineinfoday windturbineinfoday){
+		WindturbineinfodayExample example=new WindturbineinfodayExample();
+		example.createCriteria().andRecorddateEqualTo(windturbineinfoday.getRecorddate());
+		List<Windturbineinfoday> list=windturbineinfodayMapper.selectByExample(example);
+		return list.size();
+	}
+
+
+
+
+}

+ 35 - 0
src/test/java/test/RelationalDataBaseTest.java

@@ -0,0 +1,35 @@
+package test;
+
+import com.gyee.SpringbootStart;
+import com.gyee.frame.common.spring.SpringUtils;
+import com.gyee.frame.model.auto.Windpowerinfoday;
+import com.gyee.frame.model.auto.Windturbineinfoday;
+import com.gyee.frame.service.WindpowerinfodayService;
+import com.gyee.frame.service.WindturbineinfodayService;
+import lombok.SneakyThrows;
+import org.springframework.boot.SpringApplication;
+
+public class RelationalDataBaseTest {
+
+    @SneakyThrows
+    public static void main(String[] args) {
+
+        SpringApplication.run(SpringbootStart.class, args);
+
+        WindturbineinfodayService windturbineinfodayService = SpringUtils.getBean("windturbineinfodayService");
+        WindpowerinfodayService windpowerinfodayService = SpringUtils.getBean("windpowerinfodayService");
+
+//        LineExample lineExample=new LineExample();
+//
+//        List<Line> ls=lineService.selectByExample(lineExample);
+
+        Windturbineinfoday wt=windturbineinfodayService.findListByDate("CL01_001","2020-05-14");
+        Windpowerinfoday wp=windpowerinfodayService.findListByDate("CL_FDC","2020-05-14");
+
+        System.out.println(wt.getRecorddate()+ "___" +wt.getGeneratingcapacity2());
+        System.out.println(wp.getRecorddate()+ "___" +wp.getGeneratingcapacity2());
+
+    }
+
+
+}