| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.sun.corba.se.spi.presentation.rmi.PresentationManager; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.result.SystemGrdoupBatt; |
| | | import com.whyc.mapper.*; |
| | |
| | | @Autowired(required = false) |
| | | private BaoJiGroupBattGroupMapper bjBattMapper; |
| | | |
| | | @Resource |
| | | private RessetStationService ressetStationService; |
| | | |
| | | //查询最大的自增标识同一机房的标识 |
| | | public int getMaxTogetherFlag() { |
| | | int togetherFlag = mapper.getMaxTogetherFlag(); |
| | |
| | | mapInfo.setLatitude(stationInf.getStationLatitude()); |
| | | mapInfo.setStationName3(stationInf.getStationName3()); |
| | | mapMapper.insert(mapInfo);*/ |
| | | /*添加机房设置默认值*/ |
| | | ressetStationService.setDefaultRessetStation(stationId); |
| | | return new Response().set(1, flag > 0, flag > 0 ? "插入站点成功" : "插入站点失败"); |
| | | } |
| | | |
| | |
| | | @Transactional |
| | | public Response updateName(String stationName, String stationName1, String stationName2, String stationName3, String stationName4, String stationName5 |
| | | , String stationIdTogether, String stationId) { |
| | | UpdateWrapper wrapper = new UpdateWrapper(); |
| | | wrapper.eq("stationId", stationId); |
| | | |
| | | UpdateWrapper sinfWrapper = new UpdateWrapper(); |
| | | sinfWrapper.eq("stationId", stationId); |
| | | if (stationName != null && !stationName.isEmpty()) { |
| | | UpdateWrapper pinfWrapper = new UpdateWrapper(); |
| | | pinfWrapper.eq("stationId", stationId); |
| | | |
| | | QueryWrapper wrapperZj = new QueryWrapper(); |
| | | wrapperZj.eq("stationId", stationId); |
| | | wrapperZj.last(" limit 1"); |
| | | |
| | | StationInf sinfZj = mapper.selectOne(wrapperZj); |
| | | String name=stationName1+"-"+stationName2+"-"+stationName5+"-"+stationName3+"-"+sinfZj.getStationName4(); |
| | | sinfWrapper.set("stationName", name); |
| | | /*if (stationName != null && !stationName.isEmpty()) { |
| | | wrapper.set("stationName", stationName); |
| | | sinfWrapper.set("stationName", stationName); |
| | | } |
| | | }*/ |
| | | if (stationName1 != null && !stationName1.isEmpty()) { |
| | | wrapper.set("stationName1", stationName1); |
| | | sinfWrapper.set("stationName1", stationName1); |
| | | pinfWrapper.set("stationName1", stationName1); |
| | | } |
| | | if (stationName2 != null && !stationName2.isEmpty()) { |
| | | wrapper.set("stationName2", stationName2); |
| | | sinfWrapper.set("stationName2", stationName2); |
| | | pinfWrapper.set("stationName2", stationName2); |
| | | } |
| | | if (stationName3 != null && !stationName3.isEmpty()) { |
| | | wrapper.set("stationName3", stationName3); |
| | | sinfWrapper.set("stationName3", stationName3); |
| | | pinfWrapper.set("stationName3", stationName3); |
| | | } |
| | | if (stationName4 != null && !stationName4.isEmpty()) { |
| | | /*if (stationName4 != null && !stationName4.isEmpty()) { |
| | | wrapper.set("stationName4", stationName4); |
| | | sinfWrapper.set("stationName4", stationName4); |
| | | } |
| | | pinfWrapper.set("stationName4", stationName4); |
| | | }*/ |
| | | if (stationName5 != null && !stationName5.isEmpty()) { |
| | | wrapper.set("stationName5", stationName5); |
| | | sinfWrapper.set("stationName5", stationName5); |
| | | pinfWrapper.set("stationName5", stationName5); |
| | | } |
| | | if (stationIdTogether != null && !stationIdTogether.isEmpty()) { |
| | | //1.先验证同一机房结点信息和电压等级是否一样,若不一样则不允许添加 |
| | | QueryWrapper wrapperZj = new QueryWrapper(); |
| | | QueryWrapper wrapperGl = new QueryWrapper(); |
| | | wrapperZj.eq("stationId", stationId); |
| | | wrapperGl.eq("stationId", stationIdTogether); |
| | | wrapper.last("limit 1"); |
| | | StationInf sinfZj = mapper.selectOne(wrapperZj); |
| | | wrapperGl.last(" limit 1"); |
| | | StationInf sinfGl = mapper.selectOne(wrapperGl); |
| | | if (sinfZj.getNodeStation() != sinfGl.getNodeStation()) { |
| | | return new Response().set(1, false, "设置同一站点时,两站点节点属性不一致"); |
| | |
| | | int flag = mapper.update((StationInf) ActionUtil.objeNull, sinfWrapper); |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("stationId", stationId); |
| | | List listB = binfMapper.selectList(queryWrapper); |
| | | List<Battinf> listB = binfMapper.selectList(queryWrapper); |
| | | //每个电池组修改自己的名字 |
| | | if (listB != null && listB.size() > 0) { |
| | | binfMapper.update((Battinf) ActionUtil.objeNull, wrapper); |
| | | for (Battinf binf:listB) { |
| | | UpdateWrapper wrapper = new UpdateWrapper(); |
| | | wrapper.eq("stationId", stationId); |
| | | wrapper.set("stationName1", stationName1); |
| | | wrapper.set("stationName2", stationName2); |
| | | wrapper.set("stationName3", stationName3); |
| | | wrapper.set("stationName5", stationName5); |
| | | name=stationName1+"-"+stationName2+"-"+stationName5+"-"+stationName3+"-"+binf.getStationName4(); |
| | | wrapper.set("stationName", name); |
| | | wrapper.eq("FBSDeviceId", binf.getFBSDeviceId()); |
| | | wrapper.last("limit 1"); |
| | | binfMapper.update((Battinf) ActionUtil.objeNull, wrapper); |
| | | } |
| | | } |
| | | List listP = pinfMapper.selectList(queryWrapper); |
| | | if (listP != null && listP.size() > 0) { |
| | | pinfMapper.update((PowerInf) ActionUtil.objeNull, wrapper); |
| | | name=stationName1+"-"+stationName2+"-"+stationName5+"-"+stationName3+"-"; |
| | | pinfWrapper.set("stationName", name); |
| | | pinfMapper.update((PowerInf) ActionUtil.objeNull, pinfWrapper); |
| | | } |
| | | return new Response().set(1, flag > 0, flag > 0 ? "编辑机房名成功" : "编辑机房名失败"); |
| | | } |
| | |
| | | //删除包机组下机房 |
| | | QueryWrapper<BaojiGroupBattGroup> bjWrapper = new QueryWrapper<BaojiGroupBattGroup>().eq("stationId",stationId); |
| | | bjBattMapper.delete(bjWrapper); |
| | | //删除定位 |
| | | QueryWrapper<BattMapInformation> mapWrapper = new QueryWrapper<BattMapInformation>().eq("stationId",stationId); |
| | | mapMapper.delete(mapWrapper); |
| | | return new Response().set(1, flag > 0, "删除总站点"); |
| | | } |
| | | |
| | |
| | | mapper.insertBatchSomeColumn(stationListToBeAdded); |
| | | } |
| | | |
| | | /** |
| | | * 按省份查询数量 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | public Response getProvinceCountMap(int userId) { |
| | | try { |
| | | //所有站点的省份 |
| | | List<String> stationName1List = mapper.getProvinceCountMap(userId); |
| | | Map<String, Integer> resMap = new HashMap<>(); |
| | | for (String stationName1 : stationName1List) { |
| | | Integer count = resMap.get(stationName1); |
| | | if (count == null) { |
| | | resMap.put(stationName1, 1); |
| | | } else { |
| | | resMap.put(stationName1, count + 1); |
| | | } |
| | | } |
| | | return new Response().setII(1, true,resMap,null); |
| | | }catch (Exception e){ |
| | | return new Response().set(1, false,"发生异常:"+e.getCause()); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |