| | |
| | | import org.jeecg.config.mybatis.MybatisPlusSaasConfig; |
| | | import org.jeecg.modules.dry.api.EmqxApi; |
| | | import org.jeecg.modules.dry.entity.DryEquipment; |
| | | import org.jeecg.modules.dry.entity.DryFaultRecord; |
| | | import org.jeecg.modules.dry.service.IDryEquipmentService; |
| | | import org.jeecg.modules.dry.service.IDryFaultRecordService; |
| | | import org.jeecg.modules.dry.vo.MoEquVo; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public class MobileController { |
| | | @Autowired |
| | | private IDryEquipmentService dryEquipmentService; |
| | | @Autowired |
| | | private IDryFaultRecordService faultRecordService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | |
| | | return Result.OK(voPage); |
| | | } |
| | | |
| | | @ApiOperation(value = "设备报警数据", notes = "设备报警数据列表查询") |
| | | @GetMapping(value = "/fault/list") |
| | | public Result<IPage<DryFaultRecord>> queryFaultList(DryFaultRecord faultRecord, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req){ |
| | | int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); |
| | | QueryWrapper<DryFaultRecord> queryWrapper = QueryGenerator.initQueryWrapper(faultRecord, req.getParameterMap()); |
| | | Page<DryFaultRecord> page = new Page<DryFaultRecord>(pageNo, pageSize); |
| | | IPage<DryFaultRecord> pageList = faultRecordService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | |
| | | |
| | | private void comp(IPage<DryEquipment> pageList, Page<MoEquVo> page) { |
| | | |
| | | |
| | | //当前租户id |
| | | int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); |
| | | |
| | | |
| | | List<MoEquVo> collect = pageList.getRecords().stream().map(item -> { |
| | | MoEquVo vo = new MoEquVo(); |
| | | BeanUtils.copyProperties(item, vo); |
| | | String clientid = "client-" + tenantId + "-" + item.getCode(); |
| | | JSONObject client = (JSONObject) redisUtil.get(MqttConstant.MQTT_ONLINE_CLIENT + clientid); |
| | | //JSONObject client = (JSONObject) redisUtil.hget(MqttConstant.MQTT_ONLINE_CLIENT ,tenantId); |
| | | JSONObject client = (JSONObject) redisUtil.hget(String.format(MqttConstant.MQTT_ONLINE_CLIENT,tenantId),clientid); |
| | | //组装状态数据 |
| | | if (client != null) { |
| | | vo.setOnline(true); |