| | |
| | | package com.fzzy.gateway.hx2023.service; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.fzzy.api.data.GatewayDeviceType; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.utils.DateUtil; |
| | | import com.fzzy.api.utils.NumberUtil; |
| | | import com.fzzy.async.fzzy40.Fzzy40CommonService; |
| | | import com.fzzy.async.fzzy40.entity.Fz40Grain; |
| | | import com.fzzy.gateway.api.GatewayDeviceReportService; |
| | | import com.fzzy.gateway.GatewayUtils; |
| | | import com.fzzy.gateway.api.GatewayDeviceTestService; |
| | | import com.fzzy.gateway.data.BaseReqData; |
| | | import com.fzzy.gateway.data.BaseResp; |
| | |
| | | public BaseResp testLpr(BaseReqData reqData) { |
| | | |
| | | |
| | | GatewayDevice device = reqData.getDevice(); |
| | | |
| | | WebSocketPacket packet = new WebSocketPacket(); |
| | | WebSocketPacketHeader header = new WebSocketPacketHeader(); |
| | | header.setDeviceName(reqData.getDeviceName()); |
| | |
| | | lpr.setCarNumber(reqData.getCarNumber()); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("carNumber", reqData.getCarNumber()); |
| | | jsonObject.put("position", "big"); |
| | | jsonObject.put("position", device.getPosition()); |
| | | packet.setProperties(jsonObject); |
| | | |
| | | packet.setTimestamp(System.currentTimeMillis()); |
| | |
| | | headers.setDeviceName(device.getDeviceName()); |
| | | headers.setProductId(device.getProductId()); |
| | | headers.setOrgId(device.getOrgId()); |
| | | headers.setMsgId(ScConstant.getMessageId()); |
| | | headers.setMsgId(reqData.getMessageId()); |
| | | grain.setHeaders(headers); |
| | | |
| | | GrainOutPut outPut = new GrainOutPut(); |
| | |
| | | |
| | | outPut.setTemperature(temperature); |
| | | |
| | | grain.setOutPut(outPut); |
| | | grain.setOutput(JSONObject.toJSONString(outPut)); |
| | | |
| | | |
| | | GatewayDevice gatewayDeviceWeather = GatewayUtils.getCacheByDeviceTypeOne(GatewayDeviceType.TYPE_09.getCode()); |
| | | |
| | | //气象信息 |
| | | GrainWeather weatherStation = new GrainWeather(); |
| | | weatherStation.setMessageId(ScConstant.getMessageId()); |
| | | weatherStation.setId(device.getDeviceId()); |
| | | weatherStation.setMessgeId(weatherStation.getMessageId()); |
| | | |
| | | if (null != gatewayDeviceWeather) { |
| | | weatherStation.setId(gatewayDeviceWeather.getDeviceId()); |
| | | } else { |
| | | weatherStation.setId(device.getDeviceId()); |
| | | } |
| | | weatherStation.setAirPressure(weather.getPressure()); |
| | | weatherStation.setHumidity(weather.getHumidity()); |
| | | weatherStation.setPm(weather.getAir_pm25()); |
| | |
| | | weatherStation.setWindDirection(weather.getWin()); |
| | | weatherStation.setWindPower(weather.getWin_meter()); |
| | | weatherStation.setWindSpeed(weather.getWin_speed()); |
| | | grain.setWeatherStation(weatherStation); |
| | | grain.setWeatherStation(JSONObject.toJSONString(weatherStation)); |
| | | |
| | | return new BaseResp(JSONObject.toJSONString(grain)); |
| | | } |