| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.domain.CommonPage; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.redis.RedisService; |
| | |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.dto.DeviceStatus; |
| | | import com.sandu.ximon.admin.dto.WaterQualityDataDto; |
| | | import com.sandu.ximon.admin.entity.Command; |
| | | import com.sandu.ximon.admin.manager.iot.frame.A1Frame; |
| | | import com.sandu.ximon.admin.manager.iot.frame.FrameBuilder; |
| | | import com.sandu.ximon.admin.manager.iot.frame.IRequestFrame; |
| | |
| | | import com.sandu.ximon.admin.redis.LightKey; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.LightemitUtils; |
| | | import com.sandu.ximon.admin.utils.ListPagingUtils; |
| | | import com.sandu.ximon.admin.utils.RedisUtils; |
| | | import com.sandu.ximon.admin.utils.response.VnnoxResult; |
| | | import com.sandu.ximon.admin.vo.PoleBindVO; |
| | |
| | | return result; |
| | | } |
| | | |
| | | public List<Pole> queryAllStatesAndList(Integer pageNo, Integer pageSize, PoleStatesParam param) { |
| | | |
| | | List<Pole> list = new ArrayList<>(); |
| | | LambdaQueryWrapper<Pole> wrapper = new LambdaQueryWrapper<>(); |
| | | public CommonPage queryAllStatesAndList(Integer pageNo, Integer pageSize, PoleStatesParam param) { |
| | | if (param == null) { |
| | | param = new PoleStatesParam(); |
| | | } |
| | | System.out.println(param); |
| | | List<Pole> poleList; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | wrapper = Wrappers.lambdaQuery(Pole.class); |
| | | poleList = poleMapper.queryPoleOnLineStatesList(null, param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword()); |
| | | } else { |
| | | wrapper = Wrappers.lambdaQuery(Pole.class).eq(Pole::getClientId, SecurityUtils.getUserId()).or( |
| | | w -> { |
| | | w.eq(Pole::getUserId, SecurityUtils.getUserId()); |
| | | }); |
| | | } |
| | | if (param.getKeyword() != null && !param.getKeyword().isEmpty()) { |
| | | wrapper.like(Pole::getPoleCode, param.getKeyword()).or( |
| | | wrappers -> { |
| | | wrappers.like(Pole::getPoleName, param.getKeyword()); |
| | | } |
| | | ); |
| | | poleList = poleMapper.queryPoleOnLineStatesList(SecurityUtils.getUserId(), param.getIsTrue(), param.getBingStates(), param.getGroupid(), param.getKeyword()); |
| | | } |
| | | |
| | | PageHelper.startPage(pageNo, pageSize); |
| | | list = list(wrapper); |
| | | if (param.getGroupid() != null) { |
| | | // List<Long> poleIds = new ArrayList<>(); |
| | | List<Pole> pole = new ArrayList<>(); |
| | | List<PoleGroupRelation> relations = groupRelationService.list(Wrappers.lambdaQuery(PoleGroupRelation.class) |
| | | .eq(PoleGroupRelation::getPoleGroupId, param.getGroupid())); |
| | | relations.forEach(relation -> { |
| | | pole.add(getById(relation.getPoleId())); |
| | | } |
| | | ); |
| | | list = pole; |
| | | } |
| | | //是否绑定 |
| | | if (param.getBingStates() != 2) { |
| | | // 绑定/未绑定 |
| | | list = isBind(list, param); |
| | | //已绑定的是否是真实灯杆 |
| | | if (param.getIsTrue() != 2) { |
| | | list = isTrue(list, param); |
| | | //绑定的真实灯杆是否在线 |
| | | if (param.getOnLineStates() != 2) { |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | //全部灯杆 实体/虚拟 |
| | | else { |
| | | //查询全部灯杆是否在线 |
| | | if (param.getOnLineStates() != 2) { |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | } |
| | | //全部 绑定/未绑定 |
| | | else { |
| | | // 判断灯杆类型 |
| | | if (param.getIsTrue() != 2) { |
| | | // 实体/虚拟 |
| | | list = isTrue(list, param); |
| | | // 灯杆的在线判断 |
| | | if (param.getOnLineStates() != 2) { |
| | | //在线/离线 |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | //全类型灯杆 |
| | | else { |
| | | //判断在线状态 |
| | | if (param.getOnLineStates() != 2) { |
| | | //在线/离线 |
| | | list = isOnLine(list, param); |
| | | } |
| | | } |
| | | } |
| | | List<Pole> PoleResult = isOnLine(poleList, param); |
| | | setCount(PoleResult); |
| | | |
| | | setCount(list); |
| | | return list; |
| | | CommonPage commonPage = ListPagingUtils.pages(PoleResult, pageNo, pageSize); |
| | | |
| | | return commonPage; |
| | | } |
| | | |
| | | /** |