123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package com.hcks.cmfds.service;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.Set;
- import org.springframework.stereotype.Service;
- import com.hcks.cmfds.core.persistence.GenericJdbcDao;
- import com.hcks.cmfds.model.Sywindturbinestatus;
- import com.hcks.cmfds.util.EdosUtilold;
- import com.hcks.cmfds.util.IEdosUtil;
- @Service
- public class SywindturbinestatusService extends GenericJdbcDao<Sywindturbinestatus> {
-
- private IEdosUtil ednaApiUtil = new EdosUtilold();
-
- public Map<String,Object> findSystatus(){
-
- Map<String,Object> resultMap = new HashMap<String, Object>();
- Map<String,Sywindturbinestatus> systatusmap = CacheContext.systatusmap;
- Set<String> keySet = systatusmap.keySet();
- int bwts = 0;
- int gzts = 0;
- int whts = 0;
- int djts = 0;
- double fs = 0;
- double gl = 0;
- int count = 0;
-
- for (String wtid : keySet) {
- Sywindturbinestatus sywindturbinestatus = systatusmap.get(wtid);
- if(isOne(sywindturbinestatus.getGz())){
- resultMap.put(wtid+"xxfjzt", 2.0);
- resultMap.put(wtid+"|type",2);
- gzts++;
- }else if(isOne(sywindturbinestatus.getWh())){
- resultMap.put(wtid+"xxfjzt", 4.0);
- resultMap.put(wtid+"|type",4);
- whts++;
- }else if(isOne(sywindturbinestatus.getTj()) || isOne(sywindturbinestatus.getDj())){
- resultMap.put(wtid+"xxfjzt", 0.0);
- resultMap.put(wtid+"|type",0);
- djts++;
- }else{
- resultMap.put(wtid+"xxfjzt", 1.0);
- resultMap.put(wtid+"|type",1);
- bwts++;
- }
- resultMap.put("SY_FDC_YXTS", bwts);
- resultMap.put("SY_FDC_DJTS", djts);
- resultMap.put("SY_FDC_GZTJ", gzts);
- resultMap.put("SY_FDC_WHTS", whts);
- double fs2 = getFs(sywindturbinestatus.getFs());
- if (fs2!=0) {
- fs+=fs2;
- count++;
- }
- double gl2 = getGl(sywindturbinestatus.getGl());
- gl+=gl2;
- resultMap.put(wtid+"fs", fs2);
- resultMap.put(wtid+"gl", gl2);
- }
- resultMap.put("SY_FDC_SPEED", fs/count);
- resultMap.put("SY_FDC_POWER", gl/1000);
- return resultMap;
- }
-
- public double getFs(String pointid){
- double fs = 0.0;
- try {
- fs = ednaApiUtil.getRealData(pointid).getPointValueInDouble();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return fs;
- }
-
- public double getGl(String pointid){
- double gl = 0.0;
- try {
- gl = ednaApiUtil.getRealData(pointid).getPointValueInDouble();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return gl;
- }
-
-
- public boolean isOne(String pointid){
- double pointValue;
- try {
- pointValue = ednaApiUtil.getRealData(pointid).getPointValueInDouble();
- if (pointValue==1.0) {
- return true;
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- return false;
-
- }
-
-
- }
|