| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattMapInformationMapper; |
| | | import com.whyc.mapper.BattdischargePlanMapper; |
| | | import com.whyc.pojo.BattMapInformation; |
| | | import com.whyc.pojo.BattalarmData; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.mapper.StationInfMapper; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.apache.commons.collections.map.HashedMap; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | private BattalarmDataService battalarmDataService; |
| | | |
| | | public Response add(BattMapInformation entity){ |
| | | @Resource |
| | | private StationInfMapper stationInfMapper; |
| | | |
| | | public Response add(BattMapInformation entity) { |
| | | mapper.insert(entity); |
| | | return new Response().set(1,true,"添加成功"); |
| | | //查看在电池组机房是否存在stationId |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("stationId", entity.getStationId()); |
| | | wrapper.last("limit 1"); |
| | | StationInf sinf = stationInfMapper.selectOne(wrapper); |
| | | if (sinf != null) { |
| | | UpdateWrapper sinfWrapper = new UpdateWrapper(); |
| | | sinfWrapper.set("stationLongitude", entity.getLongitude()); |
| | | sinfWrapper.set("stationLatitude", entity.getLatitude()); |
| | | sinfWrapper.eq("stationId", entity.getStationId()); |
| | | stationInfMapper.update(null, sinfWrapper); |
| | | } |
| | | return new Response().set(1, true, "添加成功"); |
| | | } |
| | | |
| | | public Response update(BattMapInformation entity){ |
| | | public Response update(BattMapInformation entity) { |
| | | mapper.updateById(entity); |
| | | return new Response().set(1,true,"更新成功"); |
| | | //查看在电池组机房是否存在stationId |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("stationId", entity.getStationId()); |
| | | wrapper.last("limit 1"); |
| | | StationInf sinf = stationInfMapper.selectOne(wrapper); |
| | | if (sinf != null) { |
| | | UpdateWrapper sinfWrapper = new UpdateWrapper(); |
| | | sinfWrapper.set("stationLongitude", entity.getLongitude()); |
| | | sinfWrapper.set("stationLatitude", entity.getLatitude()); |
| | | sinfWrapper.eq("stationId", entity.getStationId()); |
| | | stationInfMapper.update(null, sinfWrapper); |
| | | } |
| | | return new Response().set(1, true, "更新成功"); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | //用户管理内的异常机房id集合 |
| | | ArrayList<String> abnormalList = new ArrayList<>(); |
| | | |
| | | for (BattMapInformation information:level1Behind){ |
| | | String stationId = information.getStationId(); |
| | | //用户管理内的站点进行操作 |
| | | if(stationList.contains(stationId)){ |
| | | //从结果机房list定位到对应的元素 |
| | | int index = stationList.indexOf(stationId); |
| | | |
| | | information.setNum(1); |
| | | |
| | | list.set(index,information); |
| | | abnormalList.add(stationId); |
| | | } |
| | | } |
| | | //太供调整地图显示暂去除异常为1的标识 |
| | | // for (BattMapInformation information:level1Behind){ |
| | | // String stationId = information.getStationId(); |
| | | // //用户管理内的站点进行操作 |
| | | // if(stationList.contains(stationId)){ |
| | | // //从结果机房list定位到对应的元素 |
| | | // int index = stationList.indexOf(stationId); |
| | | // |
| | | // information.setNum(1); |
| | | // |
| | | // list.set(index,information); |
| | | // abnormalList.add(stationId); |
| | | // } |
| | | // } |
| | | for (BattMapInformation information:level2Alarm){ |
| | | String stationId = information.getStationId(); |
| | | //用户管理内的站点进行操作 |