jiazx0107@163.com
2023-12-07 ae084b7ab31c38588928afb770cec1320c8c27f0
提交粮情协协议-控制柜-3
已修改5个文件
50 ■■■■■ 文件已修改
src/main/java/com/fzzy/api/data/ApiCommonDevice.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/protocol/fzzy/server/FzzyServerEngine.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fzzy/api/data/ApiCommonDevice.java
@@ -3,6 +3,8 @@
import com.fzzy.api.Constant;
import lombok.Data;
import java.util.Date;
/**
 * 虚拟通用设备,主要用于通讯过程中的设备信息,不持久化到数据库,在内存中保存和更新状态
 */
@@ -27,4 +29,6 @@
    private String result;//结果信息,以字符串代替
    private Date onlineTime = new Date();
}
src/main/java/com/fzzy/gateway/service/GatewayDeviceService.java
@@ -3,6 +3,8 @@
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.api.Constant;
import com.fzzy.api.data.ApiCommonDevice;
import com.fzzy.api.utils.ContextUtil;
import com.fzzy.async.fzzy40.Fzzy40CommonService;
import com.fzzy.gateway.GatewayUtils;
@@ -17,6 +19,7 @@
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@@ -34,7 +37,27 @@
    @DataProvider
    public List<GatewayDevice> listAll() {
        Sort sort = new Sort(Sort.Direction.ASC, "deviceId");
        return gatewayDeviceRep.findAll(sort);
        List<GatewayDevice> list = gatewayDeviceRep.findAll(sort);
        if (null == list || list.isEmpty()) return list;
        List<GatewayDevice> result = new ArrayList<>();
        ApiCommonDevice apiCommonDevice;
        for (GatewayDevice device : list) {
            apiCommonDevice = Constant.getCommonDeviceCache(device.getDeviceSn());
            if (null != apiCommonDevice) {
                device.setIp(apiCommonDevice.getIp());
                device.setPort(apiCommonDevice.getPort());
                device.setStatus(apiCommonDevice.getStatus());
                device.setOnlineTime(apiCommonDevice.getOnlineTime());
            }
            result.add(device);
        }
        return result;
    }
//    /**
src/main/java/com/fzzy/gateway/view/GatewayDevice.view.xml
@@ -113,8 +113,16 @@
        <Property name="label">筒仓层规则</Property>
      </PropertyDef>
      <PropertyDef name="position">
        <Property/>
        <Property></Property>
        <Property name="label">位置</Property>
      </PropertyDef>
      <PropertyDef name="status">
        <Property/>
        <Property name="label">在线状态</Property>
      </PropertyDef>
      <PropertyDef name="onlineTime">
        <Property name="dataType">DateTime</Property>
        <Property name="label">最后上线时间</Property>
      </PropertyDef>
    </DataType>
    <DataType name="dtParam" parent="Map">
@@ -275,8 +283,12 @@
        <Property name="property">syncProtocol</Property>
        <Property name="align">center</Property>
      </DataColumn>
      <DataColumn name="pushProtocol">
        <Property name="property">pushProtocol</Property>
      <DataColumn name="status">
        <Property name="property">status</Property>
        <Property name="align">center</Property>
      </DataColumn>
      <DataColumn name="onlineTime">
        <Property name="property">onlineTime</Property>
        <Property name="align">center</Property>
      </DataColumn>
    </DataGrid>
src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java
@@ -38,6 +38,7 @@
        device.setPort(reMessage.getPort());
        device.setSn(reMessage.getSn());
        device.setId(reMessage.getIedId());
        device.setOnlineTime(new Date());
        Constant.updateCache(device);
src/main/java/com/fzzy/protocol/fzzy/server/FzzyServerEngine.java
@@ -12,7 +12,7 @@
@Slf4j
public class FzzyServerEngine {
    public static final int default_port = 9300;
    public static final int default_port = 19300;
    public static NettyServer ioServer = null;