| | |
| | | return list; |
| | | } |
| | | |
| | | public Response<Map> getBTSEquipStatus(int userId) throws ParseException { |
| | | public Response getBTSEquipStatus(int userId) throws ParseException { |
| | | |
| | | Response<Map> response = new Response(); |
| | | Map<String, Integer> resultMap = new HashMap<>(); |
| | | resultMap.put("在线浮充数量",0); |
| | | resultMap.put("预充电数量",0); |
| | | resultMap.put("核容测试数量",0); |
| | | resultMap.put("内阻测试数量",0); |
| | | resultMap.put("通讯故障数量",0); |
| | | Response response = new Response(); |
| | | try { |
| | | Map<String, Integer> resultMap = new HashMap<>(); |
| | | resultMap.put("在线浮充数量", 0); |
| | | resultMap.put("预充电数量", 0); |
| | | resultMap.put("核容测试数量", 0); |
| | | resultMap.put("内阻测试数量", 0); |
| | | resultMap.put("通讯故障数量", 0); |
| | | /*try { |
| | | List<FBS9100State> statusList = fbs9100StateMapper.getStatus(userId); |
| | | for (int i = 0; i < statusList.size(); i++) { |
| | |
| | | response.setCode(0); |
| | | return response; |
| | | }*/ |
| | | QueryWrapper<Fbs9100State> wrapper = Wrappers.query(); |
| | | wrapper.select("record_datetime","dev_workstate"); |
| | | List<Fbs9100State> fbs9100StateList = mapper.selectList(wrapper); |
| | | //首先查看是否通讯故障,时间大于1分钟为通讯故障 |
| | | for (int i = 0; i < fbs9100StateList.size(); i++) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.MINUTE,-1); |
| | | Date time = instance.getTime(); |
| | | if(time.compareTo(DateUtil.YYYY_MM_DD_HH_MM_SS.parse(fbs9100StateList.get(i).getRecordDatetime()))>0){ |
| | | resultMap.put("通讯故障数量",resultMap.get("通讯故障数量")+1); |
| | | }else{ |
| | | switch (fbs9100StateList.get(i).getDevWorkstate()){ |
| | | case DeviceConstant.DEV_ONLINE_CHARGE: |
| | | resultMap.put("在线浮充数量",resultMap.get("在线浮充数量")+1); |
| | | break; |
| | | case DeviceConstant.DEV_PRE_CHARGE: |
| | | resultMap.put("预充电数量",resultMap.get("预充电数量")+1); |
| | | break; |
| | | case DeviceConstant.DEV_NUCLEAR_CAP: |
| | | resultMap.put("核容数量",resultMap.get("核容测试数量")+1); |
| | | break; |
| | | case DeviceConstant.DEV_RES_TEST: |
| | | resultMap.put("内阻测试数量",resultMap.get("内阻测试数量")+1); |
| | | break; |
| | | QueryWrapper<Fbs9100State> wrapper = Wrappers.query(); |
| | | wrapper.select("record_datetime", "dev_workstate"); |
| | | List<Fbs9100State> fbs9100StateList = mapper.selectList(wrapper); |
| | | //首先查看是否通讯故障,时间大于1分钟为通讯故障 |
| | | for (int i = 0; i < fbs9100StateList.size(); i++) { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.MINUTE, -1); |
| | | Date time = instance.getTime(); |
| | | if (time.compareTo(DateUtil.YYYY_MM_DD_HH_MM_SS.parse(fbs9100StateList.get(i).getRecordDatetime())) > 0) { |
| | | resultMap.put("通讯故障数量", resultMap.get("通讯故障数量") + 1); |
| | | } else { |
| | | switch (fbs9100StateList.get(i).getDevWorkstate()) { |
| | | case DeviceConstant.DEV_ONLINE_CHARGE: |
| | | resultMap.put("在线浮充数量", resultMap.get("在线浮充数量") + 1); |
| | | break; |
| | | case DeviceConstant.DEV_PRE_CHARGE: |
| | | resultMap.put("预充电数量", resultMap.get("预充电数量") + 1); |
| | | break; |
| | | case DeviceConstant.DEV_NUCLEAR_CAP: |
| | | resultMap.put("核容数量", resultMap.get("核容测试数量") + 1); |
| | | break; |
| | | case DeviceConstant.DEV_RES_TEST: |
| | | resultMap.put("内阻测试数量", resultMap.get("内阻测试数量") + 1); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return new Response<Map>().set(1,resultMap); |
| | | return response.setII(1,true,resultMap,null); |
| | | }catch (Exception e){ |
| | | return response.set(1,false,"发生异常:"+e.getCause()); |
| | | } |
| | | } |
| | | } |