| | |
| | | package com.fgkj.services; |
| | | |
| | | import com.fgkj.dto.*; |
| | | import com.fgkj.mapper.BattTestData; |
| | | import com.fgkj.mapper.impl.Batt_rtdataMapper; |
| | | import com.fgkj.mapper.impl.Batt_rtstateMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | //首页上饼状图电池状态比例 |
| | | public ServiceModel serchBattStateRate(User_inf obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchBattStateRate(obj); |
| | | List<Batt_rtstate> list=mapper.serchBattStateRate(obj); |
| | | int test_plan0=0;//状态为无 |
| | | int test_plan1=0;//状态为浮充 |
| | | int test_plan2=0;//状态为充电 |
| | | int test_plan3=0;//状态为放电 |
| | | int test_plan4=0;//状态为均充 |
| | | if(list!=null&&list.size()>0){ |
| | | for (Batt_rtstate batt_rtstate : list) { |
| | | if(batt_rtstate.getBatt_state()==BattTestData.test_plan0){ |
| | | test_plan0+=batt_rtstate.getBatt_count(); // COUNT(tb_batt_rtstate.BattGroupId) batt_count |
| | | }else if(batt_rtstate.getBatt_state()==BattTestData.test_plan1){ |
| | | test_plan1+=batt_rtstate.getBatt_count(); |
| | | }else if(batt_rtstate.getBatt_state()==BattTestData.test_plan2){ |
| | | test_plan2+=batt_rtstate.getBatt_count(); |
| | | }else if(batt_rtstate.getBatt_state()==BattTestData.test_plan3){ |
| | | test_plan3+=batt_rtstate.getBatt_count(); |
| | | }else if(batt_rtstate.getBatt_state()==BattTestData.test_plan4){ |
| | | test_plan4+=batt_rtstate.getBatt_count(); |
| | | } |
| | | } |
| | | list= new ArrayList<>(); |
| | | { |
| | | Batt_rtstate bstate = new Batt_rtstate(); |
| | | bstate.setBatt_state(BattTestData.test_plan0); |
| | | bstate.setNum(test_plan0); |
| | | list.add(bstate); |
| | | Batt_rtstate bstate1 = new Batt_rtstate(); |
| | | bstate1.setBatt_state(BattTestData.test_plan1); |
| | | bstate1.setNum(test_plan1); |
| | | list.add(bstate1); |
| | | Batt_rtstate bstate2 = new Batt_rtstate(); |
| | | bstate2.setBatt_state(BattTestData.test_plan2); |
| | | bstate2.setNum(test_plan2); |
| | | list.add(bstate2); |
| | | Batt_rtstate bstate3 = new Batt_rtstate(); |
| | | bstate3.setBatt_state(BattTestData.test_plan3); |
| | | bstate3.setNum(test_plan3); |
| | | list.add(bstate3); |
| | | Batt_rtstate bstate4 = new Batt_rtstate(); |
| | | bstate4.setBatt_state(BattTestData.test_plan4); |
| | | bstate4.setNum(test_plan4); |
| | | list.add(bstate4); |
| | | } |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | model.setMsg("查询成功!"); |
| | |
| | | //测试数据——实时查询中左下角的充放电统计(旧) |
| | | public ServiceModel serchDisOrChargr(){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchDisOrChargr(); |
| | | List<Batt_rtstate> list=mapper.serchDisOrChargr(); |
| | | if(list!=null&&list.size()>0){ |
| | | int charge=0; |
| | | int dischar=0; |
| | | for (Batt_rtstate brt: list) { |
| | | if(brt.getBatt_test_type()==3){ |
| | | dischar++; |
| | | }else if(brt.getBatt_test_type()==2){ |
| | | charge++; |
| | | } |
| | | } |
| | | list.get(list.size()-1).setNum(charge); |
| | | list.get(list.size()-1).setBatt_count(dischar); |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | model.setMsg("查询成功!"); |
| | |
| | | //测试数据——实时查询中左下角的充放电统计(用户管理的机房) |
| | | public ServiceModel serchDisOrChargrNew(User_inf obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchDisOrChargrNew(obj); |
| | | List<Batt_rtstate> list=mapper.serchDisOrChargrNew(obj); |
| | | if(list!=null&&list.size()>0){ |
| | | int charge=0; |
| | | int dischar=0; |
| | | for (Batt_rtstate brt: list) { |
| | | if(brt.getBatt_test_type()==3){ |
| | | dischar++; |
| | | }else if(brt.getBatt_test_type()==2){ |
| | | charge++; |
| | | } |
| | | } |
| | | list.get(list.size()-1).setNum(charge); |
| | | list.get(list.size()-1).setBatt_count(dischar); |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | model.setMsg("查询成功!"); |