| | |
| | | import com.sandu.ximon.dao.bo.LightBo; |
| | | import com.sandu.ximon.dao.domain.Light; |
| | | import com.sandu.ximon.dao.domain.LightReportData; |
| | | import com.sandu.ximon.dao.domain.Pole; |
| | | import com.sandu.ximon.dao.domain.PoleBinding; |
| | | import com.sandu.ximon.dao.enums.DeviceRespStatusEnums; |
| | | import com.sandu.ximon.dao.mapper.LightMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | |
| | | private final RedisService redisService; |
| | | private final LightReportDataService lightReportDataService; |
| | | private final PoleBindingService bindingService; |
| | | private final PoleService poleService; |
| | | |
| | | /** |
| | | * 录入当前设备码的路灯数据 |
| | |
| | | if (CollectionUtil.isNotEmpty(deviceCodeList)) { |
| | | List<LightReportData> reportDataList = lightReportDataService.getNewestReportByDeviceCode(deviceCodeList); |
| | | for (LightBo lightBo : listLight) { |
| | | deviceCodeList.forEach(code -> { |
| | | PoleBinding bind = bindingService.getPoleIdByMac(code); |
| | | if (bind != null&&lightBo.getDeviceCode().equals(bind.getDeviceCode())) { |
| | | Long poleId = bind.getPoleId(); |
| | | Pole pole = poleService.getById(poleId); |
| | | lightBo.setPoleId(pole.getId()); |
| | | lightBo.setPoleCode(pole.getDeviceCode()); |
| | | lightBo.setPoleName(pole.getPoleName()); |
| | | } |
| | | } |
| | | ); |
| | | for (LightReportData lightReportData : reportDataList) { |
| | | if (StrUtil.equals(lightBo.getDeviceCode(), lightReportData.getDeviceCode())) { |
| | | lightBo.setReportTime(lightReportData.getCreateTime()); |