| | |
| | | package com.fzzy.gateway.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.fzzy.api.data.GatewayDeviceType; |
| | | import com.fzzy.api.utils.DateUtil; |
| | | import com.fzzy.async.fzzy40.Fzzy40CommonService; |
| | | import com.fzzy.async.fzzy40.entity.Fz40Grain; |
| | | import com.fzzy.gateway.api.DeviceReportService; |
| | | import com.fzzy.gateway.api.GatewayDeviceReportService; |
| | | import com.fzzy.gateway.api.GatewayRemoteManager; |
| | | import com.fzzy.gateway.data.BaseResp; |
| | | import com.fzzy.gateway.data.BaseReqData; |
| | | import com.fzzy.gateway.entity.GatewayDevice; |
| | | import com.fzzy.gateway.hx2023.ScConstant; |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | import com.fzzy.gateway.service.repository.GatewayDeviceRep; |
| | | import com.fzzy.mqtt.MqttGatewayService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | |
| | | */ |
| | | @Expose |
| | | public String ajaxTestGrain2(GatewayDevice data) { |
| | | SyncReqData reqData = new SyncReqData(); |
| | | BaseReqData reqData = new BaseReqData(); |
| | | reqData.setDevice(data); |
| | | reqData.setAutoReplay(true); |
| | | reqData.setMessageType(ScConstant.MESSAGE_TYPE_INVOKE_FUNCTION); |
| | |
| | | return "ERROR:当前设备没有配置布线规则,无法执行"; |
| | | } |
| | | |
| | | BaseResp resp = gatewayRemoteManager.getSyncGrainService(data.getSyncProtocol()).syncGrain2(reqData); |
| | | BaseResp resp = gatewayRemoteManager.getSyncGrainService(data.getSyncProtocol()).syncGrain(reqData); |
| | | |
| | | //自动推送 |
| | | if (200 == resp.getCode() && reqData.isAutoReplay()) { |
| | |
| | | |
| | | KafaGrainData pushData; |
| | | |
| | | DeviceReportService deviceReportService = null; |
| | | GatewayDeviceReportService deviceReportService = null; |
| | | for (GatewayDevice device : list) { |
| | | depotIdSys = device.getDepotIdSys(); |
| | | |
| | |
| | | |
| | | |
| | | if (null == deviceReportService) { |
| | | deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getProvinceProtocol()); |
| | | deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()); |
| | | } |
| | | |
| | | |
| | | deviceReportService.pushGrainData2Cloud(pushData); |
| | | // deviceReportService.pushGrainData2Cloud(pushData); |
| | | |
| | | } |
| | | |
| | |
| | | @Expose |
| | | public String ajaxTestWeight(Map<String,Object> data) throws Exception { |
| | | double weigh = (double) data.get("weight"); |
| | | double deviceId = (double) data.get("deviceId"); |
| | | |
| | | |
| | | List<GatewayDevice> devices = listAll(); |
| | |
| | | lpr.setCarNumber(carNumber); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("carNumber", carNumber); |
| | | jsonObject.put("position", "big"); |
| | | jsonObject.put("position", device.getPosition()); |
| | | packet.setProperties(jsonObject); |
| | | |
| | | packet.setTimestamp(System.currentTimeMillis()); |
| | |
| | | log.info("-----------test-------------------"); |
| | | return "SUCCESS"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * gatewayDeviceTestPR#testIde |
| | | * 测试下行分机 |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @Expose |
| | | public String testIde(Map<String,Object> data) throws Exception { |
| | | String deviceId = (String) data.get("deviceId"); |
| | | String bizType = (String) data.get("bizType"); |
| | | |
| | | log.info("-----------下行分机调试-设备={},事件={}",deviceId,bizType); |
| | | |
| | | return "SUCCESS"; |
| | | } |
| | | |
| | | } |