jiazx0107@163.com
2023-11-18 41cd6c8db40bceb08290828ae0d4fc5caeea7147
src/main/java/com/fzzy/gateway/controller/GatewayDeviceController.java
ÎļþÃû´Ó src/main/java/com/fzzy/gateway/controller/GatewayDeviceTestController.java ÐÞ¸Ä
@@ -1,25 +1,15 @@
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;
@@ -36,8 +26,8 @@
 */
@Slf4j
@Controller
@RequestMapping("/gateway/test")
public class GatewayDeviceTestController {
@RequestMapping("/gateway")
public class GatewayDeviceController {
    @Resource
    private GatewayDeviceService gatewayDeviceService;
@@ -52,9 +42,9 @@
     * @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:没有获取到业务类型,执行失败";
@@ -79,7 +69,39 @@
        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);
@@ -116,7 +138,7 @@
     * @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:为获取到系统中设备配置,取消执行";
@@ -148,10 +170,9 @@
     * @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) {
@@ -189,7 +210,7 @@
     *
     * @return
     */
    public String ajaxTestLpr(GateWayTestParam param) throws Exception {
    public String ajaxTestLpr(GateWayParam param) throws Exception {
        String carNumber = param.getCarNumber();