ÎļþÃû´Ó src/main/java/com/fzzy/gateway/controller/GatewayDeviceTestController.java ÐÞ¸Ä |
| | |
| | | package com.fzzy.gateway.controller; |
| | | |
| | | import com.alibaba.fastjson2.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.GatewayUtils; |
| | | 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.GateWayTestParam; |
| | | import com.fzzy.gateway.entity.GateWayParam; |
| | | import com.fzzy.gateway.entity.GatewayDevice; |
| | | import com.fzzy.gateway.hx2023.ScConstant; |
| | | import com.fzzy.gateway.hx2023.data.*; |
| | | import com.fzzy.gateway.service.GatewayDeviceService; |
| | | import com.fzzy.mqtt.MqttGatewayService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Controller |
| | | @RequestMapping("/gateway/test") |
| | | public class GatewayDeviceTestController { |
| | | @RequestMapping("/gateway") |
| | | public class GatewayDeviceController { |
| | | |
| | | @Resource |
| | | private GatewayDeviceService gatewayDeviceService; |
| | |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping("/deviceTest") |
| | | @PostMapping("/test/deviceTest") |
| | | public @ResponseBody |
| | | String deviceTest(@RequestBody GateWayTestParam param) throws Exception { |
| | | String deviceTest(@RequestBody GateWayParam param) throws Exception { |
| | | |
| | | if (StringUtils.isEmpty(param.getBizType())) { |
| | | return "ERROR:没æè·åå°ä¸å¡ç±»åï¼æ§è¡å¤±è´¥"; |
| | |
| | | return "SUCCESS"; |
| | | } |
| | | |
| | | private String testGrain(GateWayTestParam param) { |
| | | /** |
| | | * åå§å车çè¯å« |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PostMapping("/control/init-lpr") |
| | | public @ResponseBody |
| | | String initLpr(@RequestBody GateWayParam param) throws Exception { |
| | | |
| | | List<GatewayDevice> list = gatewayDeviceService.listAll(); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | return "ERROR:没æè·åå°è®¾å¤ä¿¡æ¯"; |
| | | } |
| | | |
| | | BaseReqData reqData; |
| | | int i = 1; |
| | | for (GatewayDevice device : list) { |
| | | |
| | | if (!GatewayDeviceType.TYPE_02.getCode().equals(device.getType())) { |
| | | continue; |
| | | } |
| | | reqData = new BaseReqData(device); |
| | | reqData.setIndex(i); |
| | | gatewayRemoteManager.getSyncLprService(device.getSyncProtocol()).initLpr(reqData); |
| | | i++; |
| | | } |
| | | |
| | | return "SUCCESS"; |
| | | } |
| | | |
| | | private String testGrain(GateWayParam param) { |
| | | String deviceId = param.getDeviceId(); |
| | | |
| | | GatewayDevice device = GatewayUtils.getCacheByDeviceId(deviceId); |
| | |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public String ajaxTestKafkaGrain(GateWayTestParam param) throws Exception { |
| | | public String ajaxTestKafkaGrain(GateWayParam param) throws Exception { |
| | | List<GatewayDevice> list = gatewayDeviceService.listAll(); |
| | | if (null == list || list.isEmpty()) { |
| | | return "ERRORï¼ä¸ºè·åå°ç³»ç»ä¸è®¾å¤é
ç½®ï¼åæ¶æ§è¡"; |
| | |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public String ajaxTestWeight(GateWayTestParam param) throws Exception { |
| | | public String ajaxTestWeight(GateWayParam param) throws Exception { |
| | | |
| | | double weight = param.getWeight(); |
| | | String deviceId = param.getDeviceId(); |
| | | |
| | | List<GatewayDevice> list = gatewayDeviceService.listAll(); |
| | | if (list == null || list.size() <= 0) { |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public String ajaxTestLpr(GateWayTestParam param) throws Exception { |
| | | public String ajaxTestLpr(GateWayParam param) throws Exception { |
| | | |
| | | String carNumber = param.getCarNumber(); |
| | | |