curl --location -g --request GET 'http://127.0.0.1:8014/test/ai/flux/simple?message=帮我 优化一下 代码 同时输出 优化后的代码
@Override public void runTask() { log.info("IotDeviceAlarmTask device run status task ....... "); LambdaQueryWrapper<DeviceIot> chainWrapper = new LambdaQueryWrapper<>(); chainWrapper.eq(DeviceIot::getDelFlag,0); List<DeviceIot> deviceIotList = deviceIotService.list(chainWrapper); if (CollectionUtils.isEmpty(deviceIotList)) { return; } deviceIotList.forEach(deviceInfo -> { Long deviceId = deviceInfo.getDeviceId(); IotRecordParamReq iotRecordParamReq = new IotRecordParamReq(); iotRecordParamReq.setDeviceId(deviceId); // 设备 第一次 上报时间 if (ObjectUtils.isEmpty(deviceInfo.getFirstGatherTime())) { Date firstGatherTime = getFirstGatherTime(deviceId); if (firstGatherTime != null) { deviceInfo.setFirstGatherTime(firstGatherTime); } } // 判断当前时间是否小于指定时间网关 Integer gatewayStatus = 0; Long gatherRate = gatherRate(deviceId); if (gatherRate != null %26%26 gatherRate > 0L %26%26 gatherRate <= deviceInfo.getGatherRate()){ gatewayStatus = 1; } deviceInfo.setGatewayStatus(gatewayStatus); // 判断当前时间是否在线 Integer devStatus = 0; IotRecordParamDto deviceRecord = iotRecordParamService.getDeviceRecord(iotRecordParamReq); if (deviceRecord != null %26%26 gatherRate != null %26%26 gatherRate > 0L %26%26 gatherRate <= deviceInfo.getGatherRate()){ devStatus = deviceRecord.getDevStatus(); } deviceInfo.setStatus(devStatus); deviceIotService.updateById(deviceInfo); }); log.info("IotDeviceAlarmTask device run status task end ....... "); }' \
--header 'Token: {{TOKEN}}'
{}